@eui/core 23.0.0-alpha.6 → 23.0.0-alpha.8
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/CHANGELOG.md +40 -0
- package/docs/changelog.html +86 -0
- package/docs/interfaces/Schema-1.html +13 -1
- package/docs/interfaces/Schema-13.html +1 -1
- package/docs/interfaces/Schema-14.html +1 -1
- package/docs/interfaces/Schema-15.html +1 -1
- package/docs/interfaces/Schema-16.html +1 -1
- package/docs/interfaces/Schema-18.html +1 -1
- package/docs/interfaces/Schema-19.html +1 -1
- package/docs/interfaces/Schema-2.html +46 -13
- package/docs/interfaces/Schema-20.html +1 -1
- package/docs/interfaces/Schema-4.html +1 -1
- package/docs/interfaces/Schema-5.html +1 -1
- package/docs/interfaces/Schema-6.html +1 -1
- package/docs/interfaces/Schema.html +1 -46
- package/docs/interfaces/UIState.html +45 -0
- package/docs/js/search/search_index.js +2 -2
- package/docs/json/documentation.json +124 -112
- package/docs/llms.txt +66 -65
- package/docs/miscellaneous/functions.html +127 -127
- package/docs/miscellaneous/variables.html +34 -33
- package/docs/properties.html +1 -1
- package/fesm2022/eui-core.mjs +7 -0
- package/fesm2022/eui-core.mjs.map +1 -1
- package/package.json +2 -2
- package/types/eui-core.d.ts +1 -0
- package/types/eui-core.d.ts.map +1 -1
|
@@ -2092,12 +2092,12 @@
|
|
|
2092
2092
|
},
|
|
2093
2093
|
{
|
|
2094
2094
|
"name": "Schema",
|
|
2095
|
-
"id": "interface-Schema-
|
|
2096
|
-
"file": "packages/core/schematics/
|
|
2095
|
+
"id": "interface-Schema-4fe31ff3e9f1d34845a6b865d605e215f33552094b88c3d0eab0b180187fe64ce4d68d687516cb3d62c57d2678a103969b2dacbb18a49b26060f78096678fcce-1",
|
|
2096
|
+
"file": "packages/core/schematics/fix-no-multiple-empty-lines/index.ts",
|
|
2097
2097
|
"deprecated": false,
|
|
2098
2098
|
"deprecationMessage": "",
|
|
2099
2099
|
"type": "interface",
|
|
2100
|
-
"sourceCode": "
|
|
2100
|
+
"sourceCode": "import { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport { logDryRun, logDryRunNote } from '../utils/dry-run';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\nconst MULTIPLE_EMPTY_LINES = /\\n{3,}/g;\n\nexport function fixNoMultipleEmptyLines(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n let count = 0;\n\n const dir = tree.getDir(scanPath || '/');\n visitDir(dir, (filePath) => {\n const buffer = tree.read(filePath);\n if (!buffer) return;\n\n const original = buffer.toString('utf-8');\n const result = original.replace(MULTIPLE_EMPTY_LINES, '\\n\\n');\n\n if (result !== original) {\n if (filePath.endsWith('.ts')) {\n const sourceFile = ts.createSourceFile(filePath, result, ts.ScriptTarget.Latest, true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((sourceFile as any).parseDiagnostics?.length) {\n context.logger.warn(`Skipping ${filePath}: file would not parse after transformation.`);\n return;\n }\n }\n if (options.dryRun) {\n logDryRun(context, `Would collapse multiple empty lines in ${filePath}`);\n } else {\n tree.overwrite(filePath, result);\n }\n count++;\n }\n });\n\n context.logger.info(`Fixed multiple empty lines in ${count} file(s).`);\n if (options.dryRun) {\n logDryRunNote(context);\n }\n return tree;\n };\n}\n\nfunction visitDir(dir: DirEntry, callback: (path: string) => void): void {\n for (const file of dir.subfiles) {\n if (file.endsWith('.d.ts')) continue;\n if (!file.endsWith('.ts') && !file.endsWith('.html') && !file.endsWith('.scss') && !file.endsWith('.css')) continue;\n callback(`${dir.path}/${file}`);\n }\n for (const sub of dir.subdirs) {\n if (sub === 'node_modules' || sub === 'dist') continue;\n visitDir(dir.dir(sub), callback);\n }\n}\n",
|
|
2101
2101
|
"displayName": "Schema",
|
|
2102
2102
|
"properties": [
|
|
2103
2103
|
{
|
|
@@ -2108,9 +2108,9 @@
|
|
|
2108
2108
|
"type": "boolean",
|
|
2109
2109
|
"indexKey": "",
|
|
2110
2110
|
"optional": true,
|
|
2111
|
-
"description": "
|
|
2112
|
-
"line":
|
|
2113
|
-
"rawdescription": "\
|
|
2111
|
+
"description": "",
|
|
2112
|
+
"line": 7,
|
|
2113
|
+
"rawdescription": "\n"
|
|
2114
2114
|
},
|
|
2115
2115
|
{
|
|
2116
2116
|
"name": "path",
|
|
@@ -2120,9 +2120,9 @@
|
|
|
2120
2120
|
"type": "string",
|
|
2121
2121
|
"indexKey": "",
|
|
2122
2122
|
"optional": true,
|
|
2123
|
-
"description": "
|
|
2124
|
-
"line":
|
|
2125
|
-
"rawdescription": "\
|
|
2123
|
+
"description": "",
|
|
2124
|
+
"line": 6,
|
|
2125
|
+
"rawdescription": "\n"
|
|
2126
2126
|
}
|
|
2127
2127
|
],
|
|
2128
2128
|
"indexSignatures": [],
|
|
@@ -2139,12 +2139,12 @@
|
|
|
2139
2139
|
},
|
|
2140
2140
|
{
|
|
2141
2141
|
"name": "Schema",
|
|
2142
|
-
"id": "interface-Schema-
|
|
2143
|
-
"file": "packages/core/schematics/migrate/schema.ts",
|
|
2142
|
+
"id": "interface-Schema-5cd6db1920bd5b70a44c0b8a7f7e30f600bfd16a9950f218e6d451a1755ced95b462ef9a62ee87e39bcb8c392981b8d2597895bf0a272fd8aea71f03429ed976-2",
|
|
2143
|
+
"file": "packages/core/schematics/icon-migrate/schema.ts",
|
|
2144
2144
|
"deprecated": false,
|
|
2145
2145
|
"deprecationMessage": "",
|
|
2146
2146
|
"type": "interface",
|
|
2147
|
-
"sourceCode": "export interface Schema {\n /** The path to scan for files to migrate */\n path?: string;\n /** Whether to
|
|
2147
|
+
"sourceCode": "export interface Schema {\n /** The path to scan for files to migrate */\n path?: string;\n /** Whether to perform a dry run without making changes */\n dryRun?: boolean;\n}\n",
|
|
2148
2148
|
"displayName": "Schema",
|
|
2149
2149
|
"properties": [
|
|
2150
2150
|
{
|
|
@@ -2156,20 +2156,8 @@
|
|
|
2156
2156
|
"indexKey": "",
|
|
2157
2157
|
"optional": true,
|
|
2158
2158
|
"description": "<p>Whether to perform a dry run without making changes</p>\n",
|
|
2159
|
-
"line": 7,
|
|
2160
|
-
"rawdescription": "\nWhether to perform a dry run without making changes"
|
|
2161
|
-
},
|
|
2162
|
-
{
|
|
2163
|
-
"name": "mwp",
|
|
2164
|
-
"coverageIgnore": false,
|
|
2165
|
-
"deprecated": false,
|
|
2166
|
-
"deprecationMessage": "",
|
|
2167
|
-
"type": "boolean",
|
|
2168
|
-
"indexKey": "",
|
|
2169
|
-
"optional": true,
|
|
2170
|
-
"description": "<p>Whether to apply MyWorkplace-specific replacements</p>\n",
|
|
2171
2159
|
"line": 5,
|
|
2172
|
-
"rawdescription": "\nWhether to
|
|
2160
|
+
"rawdescription": "\nWhether to perform a dry run without making changes"
|
|
2173
2161
|
},
|
|
2174
2162
|
{
|
|
2175
2163
|
"name": "path",
|
|
@@ -2198,12 +2186,12 @@
|
|
|
2198
2186
|
},
|
|
2199
2187
|
{
|
|
2200
2188
|
"name": "Schema",
|
|
2201
|
-
"id": "interface-Schema-
|
|
2202
|
-
"file": "packages/core/schematics/
|
|
2189
|
+
"id": "interface-Schema-56b9fe60701ca349dc90e152829b0a18bb7a8a9bb303c4bac05f9764cd2e933cce0879775ca17168b4c881e202d0258af3668a2a3a1b940e561f7e4b2349b5cc-3",
|
|
2190
|
+
"file": "packages/core/schematics/migrate/schema.ts",
|
|
2203
2191
|
"deprecated": false,
|
|
2204
2192
|
"deprecationMessage": "",
|
|
2205
2193
|
"type": "interface",
|
|
2206
|
-
"sourceCode": "
|
|
2194
|
+
"sourceCode": "export interface Schema {\n /** The path to scan for files to migrate */\n path?: string;\n /** Whether to apply MyWorkplace-specific replacements */\n mwp?: boolean;\n /** Whether to perform a dry run without making changes */\n dryRun?: boolean;\n}\n",
|
|
2207
2195
|
"displayName": "Schema",
|
|
2208
2196
|
"properties": [
|
|
2209
2197
|
{
|
|
@@ -2214,9 +2202,21 @@
|
|
|
2214
2202
|
"type": "boolean",
|
|
2215
2203
|
"indexKey": "",
|
|
2216
2204
|
"optional": true,
|
|
2217
|
-
"description": "",
|
|
2205
|
+
"description": "<p>Whether to perform a dry run without making changes</p>\n",
|
|
2218
2206
|
"line": 7,
|
|
2219
|
-
"rawdescription": "\
|
|
2207
|
+
"rawdescription": "\nWhether to perform a dry run without making changes"
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
"name": "mwp",
|
|
2211
|
+
"coverageIgnore": false,
|
|
2212
|
+
"deprecated": false,
|
|
2213
|
+
"deprecationMessage": "",
|
|
2214
|
+
"type": "boolean",
|
|
2215
|
+
"indexKey": "",
|
|
2216
|
+
"optional": true,
|
|
2217
|
+
"description": "<p>Whether to apply MyWorkplace-specific replacements</p>\n",
|
|
2218
|
+
"line": 5,
|
|
2219
|
+
"rawdescription": "\nWhether to apply MyWorkplace-specific replacements"
|
|
2220
2220
|
},
|
|
2221
2221
|
{
|
|
2222
2222
|
"name": "path",
|
|
@@ -2226,9 +2226,9 @@
|
|
|
2226
2226
|
"type": "string",
|
|
2227
2227
|
"indexKey": "",
|
|
2228
2228
|
"optional": true,
|
|
2229
|
-
"description": "",
|
|
2230
|
-
"line":
|
|
2231
|
-
"rawdescription": "\
|
|
2229
|
+
"description": "<p>The path to scan for files to migrate</p>\n",
|
|
2230
|
+
"line": 3,
|
|
2231
|
+
"rawdescription": "\nThe path to scan for files to migrate"
|
|
2232
2232
|
}
|
|
2233
2233
|
],
|
|
2234
2234
|
"indexSignatures": [],
|
|
@@ -3424,12 +3424,12 @@
|
|
|
3424
3424
|
},
|
|
3425
3425
|
{
|
|
3426
3426
|
"name": "UIState",
|
|
3427
|
-
"id": "interface-UIState-
|
|
3427
|
+
"id": "interface-UIState-2b10e519e4a4b60702c2f5da03d8ea5dc23dbec19cc7d660553b4aac90c5bdcd38a9eee6e4f6c9e5e9f468f5f00d106dcd82a7d9667028ef3f85483af3b8ffee",
|
|
3428
3428
|
"file": "packages/core/src/lib/services/eui-app-shell.service.ts",
|
|
3429
3429
|
"deprecated": false,
|
|
3430
3430
|
"deprecationMessage": "",
|
|
3431
3431
|
"type": "interface",
|
|
3432
|
-
"sourceCode": "import { Injectable, PLATFORM_ID, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { BehaviorSubject, defer, firstValueFrom, Observable } from 'rxjs';\nimport { EuiEuLanguages, GlobalConfig, getActiveLang, EuiLanguage, EuiMenuItem } from '@eui/base';\nimport { GLOBAL_CONFIG_TOKEN } from './config/tokens';\nimport { I18nService } from './i18n';\nimport { Router, NavigationEnd } from '@angular/router';\nimport { StoreService } from './store/store.service';\nimport { distinctUntilChanged, filter, map } from 'rxjs/operators';\nimport { isEqual, get } from 'lodash-es';\nimport { CssUtils } from '../helpers/css-utils';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface UIState<BP = any, DI = any, AMD =any, BPV = any> {\n // app state\n appName?: string;\n appShortName?: string;\n appSubTitle?: string;\n appBaseFontSize?: string;\n\n // Sidebar state\n isSidebarOpen?: boolean;\n isSidebarActive?: boolean;\n hasSidebar?: boolean;\n hasSideContainer?: boolean;\n hasBreadcrumb?: boolean;\n hasHeader?: boolean;\n hasHeaderLogo?: boolean;\n hasHeaderEnvironment?: boolean;\n hasToolbar?: boolean;\n hasToolbarMegaMenu?: boolean;\n hasToolbarMenu?: boolean;\n environmentValue?: string;\n isSidebarHidden?: boolean;\n isSidebarFocused?: boolean;\n hasSidebarCollapsedVariant?: boolean;\n hasTopMessage?: boolean;\n\n // window state\n windowWidth?: number;\n windowHeight?: number;\n mainContentHeight?: number;\n pageHeaderHeight?: number;\n breakpoint?: string;\n wrapperClasses?: string;\n breakpoints?: BP;\n breakpointValues?: BPV;\n\n // navigation state\n menuLinks?: EuiMenuItem[];\n sidebarLinks?: EuiMenuItem[];\n combinedLinks?: EuiMenuItem[];\n\n // other states\n isBlockDocumentActive?: boolean;\n\n // device info\n deviceInfo: DI;\n\n // language infos\n activeLanguage: string;\n languages: (string | EuiLanguage)[];\n\n // app metadata\n appMetadata: AMD;\n\n // various dynamic state\n hasModalActive?: boolean;\n isDimmerActive?: boolean; // Usage: map to eui base directive input coerce euiHighlighted\n}\n\nconst initialState: UIState = {\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EuiAppShellService {\n navigationStartCustomHandler: () => void;\n navigationEndCustomHandler: () => void;\n protected config = inject<GlobalConfig>(GLOBAL_CONFIG_TOKEN, { optional: true });\n private http = inject(HttpClient);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n private router = inject(Router);\n private storeService = inject(StoreService);\n private i18nService = inject(I18nService, { optional: true });\n\n // -------------------\n get state$(): Observable<UIState> {\n return this._state$.asObservable();\n }\n\n // -------------------\n // exposed observables\n\n get breakpoint$(): Observable<string> {\n return this._breakpoint$.asObservable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get breakpoints$(): Observable<any> {\n return this._breakpoints$.asObservable();\n }\n\n // ----------------\n // state operations\n // ----------------\n get state(): UIState {\n return this._state$.getValue();\n }\n\n // ----------------------------\n // public setters and functions\n // ----------------------------\n set isSidebarOpen(isOpen: boolean) {\n this.setState({\n ...this.state,\n isSidebarOpen: isOpen,\n });\n }\n\n get isSidebarOpen(): boolean {\n return this.state.isSidebarOpen;\n }\n\n set isSidebarActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isSidebarActive: isActive,\n });\n }\n\n set sidebarLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n sidebarLinks: links,\n });\n }\n\n set hasSidebarCollapsedVariant(isActive: boolean) {\n this.setState({\n ...this.state,\n hasSidebarCollapsedVariant: isActive,\n });\n CssUtils.activateSidebarCssVars(this.document, this.platformId, isActive);\n }\n\n set menuLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n menuLinks: links,\n });\n }\n\n set isBlockDocumentActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isBlockDocumentActive: isActive,\n });\n }\n\n get hasHeader(): boolean {\n return this.state.hasHeader;\n }\n\n // Edit mode\n get isDimmerActive(): boolean {\n return this.state.isDimmerActive;\n }\n\n set isDimmerActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isDimmerActive: isActive,\n });\n }\n\n private _state$: BehaviorSubject<UIState>;\n private _breakpoint$: BehaviorSubject<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _breakpoints$: BehaviorSubject<any>;\n\n constructor() {\n const config = this.config;\n\n let stateWithConfig = initialState;\n const languages = config?.i18n?.i18nService?.languages || initialState.languages;\n const defaultLanguage = config?.i18n?.i18nService?.defaultLanguage || initialState.activeLanguage;\n stateWithConfig = {\n ...stateWithConfig,\n ...{\n languages,\n activeLanguage: defaultLanguage,\n },\n };\n this._state$ = new BehaviorSubject(stateWithConfig);\n this._breakpoint$ = new BehaviorSubject('');\n this._breakpoints$ = new BehaviorSubject({});\n this.bindActiveLanguageToAppShellState();\n }\n\n setState(nextState: UIState, updateI18 = true): void {\n let breakpoint, breakpoints;\n let combinedLinks;\n\n const state = this.state;\n\n // check if window width has been updated from previous state\n if (this.state.windowWidth !== nextState.windowWidth) {\n breakpoint = this.getBreakpoint(nextState.windowWidth);\n breakpoints = this.getBreakpoints(breakpoint);\n\n this._breakpoint$.next(breakpoint);\n this._breakpoints$.next(breakpoints);\n\n // if not propagate the old ones without doing any calculations\n } else {\n breakpoint = state.breakpoint;\n breakpoints = state.breakpoints;\n }\n\n // finally get the wrapper classes when both the state and breakpoint are known\n const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);\n\n // check if the menuLinks or sidebarLinks have changed from previous state\n if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) {\n combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];\n } else {\n combinedLinks = this.state.combinedLinks;\n }\n\n const stateBeforeUpdate = { ...this.state };\n\n // we put it all together with the calculated properties\n this._state$.next({\n ...nextState,\n wrapperClasses,\n breakpoint,\n breakpoints,\n combinedLinks,\n });\n\n // update the Store Language\n if (updateI18 && nextState.activeLanguage !== stateBeforeUpdate.activeLanguage) {\n this.i18nService.updateState({ activeLang: nextState.activeLanguage });\n }\n }\n\n /**\n * Emits a slice from the state whether that changes\n *\n * @param key can be 'key' or 'key.sub.sub'\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getState<T = any>(key?: string): Observable<T> {\n return defer(() =>\n // check if key exists\n key\n ? this.state$.pipe(\n map((state) => get(state, key)),\n // filter((state) => state),\n distinctUntilChanged((x, y) => isEqual(x, y)),\n )\n : this.state$,\n );\n }\n\n public sidebarToggle(): void {\n this.isSidebarOpen = !this.state.isSidebarOpen;\n }\n\n // Edit mode\n public dimmerActiveToggle(): void {\n const isActive = this.isDimmerActive;\n this.setState({\n ...this.state,\n isDimmerActive: !isActive,\n });\n CssUtils.activateEditModeCssVars(!isActive, this.document);\n }\n\n public setDimmerActiveState(activeState: boolean): void {\n this.setState({\n ...this.state,\n isDimmerActive: activeState,\n });\n CssUtils.activateEditModeCssVars(activeState, this.document);\n }\n\n // --------------\n // public methods\n // --------------\n public fetchAppMetadata(metadataFilePath = 'assets/app-metadata.json'): void {\n this.getJson(metadataFilePath).then((data) => {\n this.setState({\n ...this.state,\n appMetadata: data,\n });\n });\n }\n\n public activateSidebar(): void {\n this.setState({\n ...this.state,\n hasSidebar: true,\n });\n\n if (!this.state.isSidebarHidden) {\n CssUtils.activateSidebarCssVars(this.document, this.platformId, this.state.hasSidebarCollapsedVariant);\n }\n }\n\n public activateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: true,\n });\n\n CssUtils.activateSideContainerCssVars(this.document, this.platformId);\n } \n\n public deactivateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: false,\n });\n\n CssUtils.deactivateSideContainerCssVars(this.document, this.platformId);\n } \n\n public activateSidebarHeader(): void {\n CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);\n }\n\n public activateSidebarFooter(): void {\n CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);\n }\n\n public activateHeader(): void {\n this.setState({\n ...this.state,\n hasHeader: true,\n });\n CssUtils.activateHeaderCssVars(this.document, this.platformId);\n }\n\n public activateBreadcrumb(): void {\n this.setState({\n ...this.state,\n hasBreadcrumb: true,\n });\n CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);\n }\n\n public activateTopMessage(height: number): void {\n this.setState({\n ...this.state,\n hasTopMessage: true,\n });\n CssUtils.activateTopMessageCssVars(height, this.document);\n }\n\n public activateToolbar(): void {\n this.setState({\n ...this.state,\n hasToolbar: true,\n });\n CssUtils.activateToolbarCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMegaMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMegaMenu: true,\n });\n CssUtils.activateToolbarMegaMenuCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMenu: true,\n });\n }\n\n /**\n * Returns the current value of --eui-f-size-base CSS variable\n */\n public getBaseFontSize(): string {\n return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);\n }\n\n /**\n * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n */\n public setBaseFontSize(newsize: string): void {\n this.setState(\n {\n ...this.state,\n appBaseFontSize: newsize,\n },\n false,\n );\n CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);\n }\n\n // ---------------\n // private getters\n // ---------------\n private getWrapperClasses(state: UIState, breakpoint: string): string {\n const classes: string[] = [];\n\n classes.push(breakpoint);\n\n if (state.hasSidebar) {\n if (state.isSidebarHidden) {\n classes.push('sidebar--hidden');\n }\n if (state.isSidebarOpen) {\n classes.push('sidebar--open');\n } else {\n classes.push('sidebar--close');\n }\n }\n if (state.deviceInfo?.isFF) {\n classes.push('ff');\n }\n if (state.deviceInfo?.isIE) {\n classes.push('ie');\n }\n if (state.deviceInfo?.isChrome) {\n classes.push('chrome');\n }\n return classes.join(' ');\n }\n\n private getBreakpoint(windowWidth: number): string {\n let bkp = '';\n\n if (this.state.breakpointValues.length === 0) {\n this.setState({\n ...this.state,\n breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),\n });\n }\n\n this.state.breakpointValues.forEach((b, i) => {\n if (i < this.state.breakpointValues.length) {\n if (windowWidth >= b.value && windowWidth < this.state.breakpointValues[i+1]?.value) {\n bkp = b.bkp;\n }\n } else if(windowWidth >= b.value) {\n bkp = b.bkp;\n }\n });\n\n return bkp;\n }\n\n private getBreakpoints(bkp: string): object {\n return {\n isMobile: bkp === 'xs' || bkp === 'sm',\n isTablet: bkp === 'md',\n isLtLargeTablet: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg',\n isLtDesktop: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg' || bkp === 'xl',\n isDesktop: bkp === 'xxl',\n isXL: bkp === 'xl',\n isXXL: bkp === 'xxl',\n isFHD: bkp === 'fhd',\n is2K: bkp === '2k',\n is4K: bkp === '4k',\n };\n }\n\n private getJson(url: string): Promise<object> {\n return firstValueFrom(this.http.get(url)).then(this.extractData).catch(this.handleError);\n }\n\n private extractData(res: Response): object {\n const body = res;\n return body || {};\n }\n\n private handleError<T extends Error>(error: T): Promise<T> {\n console.error('An error occurred', error);\n return Promise.reject(error.message || error);\n }\n\n private bindActiveLanguageToAppShellState(): void {\n this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {\n if (activeLang !== this.state.activeLanguage) {\n this.setState(\n {\n ...this.state,\n activeLanguage: activeLang,\n },\n false,\n );\n }\n });\n }\n}\n",
|
|
3432
|
+
"sourceCode": "import { Injectable, PLATFORM_ID, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { BehaviorSubject, defer, firstValueFrom, Observable } from 'rxjs';\nimport { EuiEuLanguages, GlobalConfig, getActiveLang, EuiLanguage, EuiMenuItem } from '@eui/base';\nimport { GLOBAL_CONFIG_TOKEN } from './config/tokens';\nimport { I18nService } from './i18n';\nimport { Router, NavigationEnd } from '@angular/router';\nimport { StoreService } from './store/store.service';\nimport { distinctUntilChanged, filter, map } from 'rxjs/operators';\nimport { isEqual, get } from 'lodash-es';\nimport { CssUtils } from '../helpers/css-utils';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface UIState<BP = any, DI = any, AMD =any, BPV = any> {\n // app state\n appName?: string;\n appShortName?: string;\n appSubTitle?: string;\n appBaseFontSize?: string;\n\n // Sidebar state\n isSidebarOpen?: boolean;\n isSidebarActive?: boolean;\n hasFixedPosition?: boolean;\n hasSidebar?: boolean;\n hasSideContainer?: boolean;\n hasBreadcrumb?: boolean;\n hasHeader?: boolean;\n hasHeaderLogo?: boolean;\n hasHeaderEnvironment?: boolean;\n hasToolbar?: boolean;\n hasToolbarMegaMenu?: boolean;\n hasToolbarMenu?: boolean;\n environmentValue?: string;\n isSidebarHidden?: boolean;\n isSidebarFocused?: boolean;\n hasSidebarCollapsedVariant?: boolean;\n hasTopMessage?: boolean;\n\n // window state\n windowWidth?: number;\n windowHeight?: number;\n mainContentHeight?: number;\n pageHeaderHeight?: number;\n breakpoint?: string;\n wrapperClasses?: string;\n breakpoints?: BP;\n breakpointValues?: BPV;\n\n // navigation state\n menuLinks?: EuiMenuItem[];\n sidebarLinks?: EuiMenuItem[];\n combinedLinks?: EuiMenuItem[];\n\n // other states\n isBlockDocumentActive?: boolean;\n\n // device info\n deviceInfo: DI;\n\n // language infos\n activeLanguage: string;\n languages: (string | EuiLanguage)[];\n\n // app metadata\n appMetadata: AMD;\n\n // various dynamic state\n hasModalActive?: boolean;\n isDimmerActive?: boolean; // Usage: map to eui base directive input coerce euiHighlighted\n}\n\nconst initialState: UIState = {\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasFixedPosition: true,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EuiAppShellService {\n navigationStartCustomHandler: () => void;\n navigationEndCustomHandler: () => void;\n protected config = inject<GlobalConfig>(GLOBAL_CONFIG_TOKEN, { optional: true });\n private http = inject(HttpClient);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n private router = inject(Router);\n private storeService = inject(StoreService);\n private i18nService = inject(I18nService, { optional: true });\n\n // -------------------\n get state$(): Observable<UIState> {\n return this._state$.asObservable();\n }\n\n // -------------------\n // exposed observables\n\n get breakpoint$(): Observable<string> {\n return this._breakpoint$.asObservable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get breakpoints$(): Observable<any> {\n return this._breakpoints$.asObservable();\n }\n\n // ----------------\n // state operations\n // ----------------\n get state(): UIState {\n return this._state$.getValue();\n }\n\n // ----------------------------\n // public setters and functions\n // ----------------------------\n set isSidebarOpen(isOpen: boolean) {\n this.setState({\n ...this.state,\n isSidebarOpen: isOpen,\n });\n }\n\n get isSidebarOpen(): boolean {\n return this.state.isSidebarOpen;\n }\n\n set isSidebarActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isSidebarActive: isActive,\n });\n }\n\n set sidebarLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n sidebarLinks: links,\n });\n }\n\n set hasSidebarCollapsedVariant(isActive: boolean) {\n this.setState({\n ...this.state,\n hasSidebarCollapsedVariant: isActive,\n });\n CssUtils.activateSidebarCssVars(this.document, this.platformId, isActive);\n }\n\n set menuLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n menuLinks: links,\n });\n }\n\n set isBlockDocumentActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isBlockDocumentActive: isActive,\n });\n }\n\n get hasHeader(): boolean {\n return this.state.hasHeader;\n }\n\n // Edit mode\n get isDimmerActive(): boolean {\n return this.state.isDimmerActive;\n }\n\n set isDimmerActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isDimmerActive: isActive,\n });\n }\n\n private _state$: BehaviorSubject<UIState>;\n private _breakpoint$: BehaviorSubject<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _breakpoints$: BehaviorSubject<any>;\n\n constructor() {\n const config = this.config;\n\n let stateWithConfig = initialState;\n const languages = config?.i18n?.i18nService?.languages || initialState.languages;\n const defaultLanguage = config?.i18n?.i18nService?.defaultLanguage || initialState.activeLanguage;\n stateWithConfig = {\n ...stateWithConfig,\n ...{\n languages,\n activeLanguage: defaultLanguage,\n },\n };\n this._state$ = new BehaviorSubject(stateWithConfig);\n this._breakpoint$ = new BehaviorSubject('');\n this._breakpoints$ = new BehaviorSubject({});\n this.bindActiveLanguageToAppShellState();\n }\n\n setState(nextState: UIState, updateI18 = true): void {\n let breakpoint, breakpoints;\n let combinedLinks;\n\n const state = this.state;\n\n // check if window width has been updated from previous state\n if (this.state.windowWidth !== nextState.windowWidth) {\n breakpoint = this.getBreakpoint(nextState.windowWidth);\n breakpoints = this.getBreakpoints(breakpoint);\n\n this._breakpoint$.next(breakpoint);\n this._breakpoints$.next(breakpoints);\n\n // if not propagate the old ones without doing any calculations\n } else {\n breakpoint = state.breakpoint;\n breakpoints = state.breakpoints;\n }\n\n // finally get the wrapper classes when both the state and breakpoint are known\n const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);\n\n // check if the menuLinks or sidebarLinks have changed from previous state\n if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) {\n combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];\n } else {\n combinedLinks = this.state.combinedLinks;\n }\n\n const stateBeforeUpdate = { ...this.state };\n\n // we put it all together with the calculated properties\n this._state$.next({\n ...nextState,\n wrapperClasses,\n breakpoint,\n breakpoints,\n combinedLinks,\n });\n\n // update the Store Language\n if (updateI18 && nextState.activeLanguage !== stateBeforeUpdate.activeLanguage) {\n this.i18nService.updateState({ activeLang: nextState.activeLanguage });\n }\n }\n\n /**\n * Emits a slice from the state whether that changes\n *\n * @param key can be 'key' or 'key.sub.sub'\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getState<T = any>(key?: string): Observable<T> {\n return defer(() =>\n // check if key exists\n key\n ? this.state$.pipe(\n map((state) => get(state, key)),\n // filter((state) => state),\n distinctUntilChanged((x, y) => isEqual(x, y)),\n )\n : this.state$,\n );\n }\n\n public sidebarToggle(): void {\n this.isSidebarOpen = !this.state.isSidebarOpen;\n }\n\n // Edit mode\n public dimmerActiveToggle(): void {\n const isActive = this.isDimmerActive;\n this.setState({\n ...this.state,\n isDimmerActive: !isActive,\n });\n CssUtils.activateEditModeCssVars(!isActive, this.document);\n }\n\n public setDimmerActiveState(activeState: boolean): void {\n this.setState({\n ...this.state,\n isDimmerActive: activeState,\n });\n CssUtils.activateEditModeCssVars(activeState, this.document);\n }\n\n // --------------\n // public methods\n // --------------\n public fetchAppMetadata(metadataFilePath = 'assets/app-metadata.json'): void {\n this.getJson(metadataFilePath).then((data) => {\n this.setState({\n ...this.state,\n appMetadata: data,\n });\n });\n }\n\n public activateSidebar(): void {\n this.setState({\n ...this.state,\n hasSidebar: true,\n });\n\n if (!this.state.isSidebarHidden) {\n CssUtils.activateSidebarCssVars(this.document, this.platformId, this.state.hasSidebarCollapsedVariant);\n }\n }\n\n public activateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: true,\n });\n\n CssUtils.activateSideContainerCssVars(this.document, this.platformId);\n } \n\n public deactivateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: false,\n });\n\n CssUtils.deactivateSideContainerCssVars(this.document, this.platformId);\n } \n\n public activateSidebarHeader(): void {\n CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);\n }\n\n public activateSidebarFooter(): void {\n CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);\n }\n\n public activateHeader(): void {\n this.setState({\n ...this.state,\n hasHeader: true,\n });\n CssUtils.activateHeaderCssVars(this.document, this.platformId);\n }\n\n public activateBreadcrumb(): void {\n this.setState({\n ...this.state,\n hasBreadcrumb: true,\n });\n CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);\n }\n\n public activateTopMessage(height: number): void {\n this.setState({\n ...this.state,\n hasTopMessage: true,\n });\n CssUtils.activateTopMessageCssVars(height, this.document);\n }\n\n public activateToolbar(): void {\n this.setState({\n ...this.state,\n hasToolbar: true,\n });\n CssUtils.activateToolbarCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMegaMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMegaMenu: true,\n });\n CssUtils.activateToolbarMegaMenuCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMenu: true,\n });\n }\n\n /**\n * Returns the current value of --eui-f-size-base CSS variable\n */\n public getBaseFontSize(): string {\n return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);\n }\n\n /**\n * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n */\n public setBaseFontSize(newsize: string): void {\n this.setState(\n {\n ...this.state,\n appBaseFontSize: newsize,\n },\n false,\n );\n CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);\n }\n\n // ---------------\n // private getters\n // ---------------\n private getWrapperClasses(state: UIState, breakpoint: string): string {\n const classes: string[] = [];\n\n classes.push(breakpoint);\n\n if (state.hasSidebar) {\n if (state.isSidebarHidden) {\n classes.push('sidebar--hidden');\n }\n if (state.isSidebarOpen) {\n classes.push('sidebar--open');\n } else {\n classes.push('sidebar--close');\n }\n }\n if (state.deviceInfo?.isFF) {\n classes.push('ff');\n }\n if (state.deviceInfo?.isIE) {\n classes.push('ie');\n }\n if (state.deviceInfo?.isChrome) {\n classes.push('chrome');\n }\n if (state.hasFixedPosition) {\n classes.push('fixed-position');\n } else {\n classes.push('relative-position');\n }\n return classes.join(' ');\n }\n\n private getBreakpoint(windowWidth: number): string {\n let bkp = '';\n\n if (this.state.breakpointValues.length === 0) {\n this.setState({\n ...this.state,\n breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),\n });\n }\n\n this.state.breakpointValues.forEach((b, i) => {\n if (i < this.state.breakpointValues.length) {\n if (windowWidth >= b.value && windowWidth < this.state.breakpointValues[i+1]?.value) {\n bkp = b.bkp;\n }\n } else if(windowWidth >= b.value) {\n bkp = b.bkp;\n }\n });\n\n return bkp;\n }\n\n private getBreakpoints(bkp: string): object {\n return {\n isMobile: bkp === 'xs' || bkp === 'sm',\n isTablet: bkp === 'md',\n isLtLargeTablet: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg',\n isLtDesktop: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg' || bkp === 'xl',\n isDesktop: bkp === 'xxl',\n isXL: bkp === 'xl',\n isXXL: bkp === 'xxl',\n isFHD: bkp === 'fhd',\n is2K: bkp === '2k',\n is4K: bkp === '4k',\n };\n }\n\n private getJson(url: string): Promise<object> {\n return firstValueFrom(this.http.get(url)).then(this.extractData).catch(this.handleError);\n }\n\n private extractData(res: Response): object {\n const body = res;\n return body || {};\n }\n\n private handleError<T extends Error>(error: T): Promise<T> {\n console.error('An error occurred', error);\n return Promise.reject(error.message || error);\n }\n\n private bindActiveLanguageToAppShellState(): void {\n this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {\n if (activeLang !== this.state.activeLanguage) {\n this.setState(\n {\n ...this.state,\n activeLanguage: activeLang,\n },\n false,\n );\n }\n });\n }\n}\n",
|
|
3433
3433
|
"displayName": "UIState<BP = any, DI = any, AMD =any, BPV = any>",
|
|
3434
3434
|
"typeParameters": [
|
|
3435
3435
|
"BP = any",
|
|
@@ -3447,7 +3447,7 @@
|
|
|
3447
3447
|
"indexKey": "",
|
|
3448
3448
|
"optional": false,
|
|
3449
3449
|
"description": "",
|
|
3450
|
-
"line":
|
|
3450
|
+
"line": 63,
|
|
3451
3451
|
"rawdescription": "\n"
|
|
3452
3452
|
},
|
|
3453
3453
|
{
|
|
@@ -3471,7 +3471,7 @@
|
|
|
3471
3471
|
"indexKey": "",
|
|
3472
3472
|
"optional": false,
|
|
3473
3473
|
"description": "",
|
|
3474
|
-
"line":
|
|
3474
|
+
"line": 67,
|
|
3475
3475
|
"rawdescription": "\n"
|
|
3476
3476
|
},
|
|
3477
3477
|
{
|
|
@@ -3519,7 +3519,7 @@
|
|
|
3519
3519
|
"indexKey": "",
|
|
3520
3520
|
"optional": true,
|
|
3521
3521
|
"description": "",
|
|
3522
|
-
"line":
|
|
3522
|
+
"line": 46,
|
|
3523
3523
|
"rawdescription": "\n"
|
|
3524
3524
|
},
|
|
3525
3525
|
{
|
|
@@ -3531,7 +3531,7 @@
|
|
|
3531
3531
|
"indexKey": "",
|
|
3532
3532
|
"optional": true,
|
|
3533
3533
|
"description": "",
|
|
3534
|
-
"line":
|
|
3534
|
+
"line": 48,
|
|
3535
3535
|
"rawdescription": "\n"
|
|
3536
3536
|
},
|
|
3537
3537
|
{
|
|
@@ -3543,7 +3543,7 @@
|
|
|
3543
3543
|
"indexKey": "",
|
|
3544
3544
|
"optional": true,
|
|
3545
3545
|
"description": "",
|
|
3546
|
-
"line":
|
|
3546
|
+
"line": 49,
|
|
3547
3547
|
"rawdescription": "\n"
|
|
3548
3548
|
},
|
|
3549
3549
|
{
|
|
@@ -3555,7 +3555,7 @@
|
|
|
3555
3555
|
"indexKey": "",
|
|
3556
3556
|
"optional": true,
|
|
3557
3557
|
"description": "",
|
|
3558
|
-
"line":
|
|
3558
|
+
"line": 54,
|
|
3559
3559
|
"rawdescription": "\n"
|
|
3560
3560
|
},
|
|
3561
3561
|
{
|
|
@@ -3567,7 +3567,7 @@
|
|
|
3567
3567
|
"indexKey": "",
|
|
3568
3568
|
"optional": false,
|
|
3569
3569
|
"description": "",
|
|
3570
|
-
"line":
|
|
3570
|
+
"line": 60,
|
|
3571
3571
|
"rawdescription": "\n"
|
|
3572
3572
|
},
|
|
3573
3573
|
{
|
|
@@ -3579,7 +3579,7 @@
|
|
|
3579
3579
|
"indexKey": "",
|
|
3580
3580
|
"optional": true,
|
|
3581
3581
|
"description": "",
|
|
3582
|
-
"line":
|
|
3582
|
+
"line": 35,
|
|
3583
3583
|
"rawdescription": "\n"
|
|
3584
3584
|
},
|
|
3585
3585
|
{
|
|
@@ -3591,7 +3591,19 @@
|
|
|
3591
3591
|
"indexKey": "",
|
|
3592
3592
|
"optional": true,
|
|
3593
3593
|
"description": "",
|
|
3594
|
-
"line":
|
|
3594
|
+
"line": 28,
|
|
3595
|
+
"rawdescription": "\n"
|
|
3596
|
+
},
|
|
3597
|
+
{
|
|
3598
|
+
"name": "hasFixedPosition",
|
|
3599
|
+
"coverageIgnore": false,
|
|
3600
|
+
"deprecated": false,
|
|
3601
|
+
"deprecationMessage": "",
|
|
3602
|
+
"type": "boolean",
|
|
3603
|
+
"indexKey": "",
|
|
3604
|
+
"optional": true,
|
|
3605
|
+
"description": "",
|
|
3606
|
+
"line": 25,
|
|
3595
3607
|
"rawdescription": "\n"
|
|
3596
3608
|
},
|
|
3597
3609
|
{
|
|
@@ -3603,7 +3615,7 @@
|
|
|
3603
3615
|
"indexKey": "",
|
|
3604
3616
|
"optional": true,
|
|
3605
3617
|
"description": "",
|
|
3606
|
-
"line":
|
|
3618
|
+
"line": 29,
|
|
3607
3619
|
"rawdescription": "\n"
|
|
3608
3620
|
},
|
|
3609
3621
|
{
|
|
@@ -3615,7 +3627,7 @@
|
|
|
3615
3627
|
"indexKey": "",
|
|
3616
3628
|
"optional": true,
|
|
3617
3629
|
"description": "",
|
|
3618
|
-
"line":
|
|
3630
|
+
"line": 31,
|
|
3619
3631
|
"rawdescription": "\n"
|
|
3620
3632
|
},
|
|
3621
3633
|
{
|
|
@@ -3627,7 +3639,7 @@
|
|
|
3627
3639
|
"indexKey": "",
|
|
3628
3640
|
"optional": true,
|
|
3629
3641
|
"description": "",
|
|
3630
|
-
"line":
|
|
3642
|
+
"line": 30,
|
|
3631
3643
|
"rawdescription": "\n"
|
|
3632
3644
|
},
|
|
3633
3645
|
{
|
|
@@ -3639,7 +3651,7 @@
|
|
|
3639
3651
|
"indexKey": "",
|
|
3640
3652
|
"optional": true,
|
|
3641
3653
|
"description": "",
|
|
3642
|
-
"line":
|
|
3654
|
+
"line": 70,
|
|
3643
3655
|
"rawdescription": "\n"
|
|
3644
3656
|
},
|
|
3645
3657
|
{
|
|
@@ -3651,7 +3663,7 @@
|
|
|
3651
3663
|
"indexKey": "",
|
|
3652
3664
|
"optional": true,
|
|
3653
3665
|
"description": "",
|
|
3654
|
-
"line":
|
|
3666
|
+
"line": 26,
|
|
3655
3667
|
"rawdescription": "\n"
|
|
3656
3668
|
},
|
|
3657
3669
|
{
|
|
@@ -3663,7 +3675,7 @@
|
|
|
3663
3675
|
"indexKey": "",
|
|
3664
3676
|
"optional": true,
|
|
3665
3677
|
"description": "",
|
|
3666
|
-
"line":
|
|
3678
|
+
"line": 38,
|
|
3667
3679
|
"rawdescription": "\n"
|
|
3668
3680
|
},
|
|
3669
3681
|
{
|
|
@@ -3675,7 +3687,7 @@
|
|
|
3675
3687
|
"indexKey": "",
|
|
3676
3688
|
"optional": true,
|
|
3677
3689
|
"description": "",
|
|
3678
|
-
"line":
|
|
3690
|
+
"line": 27,
|
|
3679
3691
|
"rawdescription": "\n"
|
|
3680
3692
|
},
|
|
3681
3693
|
{
|
|
@@ -3687,7 +3699,7 @@
|
|
|
3687
3699
|
"indexKey": "",
|
|
3688
3700
|
"optional": true,
|
|
3689
3701
|
"description": "",
|
|
3690
|
-
"line":
|
|
3702
|
+
"line": 32,
|
|
3691
3703
|
"rawdescription": "\n"
|
|
3692
3704
|
},
|
|
3693
3705
|
{
|
|
@@ -3699,7 +3711,7 @@
|
|
|
3699
3711
|
"indexKey": "",
|
|
3700
3712
|
"optional": true,
|
|
3701
3713
|
"description": "",
|
|
3702
|
-
"line":
|
|
3714
|
+
"line": 33,
|
|
3703
3715
|
"rawdescription": "\n"
|
|
3704
3716
|
},
|
|
3705
3717
|
{
|
|
@@ -3711,7 +3723,7 @@
|
|
|
3711
3723
|
"indexKey": "",
|
|
3712
3724
|
"optional": true,
|
|
3713
3725
|
"description": "",
|
|
3714
|
-
"line":
|
|
3726
|
+
"line": 34,
|
|
3715
3727
|
"rawdescription": "\n"
|
|
3716
3728
|
},
|
|
3717
3729
|
{
|
|
@@ -3723,7 +3735,7 @@
|
|
|
3723
3735
|
"indexKey": "",
|
|
3724
3736
|
"optional": true,
|
|
3725
3737
|
"description": "",
|
|
3726
|
-
"line":
|
|
3738
|
+
"line": 39,
|
|
3727
3739
|
"rawdescription": "\n"
|
|
3728
3740
|
},
|
|
3729
3741
|
{
|
|
@@ -3735,7 +3747,7 @@
|
|
|
3735
3747
|
"indexKey": "",
|
|
3736
3748
|
"optional": true,
|
|
3737
3749
|
"description": "",
|
|
3738
|
-
"line":
|
|
3750
|
+
"line": 57,
|
|
3739
3751
|
"rawdescription": "\n"
|
|
3740
3752
|
},
|
|
3741
3753
|
{
|
|
@@ -3747,7 +3759,7 @@
|
|
|
3747
3759
|
"indexKey": "",
|
|
3748
3760
|
"optional": true,
|
|
3749
3761
|
"description": "",
|
|
3750
|
-
"line":
|
|
3762
|
+
"line": 71,
|
|
3751
3763
|
"rawdescription": "\n"
|
|
3752
3764
|
},
|
|
3753
3765
|
{
|
|
@@ -3771,7 +3783,7 @@
|
|
|
3771
3783
|
"indexKey": "",
|
|
3772
3784
|
"optional": true,
|
|
3773
3785
|
"description": "",
|
|
3774
|
-
"line":
|
|
3786
|
+
"line": 37,
|
|
3775
3787
|
"rawdescription": "\n"
|
|
3776
3788
|
},
|
|
3777
3789
|
{
|
|
@@ -3783,7 +3795,7 @@
|
|
|
3783
3795
|
"indexKey": "",
|
|
3784
3796
|
"optional": true,
|
|
3785
3797
|
"description": "",
|
|
3786
|
-
"line":
|
|
3798
|
+
"line": 36,
|
|
3787
3799
|
"rawdescription": "\n"
|
|
3788
3800
|
},
|
|
3789
3801
|
{
|
|
@@ -3807,7 +3819,7 @@
|
|
|
3807
3819
|
"indexKey": "",
|
|
3808
3820
|
"optional": false,
|
|
3809
3821
|
"description": "",
|
|
3810
|
-
"line":
|
|
3822
|
+
"line": 64,
|
|
3811
3823
|
"rawdescription": "\n"
|
|
3812
3824
|
},
|
|
3813
3825
|
{
|
|
@@ -3819,7 +3831,7 @@
|
|
|
3819
3831
|
"indexKey": "",
|
|
3820
3832
|
"optional": true,
|
|
3821
3833
|
"description": "",
|
|
3822
|
-
"line":
|
|
3834
|
+
"line": 44,
|
|
3823
3835
|
"rawdescription": "\n"
|
|
3824
3836
|
},
|
|
3825
3837
|
{
|
|
@@ -3831,7 +3843,7 @@
|
|
|
3831
3843
|
"indexKey": "",
|
|
3832
3844
|
"optional": true,
|
|
3833
3845
|
"description": "",
|
|
3834
|
-
"line":
|
|
3846
|
+
"line": 52,
|
|
3835
3847
|
"rawdescription": "\n"
|
|
3836
3848
|
},
|
|
3837
3849
|
{
|
|
@@ -3843,7 +3855,7 @@
|
|
|
3843
3855
|
"indexKey": "",
|
|
3844
3856
|
"optional": true,
|
|
3845
3857
|
"description": "",
|
|
3846
|
-
"line":
|
|
3858
|
+
"line": 45,
|
|
3847
3859
|
"rawdescription": "\n"
|
|
3848
3860
|
},
|
|
3849
3861
|
{
|
|
@@ -3855,7 +3867,7 @@
|
|
|
3855
3867
|
"indexKey": "",
|
|
3856
3868
|
"optional": true,
|
|
3857
3869
|
"description": "",
|
|
3858
|
-
"line":
|
|
3870
|
+
"line": 53,
|
|
3859
3871
|
"rawdescription": "\n"
|
|
3860
3872
|
},
|
|
3861
3873
|
{
|
|
@@ -3867,7 +3879,7 @@
|
|
|
3867
3879
|
"indexKey": "",
|
|
3868
3880
|
"optional": true,
|
|
3869
3881
|
"description": "",
|
|
3870
|
-
"line":
|
|
3882
|
+
"line": 43,
|
|
3871
3883
|
"rawdescription": "\n"
|
|
3872
3884
|
},
|
|
3873
3885
|
{
|
|
@@ -3879,7 +3891,7 @@
|
|
|
3879
3891
|
"indexKey": "",
|
|
3880
3892
|
"optional": true,
|
|
3881
3893
|
"description": "",
|
|
3882
|
-
"line":
|
|
3894
|
+
"line": 42,
|
|
3883
3895
|
"rawdescription": "\n"
|
|
3884
3896
|
},
|
|
3885
3897
|
{
|
|
@@ -3891,7 +3903,7 @@
|
|
|
3891
3903
|
"indexKey": "",
|
|
3892
3904
|
"optional": true,
|
|
3893
3905
|
"description": "",
|
|
3894
|
-
"line":
|
|
3906
|
+
"line": 47,
|
|
3895
3907
|
"rawdescription": "\n"
|
|
3896
3908
|
}
|
|
3897
3909
|
],
|
|
@@ -4873,7 +4885,7 @@
|
|
|
4873
4885
|
},
|
|
4874
4886
|
{
|
|
4875
4887
|
"name": "EuiAppShellService",
|
|
4876
|
-
"id": "injectable-EuiAppShellService-
|
|
4888
|
+
"id": "injectable-EuiAppShellService-2b10e519e4a4b60702c2f5da03d8ea5dc23dbec19cc7d660553b4aac90c5bdcd38a9eee6e4f6c9e5e9f468f5f00d106dcd82a7d9667028ef3f85483af3b8ffee",
|
|
4877
4889
|
"file": "packages/core/src/lib/services/eui-app-shell.service.ts",
|
|
4878
4890
|
"coverageIgnore": false,
|
|
4879
4891
|
"properties": [
|
|
@@ -4887,7 +4899,7 @@
|
|
|
4887
4899
|
"indexKey": "",
|
|
4888
4900
|
"optional": false,
|
|
4889
4901
|
"description": "",
|
|
4890
|
-
"line":
|
|
4902
|
+
"line": 134,
|
|
4891
4903
|
"rawdescription": "\n",
|
|
4892
4904
|
"modifierKind": [
|
|
4893
4905
|
124
|
|
@@ -4902,7 +4914,7 @@
|
|
|
4902
4914
|
"indexKey": "",
|
|
4903
4915
|
"optional": false,
|
|
4904
4916
|
"description": "",
|
|
4905
|
-
"line":
|
|
4917
|
+
"line": 133,
|
|
4906
4918
|
"rawdescription": "\n"
|
|
4907
4919
|
},
|
|
4908
4920
|
{
|
|
@@ -4914,7 +4926,7 @@
|
|
|
4914
4926
|
"indexKey": "",
|
|
4915
4927
|
"optional": false,
|
|
4916
4928
|
"description": "",
|
|
4917
|
-
"line":
|
|
4929
|
+
"line": 132,
|
|
4918
4930
|
"rawdescription": "\n"
|
|
4919
4931
|
}
|
|
4920
4932
|
],
|
|
@@ -4926,7 +4938,7 @@
|
|
|
4926
4938
|
"optional": false,
|
|
4927
4939
|
"returnType": "void",
|
|
4928
4940
|
"typeParameters": [],
|
|
4929
|
-
"line":
|
|
4941
|
+
"line": 401,
|
|
4930
4942
|
"deprecated": false,
|
|
4931
4943
|
"deprecationMessage": "",
|
|
4932
4944
|
"rawdescription": "\n",
|
|
@@ -4942,7 +4954,7 @@
|
|
|
4942
4954
|
"optional": false,
|
|
4943
4955
|
"returnType": "void",
|
|
4944
4956
|
"typeParameters": [],
|
|
4945
|
-
"line":
|
|
4957
|
+
"line": 393,
|
|
4946
4958
|
"deprecated": false,
|
|
4947
4959
|
"deprecationMessage": "",
|
|
4948
4960
|
"rawdescription": "\n",
|
|
@@ -4958,7 +4970,7 @@
|
|
|
4958
4970
|
"optional": false,
|
|
4959
4971
|
"returnType": "void",
|
|
4960
4972
|
"typeParameters": [],
|
|
4961
|
-
"line":
|
|
4973
|
+
"line": 356,
|
|
4962
4974
|
"deprecated": false,
|
|
4963
4975
|
"deprecationMessage": "",
|
|
4964
4976
|
"rawdescription": "\n",
|
|
@@ -4974,7 +4986,7 @@
|
|
|
4974
4986
|
"optional": false,
|
|
4975
4987
|
"returnType": "void",
|
|
4976
4988
|
"typeParameters": [],
|
|
4977
|
-
"line":
|
|
4989
|
+
"line": 389,
|
|
4978
4990
|
"deprecated": false,
|
|
4979
4991
|
"deprecationMessage": "",
|
|
4980
4992
|
"rawdescription": "\n",
|
|
@@ -4990,7 +5002,7 @@
|
|
|
4990
5002
|
"optional": false,
|
|
4991
5003
|
"returnType": "void",
|
|
4992
5004
|
"typeParameters": [],
|
|
4993
|
-
"line":
|
|
5005
|
+
"line": 385,
|
|
4994
5006
|
"deprecated": false,
|
|
4995
5007
|
"deprecationMessage": "",
|
|
4996
5008
|
"rawdescription": "\n",
|
|
@@ -5006,7 +5018,7 @@
|
|
|
5006
5018
|
"optional": false,
|
|
5007
5019
|
"returnType": "void",
|
|
5008
5020
|
"typeParameters": [],
|
|
5009
|
-
"line":
|
|
5021
|
+
"line": 367,
|
|
5010
5022
|
"deprecated": false,
|
|
5011
5023
|
"deprecationMessage": "",
|
|
5012
5024
|
"rawdescription": "\n",
|
|
@@ -5022,7 +5034,7 @@
|
|
|
5022
5034
|
"optional": false,
|
|
5023
5035
|
"returnType": "void",
|
|
5024
5036
|
"typeParameters": [],
|
|
5025
|
-
"line":
|
|
5037
|
+
"line": 417,
|
|
5026
5038
|
"deprecated": false,
|
|
5027
5039
|
"deprecationMessage": "",
|
|
5028
5040
|
"rawdescription": "\n",
|
|
@@ -5038,7 +5050,7 @@
|
|
|
5038
5050
|
"optional": false,
|
|
5039
5051
|
"returnType": "void",
|
|
5040
5052
|
"typeParameters": [],
|
|
5041
|
-
"line":
|
|
5053
|
+
"line": 425,
|
|
5042
5054
|
"deprecated": false,
|
|
5043
5055
|
"deprecationMessage": "",
|
|
5044
5056
|
"rawdescription": "\n",
|
|
@@ -5054,7 +5066,7 @@
|
|
|
5054
5066
|
"optional": false,
|
|
5055
5067
|
"returnType": "void",
|
|
5056
5068
|
"typeParameters": [],
|
|
5057
|
-
"line":
|
|
5069
|
+
"line": 433,
|
|
5058
5070
|
"deprecated": false,
|
|
5059
5071
|
"deprecationMessage": "",
|
|
5060
5072
|
"rawdescription": "\n",
|
|
@@ -5079,7 +5091,7 @@
|
|
|
5079
5091
|
"optional": false,
|
|
5080
5092
|
"returnType": "void",
|
|
5081
5093
|
"typeParameters": [],
|
|
5082
|
-
"line":
|
|
5094
|
+
"line": 409,
|
|
5083
5095
|
"deprecated": false,
|
|
5084
5096
|
"deprecationMessage": "",
|
|
5085
5097
|
"rawdescription": "\n",
|
|
@@ -5108,7 +5120,7 @@
|
|
|
5108
5120
|
"optional": false,
|
|
5109
5121
|
"returnType": "void",
|
|
5110
5122
|
"typeParameters": [],
|
|
5111
|
-
"line":
|
|
5123
|
+
"line": 376,
|
|
5112
5124
|
"deprecated": false,
|
|
5113
5125
|
"deprecationMessage": "",
|
|
5114
5126
|
"rawdescription": "\n",
|
|
@@ -5124,7 +5136,7 @@
|
|
|
5124
5136
|
"optional": false,
|
|
5125
5137
|
"returnType": "void",
|
|
5126
5138
|
"typeParameters": [],
|
|
5127
|
-
"line":
|
|
5139
|
+
"line": 327,
|
|
5128
5140
|
"deprecated": false,
|
|
5129
5141
|
"deprecationMessage": "",
|
|
5130
5142
|
"rawdescription": "\n",
|
|
@@ -5150,7 +5162,7 @@
|
|
|
5150
5162
|
"optional": false,
|
|
5151
5163
|
"returnType": "void",
|
|
5152
5164
|
"typeParameters": [],
|
|
5153
|
-
"line":
|
|
5165
|
+
"line": 347,
|
|
5154
5166
|
"deprecated": false,
|
|
5155
5167
|
"deprecationMessage": "",
|
|
5156
5168
|
"rawdescription": "\n",
|
|
@@ -5180,7 +5192,7 @@
|
|
|
5180
5192
|
"optional": false,
|
|
5181
5193
|
"returnType": "string",
|
|
5182
5194
|
"typeParameters": [],
|
|
5183
|
-
"line":
|
|
5195
|
+
"line": 443,
|
|
5184
5196
|
"deprecated": false,
|
|
5185
5197
|
"deprecationMessage": "",
|
|
5186
5198
|
"rawdescription": "\n\nReturns the current value of --eui-f-size-base CSS variable\n",
|
|
@@ -5207,7 +5219,7 @@
|
|
|
5207
5219
|
"typeParameters": [
|
|
5208
5220
|
"T"
|
|
5209
5221
|
],
|
|
5210
|
-
"line":
|
|
5222
|
+
"line": 309,
|
|
5211
5223
|
"deprecated": false,
|
|
5212
5224
|
"deprecationMessage": "",
|
|
5213
5225
|
"rawdescription": "\n\nEmits a slice from the state whether that changes\n\n",
|
|
@@ -5215,8 +5227,8 @@
|
|
|
5215
5227
|
"jsdoctags": [
|
|
5216
5228
|
{
|
|
5217
5229
|
"name": {
|
|
5218
|
-
"pos":
|
|
5219
|
-
"end":
|
|
5230
|
+
"pos": 8984,
|
|
5231
|
+
"end": 8987,
|
|
5220
5232
|
"kind": 80,
|
|
5221
5233
|
"id": 0,
|
|
5222
5234
|
"flags": 16842752,
|
|
@@ -5229,8 +5241,8 @@
|
|
|
5229
5241
|
"deprecated": false,
|
|
5230
5242
|
"deprecationMessage": "",
|
|
5231
5243
|
"tagName": {
|
|
5232
|
-
"pos":
|
|
5233
|
-
"end":
|
|
5244
|
+
"pos": 8978,
|
|
5245
|
+
"end": 8983,
|
|
5234
5246
|
"kind": 80,
|
|
5235
5247
|
"id": 0,
|
|
5236
5248
|
"flags": 16842752,
|
|
@@ -5257,7 +5269,7 @@
|
|
|
5257
5269
|
"optional": false,
|
|
5258
5270
|
"returnType": "void",
|
|
5259
5271
|
"typeParameters": [],
|
|
5260
|
-
"line":
|
|
5272
|
+
"line": 450,
|
|
5261
5273
|
"deprecated": false,
|
|
5262
5274
|
"deprecationMessage": "",
|
|
5263
5275
|
"rawdescription": "\n\nUpdates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n",
|
|
@@ -5295,7 +5307,7 @@
|
|
|
5295
5307
|
"optional": false,
|
|
5296
5308
|
"returnType": "void",
|
|
5297
5309
|
"typeParameters": [],
|
|
5298
|
-
"line":
|
|
5310
|
+
"line": 336,
|
|
5299
5311
|
"deprecated": false,
|
|
5300
5312
|
"deprecationMessage": "",
|
|
5301
5313
|
"rawdescription": "\n",
|
|
@@ -5342,7 +5354,7 @@
|
|
|
5342
5354
|
"optional": false,
|
|
5343
5355
|
"returnType": "void",
|
|
5344
5356
|
"typeParameters": [],
|
|
5345
|
-
"line":
|
|
5357
|
+
"line": 256,
|
|
5346
5358
|
"deprecated": false,
|
|
5347
5359
|
"deprecationMessage": "",
|
|
5348
5360
|
"rawdescription": "\n",
|
|
@@ -5380,7 +5392,7 @@
|
|
|
5380
5392
|
"optional": false,
|
|
5381
5393
|
"returnType": "void",
|
|
5382
5394
|
"typeParameters": [],
|
|
5383
|
-
"line":
|
|
5395
|
+
"line": 322,
|
|
5384
5396
|
"deprecated": false,
|
|
5385
5397
|
"deprecationMessage": "",
|
|
5386
5398
|
"rawdescription": "\n",
|
|
@@ -5394,14 +5406,14 @@
|
|
|
5394
5406
|
"deprecationMessage": "",
|
|
5395
5407
|
"description": "",
|
|
5396
5408
|
"rawdescription": "\n",
|
|
5397
|
-
"sourceCode": "import { Injectable, PLATFORM_ID, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { BehaviorSubject, defer, firstValueFrom, Observable } from 'rxjs';\nimport { EuiEuLanguages, GlobalConfig, getActiveLang, EuiLanguage, EuiMenuItem } from '@eui/base';\nimport { GLOBAL_CONFIG_TOKEN } from './config/tokens';\nimport { I18nService } from './i18n';\nimport { Router, NavigationEnd } from '@angular/router';\nimport { StoreService } from './store/store.service';\nimport { distinctUntilChanged, filter, map } from 'rxjs/operators';\nimport { isEqual, get } from 'lodash-es';\nimport { CssUtils } from '../helpers/css-utils';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface UIState<BP = any, DI = any, AMD =any, BPV = any> {\n // app state\n appName?: string;\n appShortName?: string;\n appSubTitle?: string;\n appBaseFontSize?: string;\n\n // Sidebar state\n isSidebarOpen?: boolean;\n isSidebarActive?: boolean;\n hasSidebar?: boolean;\n hasSideContainer?: boolean;\n hasBreadcrumb?: boolean;\n hasHeader?: boolean;\n hasHeaderLogo?: boolean;\n hasHeaderEnvironment?: boolean;\n hasToolbar?: boolean;\n hasToolbarMegaMenu?: boolean;\n hasToolbarMenu?: boolean;\n environmentValue?: string;\n isSidebarHidden?: boolean;\n isSidebarFocused?: boolean;\n hasSidebarCollapsedVariant?: boolean;\n hasTopMessage?: boolean;\n\n // window state\n windowWidth?: number;\n windowHeight?: number;\n mainContentHeight?: number;\n pageHeaderHeight?: number;\n breakpoint?: string;\n wrapperClasses?: string;\n breakpoints?: BP;\n breakpointValues?: BPV;\n\n // navigation state\n menuLinks?: EuiMenuItem[];\n sidebarLinks?: EuiMenuItem[];\n combinedLinks?: EuiMenuItem[];\n\n // other states\n isBlockDocumentActive?: boolean;\n\n // device info\n deviceInfo: DI;\n\n // language infos\n activeLanguage: string;\n languages: (string | EuiLanguage)[];\n\n // app metadata\n appMetadata: AMD;\n\n // various dynamic state\n hasModalActive?: boolean;\n isDimmerActive?: boolean; // Usage: map to eui base directive input coerce euiHighlighted\n}\n\nconst initialState: UIState = {\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EuiAppShellService {\n navigationStartCustomHandler: () => void;\n navigationEndCustomHandler: () => void;\n protected config = inject<GlobalConfig>(GLOBAL_CONFIG_TOKEN, { optional: true });\n private http = inject(HttpClient);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n private router = inject(Router);\n private storeService = inject(StoreService);\n private i18nService = inject(I18nService, { optional: true });\n\n // -------------------\n get state$(): Observable<UIState> {\n return this._state$.asObservable();\n }\n\n // -------------------\n // exposed observables\n\n get breakpoint$(): Observable<string> {\n return this._breakpoint$.asObservable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get breakpoints$(): Observable<any> {\n return this._breakpoints$.asObservable();\n }\n\n // ----------------\n // state operations\n // ----------------\n get state(): UIState {\n return this._state$.getValue();\n }\n\n // ----------------------------\n // public setters and functions\n // ----------------------------\n set isSidebarOpen(isOpen: boolean) {\n this.setState({\n ...this.state,\n isSidebarOpen: isOpen,\n });\n }\n\n get isSidebarOpen(): boolean {\n return this.state.isSidebarOpen;\n }\n\n set isSidebarActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isSidebarActive: isActive,\n });\n }\n\n set sidebarLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n sidebarLinks: links,\n });\n }\n\n set hasSidebarCollapsedVariant(isActive: boolean) {\n this.setState({\n ...this.state,\n hasSidebarCollapsedVariant: isActive,\n });\n CssUtils.activateSidebarCssVars(this.document, this.platformId, isActive);\n }\n\n set menuLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n menuLinks: links,\n });\n }\n\n set isBlockDocumentActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isBlockDocumentActive: isActive,\n });\n }\n\n get hasHeader(): boolean {\n return this.state.hasHeader;\n }\n\n // Edit mode\n get isDimmerActive(): boolean {\n return this.state.isDimmerActive;\n }\n\n set isDimmerActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isDimmerActive: isActive,\n });\n }\n\n private _state$: BehaviorSubject<UIState>;\n private _breakpoint$: BehaviorSubject<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _breakpoints$: BehaviorSubject<any>;\n\n constructor() {\n const config = this.config;\n\n let stateWithConfig = initialState;\n const languages = config?.i18n?.i18nService?.languages || initialState.languages;\n const defaultLanguage = config?.i18n?.i18nService?.defaultLanguage || initialState.activeLanguage;\n stateWithConfig = {\n ...stateWithConfig,\n ...{\n languages,\n activeLanguage: defaultLanguage,\n },\n };\n this._state$ = new BehaviorSubject(stateWithConfig);\n this._breakpoint$ = new BehaviorSubject('');\n this._breakpoints$ = new BehaviorSubject({});\n this.bindActiveLanguageToAppShellState();\n }\n\n setState(nextState: UIState, updateI18 = true): void {\n let breakpoint, breakpoints;\n let combinedLinks;\n\n const state = this.state;\n\n // check if window width has been updated from previous state\n if (this.state.windowWidth !== nextState.windowWidth) {\n breakpoint = this.getBreakpoint(nextState.windowWidth);\n breakpoints = this.getBreakpoints(breakpoint);\n\n this._breakpoint$.next(breakpoint);\n this._breakpoints$.next(breakpoints);\n\n // if not propagate the old ones without doing any calculations\n } else {\n breakpoint = state.breakpoint;\n breakpoints = state.breakpoints;\n }\n\n // finally get the wrapper classes when both the state and breakpoint are known\n const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);\n\n // check if the menuLinks or sidebarLinks have changed from previous state\n if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) {\n combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];\n } else {\n combinedLinks = this.state.combinedLinks;\n }\n\n const stateBeforeUpdate = { ...this.state };\n\n // we put it all together with the calculated properties\n this._state$.next({\n ...nextState,\n wrapperClasses,\n breakpoint,\n breakpoints,\n combinedLinks,\n });\n\n // update the Store Language\n if (updateI18 && nextState.activeLanguage !== stateBeforeUpdate.activeLanguage) {\n this.i18nService.updateState({ activeLang: nextState.activeLanguage });\n }\n }\n\n /**\n * Emits a slice from the state whether that changes\n *\n * @param key can be 'key' or 'key.sub.sub'\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getState<T = any>(key?: string): Observable<T> {\n return defer(() =>\n // check if key exists\n key\n ? this.state$.pipe(\n map((state) => get(state, key)),\n // filter((state) => state),\n distinctUntilChanged((x, y) => isEqual(x, y)),\n )\n : this.state$,\n );\n }\n\n public sidebarToggle(): void {\n this.isSidebarOpen = !this.state.isSidebarOpen;\n }\n\n // Edit mode\n public dimmerActiveToggle(): void {\n const isActive = this.isDimmerActive;\n this.setState({\n ...this.state,\n isDimmerActive: !isActive,\n });\n CssUtils.activateEditModeCssVars(!isActive, this.document);\n }\n\n public setDimmerActiveState(activeState: boolean): void {\n this.setState({\n ...this.state,\n isDimmerActive: activeState,\n });\n CssUtils.activateEditModeCssVars(activeState, this.document);\n }\n\n // --------------\n // public methods\n // --------------\n public fetchAppMetadata(metadataFilePath = 'assets/app-metadata.json'): void {\n this.getJson(metadataFilePath).then((data) => {\n this.setState({\n ...this.state,\n appMetadata: data,\n });\n });\n }\n\n public activateSidebar(): void {\n this.setState({\n ...this.state,\n hasSidebar: true,\n });\n\n if (!this.state.isSidebarHidden) {\n CssUtils.activateSidebarCssVars(this.document, this.platformId, this.state.hasSidebarCollapsedVariant);\n }\n }\n\n public activateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: true,\n });\n\n CssUtils.activateSideContainerCssVars(this.document, this.platformId);\n } \n\n public deactivateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: false,\n });\n\n CssUtils.deactivateSideContainerCssVars(this.document, this.platformId);\n } \n\n public activateSidebarHeader(): void {\n CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);\n }\n\n public activateSidebarFooter(): void {\n CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);\n }\n\n public activateHeader(): void {\n this.setState({\n ...this.state,\n hasHeader: true,\n });\n CssUtils.activateHeaderCssVars(this.document, this.platformId);\n }\n\n public activateBreadcrumb(): void {\n this.setState({\n ...this.state,\n hasBreadcrumb: true,\n });\n CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);\n }\n\n public activateTopMessage(height: number): void {\n this.setState({\n ...this.state,\n hasTopMessage: true,\n });\n CssUtils.activateTopMessageCssVars(height, this.document);\n }\n\n public activateToolbar(): void {\n this.setState({\n ...this.state,\n hasToolbar: true,\n });\n CssUtils.activateToolbarCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMegaMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMegaMenu: true,\n });\n CssUtils.activateToolbarMegaMenuCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMenu: true,\n });\n }\n\n /**\n * Returns the current value of --eui-f-size-base CSS variable\n */\n public getBaseFontSize(): string {\n return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);\n }\n\n /**\n * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n */\n public setBaseFontSize(newsize: string): void {\n this.setState(\n {\n ...this.state,\n appBaseFontSize: newsize,\n },\n false,\n );\n CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);\n }\n\n // ---------------\n // private getters\n // ---------------\n private getWrapperClasses(state: UIState, breakpoint: string): string {\n const classes: string[] = [];\n\n classes.push(breakpoint);\n\n if (state.hasSidebar) {\n if (state.isSidebarHidden) {\n classes.push('sidebar--hidden');\n }\n if (state.isSidebarOpen) {\n classes.push('sidebar--open');\n } else {\n classes.push('sidebar--close');\n }\n }\n if (state.deviceInfo?.isFF) {\n classes.push('ff');\n }\n if (state.deviceInfo?.isIE) {\n classes.push('ie');\n }\n if (state.deviceInfo?.isChrome) {\n classes.push('chrome');\n }\n return classes.join(' ');\n }\n\n private getBreakpoint(windowWidth: number): string {\n let bkp = '';\n\n if (this.state.breakpointValues.length === 0) {\n this.setState({\n ...this.state,\n breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),\n });\n }\n\n this.state.breakpointValues.forEach((b, i) => {\n if (i < this.state.breakpointValues.length) {\n if (windowWidth >= b.value && windowWidth < this.state.breakpointValues[i+1]?.value) {\n bkp = b.bkp;\n }\n } else if(windowWidth >= b.value) {\n bkp = b.bkp;\n }\n });\n\n return bkp;\n }\n\n private getBreakpoints(bkp: string): object {\n return {\n isMobile: bkp === 'xs' || bkp === 'sm',\n isTablet: bkp === 'md',\n isLtLargeTablet: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg',\n isLtDesktop: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg' || bkp === 'xl',\n isDesktop: bkp === 'xxl',\n isXL: bkp === 'xl',\n isXXL: bkp === 'xxl',\n isFHD: bkp === 'fhd',\n is2K: bkp === '2k',\n is4K: bkp === '4k',\n };\n }\n\n private getJson(url: string): Promise<object> {\n return firstValueFrom(this.http.get(url)).then(this.extractData).catch(this.handleError);\n }\n\n private extractData(res: Response): object {\n const body = res;\n return body || {};\n }\n\n private handleError<T extends Error>(error: T): Promise<T> {\n console.error('An error occurred', error);\n return Promise.reject(error.message || error);\n }\n\n private bindActiveLanguageToAppShellState(): void {\n this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {\n if (activeLang !== this.state.activeLanguage) {\n this.setState(\n {\n ...this.state,\n activeLanguage: activeLang,\n },\n false,\n );\n }\n });\n }\n}\n",
|
|
5409
|
+
"sourceCode": "import { Injectable, PLATFORM_ID, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { BehaviorSubject, defer, firstValueFrom, Observable } from 'rxjs';\nimport { EuiEuLanguages, GlobalConfig, getActiveLang, EuiLanguage, EuiMenuItem } from '@eui/base';\nimport { GLOBAL_CONFIG_TOKEN } from './config/tokens';\nimport { I18nService } from './i18n';\nimport { Router, NavigationEnd } from '@angular/router';\nimport { StoreService } from './store/store.service';\nimport { distinctUntilChanged, filter, map } from 'rxjs/operators';\nimport { isEqual, get } from 'lodash-es';\nimport { CssUtils } from '../helpers/css-utils';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface UIState<BP = any, DI = any, AMD =any, BPV = any> {\n // app state\n appName?: string;\n appShortName?: string;\n appSubTitle?: string;\n appBaseFontSize?: string;\n\n // Sidebar state\n isSidebarOpen?: boolean;\n isSidebarActive?: boolean;\n hasFixedPosition?: boolean;\n hasSidebar?: boolean;\n hasSideContainer?: boolean;\n hasBreadcrumb?: boolean;\n hasHeader?: boolean;\n hasHeaderLogo?: boolean;\n hasHeaderEnvironment?: boolean;\n hasToolbar?: boolean;\n hasToolbarMegaMenu?: boolean;\n hasToolbarMenu?: boolean;\n environmentValue?: string;\n isSidebarHidden?: boolean;\n isSidebarFocused?: boolean;\n hasSidebarCollapsedVariant?: boolean;\n hasTopMessage?: boolean;\n\n // window state\n windowWidth?: number;\n windowHeight?: number;\n mainContentHeight?: number;\n pageHeaderHeight?: number;\n breakpoint?: string;\n wrapperClasses?: string;\n breakpoints?: BP;\n breakpointValues?: BPV;\n\n // navigation state\n menuLinks?: EuiMenuItem[];\n sidebarLinks?: EuiMenuItem[];\n combinedLinks?: EuiMenuItem[];\n\n // other states\n isBlockDocumentActive?: boolean;\n\n // device info\n deviceInfo: DI;\n\n // language infos\n activeLanguage: string;\n languages: (string | EuiLanguage)[];\n\n // app metadata\n appMetadata: AMD;\n\n // various dynamic state\n hasModalActive?: boolean;\n isDimmerActive?: boolean; // Usage: map to eui base directive input coerce euiHighlighted\n}\n\nconst initialState: UIState = {\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasFixedPosition: true,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class EuiAppShellService {\n navigationStartCustomHandler: () => void;\n navigationEndCustomHandler: () => void;\n protected config = inject<GlobalConfig>(GLOBAL_CONFIG_TOKEN, { optional: true });\n private http = inject(HttpClient);\n private platformId = inject(PLATFORM_ID);\n private document = inject<Document>(DOCUMENT);\n private router = inject(Router);\n private storeService = inject(StoreService);\n private i18nService = inject(I18nService, { optional: true });\n\n // -------------------\n get state$(): Observable<UIState> {\n return this._state$.asObservable();\n }\n\n // -------------------\n // exposed observables\n\n get breakpoint$(): Observable<string> {\n return this._breakpoint$.asObservable();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get breakpoints$(): Observable<any> {\n return this._breakpoints$.asObservable();\n }\n\n // ----------------\n // state operations\n // ----------------\n get state(): UIState {\n return this._state$.getValue();\n }\n\n // ----------------------------\n // public setters and functions\n // ----------------------------\n set isSidebarOpen(isOpen: boolean) {\n this.setState({\n ...this.state,\n isSidebarOpen: isOpen,\n });\n }\n\n get isSidebarOpen(): boolean {\n return this.state.isSidebarOpen;\n }\n\n set isSidebarActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isSidebarActive: isActive,\n });\n }\n\n set sidebarLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n sidebarLinks: links,\n });\n }\n\n set hasSidebarCollapsedVariant(isActive: boolean) {\n this.setState({\n ...this.state,\n hasSidebarCollapsedVariant: isActive,\n });\n CssUtils.activateSidebarCssVars(this.document, this.platformId, isActive);\n }\n\n set menuLinks(links: EuiMenuItem[]) {\n this.setState({\n ...this.state,\n menuLinks: links,\n });\n }\n\n set isBlockDocumentActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isBlockDocumentActive: isActive,\n });\n }\n\n get hasHeader(): boolean {\n return this.state.hasHeader;\n }\n\n // Edit mode\n get isDimmerActive(): boolean {\n return this.state.isDimmerActive;\n }\n\n set isDimmerActive(isActive: boolean) {\n this.setState({\n ...this.state,\n isDimmerActive: isActive,\n });\n }\n\n private _state$: BehaviorSubject<UIState>;\n private _breakpoint$: BehaviorSubject<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _breakpoints$: BehaviorSubject<any>;\n\n constructor() {\n const config = this.config;\n\n let stateWithConfig = initialState;\n const languages = config?.i18n?.i18nService?.languages || initialState.languages;\n const defaultLanguage = config?.i18n?.i18nService?.defaultLanguage || initialState.activeLanguage;\n stateWithConfig = {\n ...stateWithConfig,\n ...{\n languages,\n activeLanguage: defaultLanguage,\n },\n };\n this._state$ = new BehaviorSubject(stateWithConfig);\n this._breakpoint$ = new BehaviorSubject('');\n this._breakpoints$ = new BehaviorSubject({});\n this.bindActiveLanguageToAppShellState();\n }\n\n setState(nextState: UIState, updateI18 = true): void {\n let breakpoint, breakpoints;\n let combinedLinks;\n\n const state = this.state;\n\n // check if window width has been updated from previous state\n if (this.state.windowWidth !== nextState.windowWidth) {\n breakpoint = this.getBreakpoint(nextState.windowWidth);\n breakpoints = this.getBreakpoints(breakpoint);\n\n this._breakpoint$.next(breakpoint);\n this._breakpoints$.next(breakpoints);\n\n // if not propagate the old ones without doing any calculations\n } else {\n breakpoint = state.breakpoint;\n breakpoints = state.breakpoints;\n }\n\n // finally get the wrapper classes when both the state and breakpoint are known\n const wrapperClasses = this.getWrapperClasses(nextState, breakpoint);\n\n // check if the menuLinks or sidebarLinks have changed from previous state\n if (this.state.menuLinks !== nextState.menuLinks || this.state.sidebarLinks !== nextState.sidebarLinks) {\n combinedLinks = [...nextState.menuLinks, ...nextState.sidebarLinks];\n } else {\n combinedLinks = this.state.combinedLinks;\n }\n\n const stateBeforeUpdate = { ...this.state };\n\n // we put it all together with the calculated properties\n this._state$.next({\n ...nextState,\n wrapperClasses,\n breakpoint,\n breakpoints,\n combinedLinks,\n });\n\n // update the Store Language\n if (updateI18 && nextState.activeLanguage !== stateBeforeUpdate.activeLanguage) {\n this.i18nService.updateState({ activeLang: nextState.activeLanguage });\n }\n }\n\n /**\n * Emits a slice from the state whether that changes\n *\n * @param key can be 'key' or 'key.sub.sub'\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getState<T = any>(key?: string): Observable<T> {\n return defer(() =>\n // check if key exists\n key\n ? this.state$.pipe(\n map((state) => get(state, key)),\n // filter((state) => state),\n distinctUntilChanged((x, y) => isEqual(x, y)),\n )\n : this.state$,\n );\n }\n\n public sidebarToggle(): void {\n this.isSidebarOpen = !this.state.isSidebarOpen;\n }\n\n // Edit mode\n public dimmerActiveToggle(): void {\n const isActive = this.isDimmerActive;\n this.setState({\n ...this.state,\n isDimmerActive: !isActive,\n });\n CssUtils.activateEditModeCssVars(!isActive, this.document);\n }\n\n public setDimmerActiveState(activeState: boolean): void {\n this.setState({\n ...this.state,\n isDimmerActive: activeState,\n });\n CssUtils.activateEditModeCssVars(activeState, this.document);\n }\n\n // --------------\n // public methods\n // --------------\n public fetchAppMetadata(metadataFilePath = 'assets/app-metadata.json'): void {\n this.getJson(metadataFilePath).then((data) => {\n this.setState({\n ...this.state,\n appMetadata: data,\n });\n });\n }\n\n public activateSidebar(): void {\n this.setState({\n ...this.state,\n hasSidebar: true,\n });\n\n if (!this.state.isSidebarHidden) {\n CssUtils.activateSidebarCssVars(this.document, this.platformId, this.state.hasSidebarCollapsedVariant);\n }\n }\n\n public activateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: true,\n });\n\n CssUtils.activateSideContainerCssVars(this.document, this.platformId);\n } \n\n public deactivateSideContainer(): void {\n this.setState({\n ...this.state,\n hasSideContainer: false,\n });\n\n CssUtils.deactivateSideContainerCssVars(this.document, this.platformId);\n } \n\n public activateSidebarHeader(): void {\n CssUtils.activateSidebarHeaderCssVars(this.document, this.platformId);\n }\n\n public activateSidebarFooter(): void {\n CssUtils.activateSidebarFooterCssVars(this.document, this.platformId);\n }\n\n public activateHeader(): void {\n this.setState({\n ...this.state,\n hasHeader: true,\n });\n CssUtils.activateHeaderCssVars(this.document, this.platformId);\n }\n\n public activateBreadcrumb(): void {\n this.setState({\n ...this.state,\n hasBreadcrumb: true,\n });\n CssUtils.activateBreadcrumbCssVars(this.document, this.platformId);\n }\n\n public activateTopMessage(height: number): void {\n this.setState({\n ...this.state,\n hasTopMessage: true,\n });\n CssUtils.activateTopMessageCssVars(height, this.document);\n }\n\n public activateToolbar(): void {\n this.setState({\n ...this.state,\n hasToolbar: true,\n });\n CssUtils.activateToolbarCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMegaMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMegaMenu: true,\n });\n CssUtils.activateToolbarMegaMenuCssVars(this.document, this.platformId);\n }\n\n public activateToolbarMenu(): void {\n this.setState({\n ...this.state,\n hasToolbarMenu: true,\n });\n }\n\n /**\n * Returns the current value of --eui-f-size-base CSS variable\n */\n public getBaseFontSize(): string {\n return this.state.appBaseFontSize || CssUtils.getCssVarValue('--eui-f-size-base', this.document, this.platformId);\n }\n\n /**\n * Updates the current value of --eui-f-size-base CSS variable and the UIState appBaseFontSize\n */\n public setBaseFontSize(newsize: string): void {\n this.setState(\n {\n ...this.state,\n appBaseFontSize: newsize,\n },\n false,\n );\n CssUtils.setCssVarValue('--eui-f-size-base', newsize, this.document);\n }\n\n // ---------------\n // private getters\n // ---------------\n private getWrapperClasses(state: UIState, breakpoint: string): string {\n const classes: string[] = [];\n\n classes.push(breakpoint);\n\n if (state.hasSidebar) {\n if (state.isSidebarHidden) {\n classes.push('sidebar--hidden');\n }\n if (state.isSidebarOpen) {\n classes.push('sidebar--open');\n } else {\n classes.push('sidebar--close');\n }\n }\n if (state.deviceInfo?.isFF) {\n classes.push('ff');\n }\n if (state.deviceInfo?.isIE) {\n classes.push('ie');\n }\n if (state.deviceInfo?.isChrome) {\n classes.push('chrome');\n }\n if (state.hasFixedPosition) {\n classes.push('fixed-position');\n } else {\n classes.push('relative-position');\n }\n return classes.join(' ');\n }\n\n private getBreakpoint(windowWidth: number): string {\n let bkp = '';\n\n if (this.state.breakpointValues.length === 0) {\n this.setState({\n ...this.state,\n breakpointValues: CssUtils.getBreakpointValues(this.document, this.platformId),\n });\n }\n\n this.state.breakpointValues.forEach((b, i) => {\n if (i < this.state.breakpointValues.length) {\n if (windowWidth >= b.value && windowWidth < this.state.breakpointValues[i+1]?.value) {\n bkp = b.bkp;\n }\n } else if(windowWidth >= b.value) {\n bkp = b.bkp;\n }\n });\n\n return bkp;\n }\n\n private getBreakpoints(bkp: string): object {\n return {\n isMobile: bkp === 'xs' || bkp === 'sm',\n isTablet: bkp === 'md',\n isLtLargeTablet: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg',\n isLtDesktop: bkp === 'xs' || bkp === 'sm' || bkp === 'md' || bkp === 'lg' || bkp === 'xl',\n isDesktop: bkp === 'xxl',\n isXL: bkp === 'xl',\n isXXL: bkp === 'xxl',\n isFHD: bkp === 'fhd',\n is2K: bkp === '2k',\n is4K: bkp === '4k',\n };\n }\n\n private getJson(url: string): Promise<object> {\n return firstValueFrom(this.http.get(url)).then(this.extractData).catch(this.handleError);\n }\n\n private extractData(res: Response): object {\n const body = res;\n return body || {};\n }\n\n private handleError<T extends Error>(error: T): Promise<T> {\n console.error('An error occurred', error);\n return Promise.reject(error.message || error);\n }\n\n private bindActiveLanguageToAppShellState(): void {\n this.i18nService.getState((s) => s.activeLang).subscribe((activeLang) => {\n if (activeLang !== this.state.activeLanguage) {\n this.setState(\n {\n ...this.state,\n activeLanguage: activeLang,\n },\n false,\n );\n }\n });\n }\n}\n",
|
|
5398
5410
|
"constructorObj": {
|
|
5399
5411
|
"name": "constructor",
|
|
5400
5412
|
"description": "",
|
|
5401
5413
|
"deprecated": false,
|
|
5402
5414
|
"deprecationMessage": "",
|
|
5403
5415
|
"args": [],
|
|
5404
|
-
"line":
|
|
5416
|
+
"line": 235,
|
|
5405
5417
|
"rawdescription": "\n"
|
|
5406
5418
|
},
|
|
5407
5419
|
"accessors": {
|
|
@@ -5411,7 +5423,7 @@
|
|
|
5411
5423
|
"name": "state$",
|
|
5412
5424
|
"type": "unknown",
|
|
5413
5425
|
"returnType": "Observable<UIState>",
|
|
5414
|
-
"line":
|
|
5426
|
+
"line": 143,
|
|
5415
5427
|
"rawdescription": "\n",
|
|
5416
5428
|
"description": ""
|
|
5417
5429
|
}
|
|
@@ -5422,7 +5434,7 @@
|
|
|
5422
5434
|
"name": "breakpoint$",
|
|
5423
5435
|
"type": "unknown",
|
|
5424
5436
|
"returnType": "Observable<string>",
|
|
5425
|
-
"line":
|
|
5437
|
+
"line": 150,
|
|
5426
5438
|
"rawdescription": "\n",
|
|
5427
5439
|
"description": ""
|
|
5428
5440
|
}
|
|
@@ -5433,7 +5445,7 @@
|
|
|
5433
5445
|
"name": "breakpoints$",
|
|
5434
5446
|
"type": "unknown",
|
|
5435
5447
|
"returnType": "Observable<any>",
|
|
5436
|
-
"line":
|
|
5448
|
+
"line": 155,
|
|
5437
5449
|
"rawdescription": "\n",
|
|
5438
5450
|
"description": ""
|
|
5439
5451
|
}
|
|
@@ -5444,7 +5456,7 @@
|
|
|
5444
5456
|
"name": "state",
|
|
5445
5457
|
"type": "unknown",
|
|
5446
5458
|
"returnType": "UIState",
|
|
5447
|
-
"line":
|
|
5459
|
+
"line": 162,
|
|
5448
5460
|
"rawdescription": "\n",
|
|
5449
5461
|
"description": ""
|
|
5450
5462
|
}
|
|
@@ -5467,7 +5479,7 @@
|
|
|
5467
5479
|
}
|
|
5468
5480
|
],
|
|
5469
5481
|
"returnType": "void",
|
|
5470
|
-
"line":
|
|
5482
|
+
"line": 169,
|
|
5471
5483
|
"rawdescription": "\n",
|
|
5472
5484
|
"description": "",
|
|
5473
5485
|
"jsdoctags": [
|
|
@@ -5488,7 +5500,7 @@
|
|
|
5488
5500
|
"name": "isSidebarOpen",
|
|
5489
5501
|
"type": "boolean",
|
|
5490
5502
|
"returnType": "boolean",
|
|
5491
|
-
"line":
|
|
5503
|
+
"line": 176,
|
|
5492
5504
|
"rawdescription": "\n",
|
|
5493
5505
|
"description": ""
|
|
5494
5506
|
}
|
|
@@ -5511,7 +5523,7 @@
|
|
|
5511
5523
|
}
|
|
5512
5524
|
],
|
|
5513
5525
|
"returnType": "void",
|
|
5514
|
-
"line":
|
|
5526
|
+
"line": 180,
|
|
5515
5527
|
"rawdescription": "\n",
|
|
5516
5528
|
"description": "",
|
|
5517
5529
|
"jsdoctags": [
|
|
@@ -5547,7 +5559,7 @@
|
|
|
5547
5559
|
}
|
|
5548
5560
|
],
|
|
5549
5561
|
"returnType": "void",
|
|
5550
|
-
"line":
|
|
5562
|
+
"line": 187,
|
|
5551
5563
|
"rawdescription": "\n",
|
|
5552
5564
|
"description": "",
|
|
5553
5565
|
"jsdoctags": [
|
|
@@ -5583,7 +5595,7 @@
|
|
|
5583
5595
|
}
|
|
5584
5596
|
],
|
|
5585
5597
|
"returnType": "void",
|
|
5586
|
-
"line":
|
|
5598
|
+
"line": 194,
|
|
5587
5599
|
"rawdescription": "\n",
|
|
5588
5600
|
"description": "",
|
|
5589
5601
|
"jsdoctags": [
|
|
@@ -5619,7 +5631,7 @@
|
|
|
5619
5631
|
}
|
|
5620
5632
|
],
|
|
5621
5633
|
"returnType": "void",
|
|
5622
|
-
"line":
|
|
5634
|
+
"line": 202,
|
|
5623
5635
|
"rawdescription": "\n",
|
|
5624
5636
|
"description": "",
|
|
5625
5637
|
"jsdoctags": [
|
|
@@ -5655,7 +5667,7 @@
|
|
|
5655
5667
|
}
|
|
5656
5668
|
],
|
|
5657
5669
|
"returnType": "void",
|
|
5658
|
-
"line":
|
|
5670
|
+
"line": 209,
|
|
5659
5671
|
"rawdescription": "\n",
|
|
5660
5672
|
"description": "",
|
|
5661
5673
|
"jsdoctags": [
|
|
@@ -5679,7 +5691,7 @@
|
|
|
5679
5691
|
"name": "hasHeader",
|
|
5680
5692
|
"type": "boolean",
|
|
5681
5693
|
"returnType": "boolean",
|
|
5682
|
-
"line":
|
|
5694
|
+
"line": 216,
|
|
5683
5695
|
"rawdescription": "\n",
|
|
5684
5696
|
"description": ""
|
|
5685
5697
|
}
|
|
@@ -5702,7 +5714,7 @@
|
|
|
5702
5714
|
}
|
|
5703
5715
|
],
|
|
5704
5716
|
"returnType": "void",
|
|
5705
|
-
"line":
|
|
5717
|
+
"line": 225,
|
|
5706
5718
|
"rawdescription": "\n",
|
|
5707
5719
|
"description": "",
|
|
5708
5720
|
"jsdoctags": [
|
|
@@ -5723,7 +5735,7 @@
|
|
|
5723
5735
|
"name": "isDimmerActive",
|
|
5724
5736
|
"type": "boolean",
|
|
5725
5737
|
"returnType": "boolean",
|
|
5726
|
-
"line":
|
|
5738
|
+
"line": 221,
|
|
5727
5739
|
"rawdescription": "\n",
|
|
5728
5740
|
"description": ""
|
|
5729
5741
|
}
|
|
@@ -22648,7 +22660,7 @@
|
|
|
22648
22660
|
"deprecated": false,
|
|
22649
22661
|
"deprecationMessage": "",
|
|
22650
22662
|
"type": "UIState",
|
|
22651
|
-
"defaultValue": "{\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n}"
|
|
22663
|
+
"defaultValue": "{\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasFixedPosition: true,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n}"
|
|
22652
22664
|
},
|
|
22653
22665
|
{
|
|
22654
22666
|
"name": "initialState",
|
|
@@ -38626,7 +38638,7 @@
|
|
|
38626
38638
|
"deprecated": false,
|
|
38627
38639
|
"deprecationMessage": "",
|
|
38628
38640
|
"type": "UIState",
|
|
38629
|
-
"defaultValue": "{\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n}"
|
|
38641
|
+
"defaultValue": "{\n appName: '',\n appShortName: '',\n appSubTitle: '',\n appBaseFontSize: '',\n\n isSidebarOpen: true,\n isSidebarActive: false,\n hasFixedPosition: true,\n hasSidebar: false,\n hasSideContainer: false,\n hasHeader: false,\n hasBreadcrumb: false,\n hasHeaderLogo: false,\n hasHeaderEnvironment: false,\n hasToolbar: false,\n hasToolbarMegaMenu: false,\n hasToolbarMenu: false,\n environmentValue: '',\n isSidebarHidden: false,\n isSidebarFocused: false,\n hasSidebarCollapsedVariant: false,\n hasTopMessage: false,\n windowWidth: 0,\n windowHeight: 0,\n mainContentHeight: 0,\n pageHeaderHeight: 0,\n wrapperClasses: '',\n breakpoint: '',\n breakpoints: {\n isMobile: false,\n isTablet: false,\n isLtLargeTablet: false,\n isLtDesktop: false,\n isDesktop: false,\n isXL: false,\n isXXL: false,\n isFHD: false,\n is2K: false,\n is4K: false,\n },\n breakpointValues: [],\n menuLinks: [],\n sidebarLinks: [],\n combinedLinks: [],\n isBlockDocumentActive: false,\n deviceInfo: null,\n activeLanguage: 'en',\n languages: EuiEuLanguages.getLanguages(),\n appMetadata: null,\n hasModalActive: false,\n isDimmerActive: false,\n}"
|
|
38630
38642
|
}
|
|
38631
38643
|
],
|
|
38632
38644
|
"packages/core/src/lib/services/eui-theme.service.ts": [
|