@eui/core 22.0.0-alpha.6 → 22.0.0-alpha.61
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 +895 -0
- package/assets/i18n-eui/bg.json +23 -1
- package/assets/i18n-eui/cs.json +23 -1
- package/assets/i18n-eui/da.json +23 -1
- package/assets/i18n-eui/de.json +23 -1
- package/assets/i18n-eui/el.json +23 -1
- package/assets/i18n-eui/en.json +23 -1
- package/assets/i18n-eui/es.json +23 -1
- package/assets/i18n-eui/et.json +31 -2
- package/assets/i18n-eui/fi.json +24 -2
- package/assets/i18n-eui/fr.json +23 -1
- package/assets/i18n-eui/ga.json +23 -1
- package/assets/i18n-eui/hr.json +23 -1
- package/assets/i18n-eui/hu.json +23 -1
- package/assets/i18n-eui/it.json +23 -1
- package/assets/i18n-eui/lt.json +23 -1
- package/assets/i18n-eui/lv.json +23 -1
- package/assets/i18n-eui/mt.json +23 -1
- package/assets/i18n-eui/nl.json +23 -1
- package/assets/i18n-eui/pl.json +23 -1
- package/assets/i18n-eui/pt.json +23 -1
- package/assets/i18n-eui/ro.json +23 -1
- package/assets/i18n-eui/sk.json +23 -1
- package/assets/i18n-eui/sl.json +23 -1
- package/assets/i18n-eui/sv.json +23 -1
- package/docs/changelog.html +1341 -0
- package/docs/interfaces/Schema-10.html +1 -1
- package/docs/interfaces/Schema-11.html +1 -1
- package/docs/interfaces/Schema-12.html +1 -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-17.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 +52 -1
- package/docs/interfaces/Schema-20.html +1 -1
- package/docs/interfaces/Schema-21.html +1 -1
- package/docs/interfaces/Schema-22.html +1 -1
- package/docs/interfaces/Schema-23.html +368 -0
- package/docs/interfaces/Schema-3.html +1 -64
- package/docs/interfaces/Schema-4.html +13 -1
- package/docs/js/menu-wc.js +3 -0
- package/docs/js/search/search_index.js +2 -2
- package/docs/json/documentation.json +448 -53
- package/docs/llms.txt +28 -10
- package/docs/miscellaneous/functions.html +346 -1
- package/docs/overview.html +1 -1
- package/docs/properties.html +1 -1
- package/fesm2022/eui-core.mjs +5768 -5461
- package/fesm2022/eui-core.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/collection.json +5 -0
- package/schematics/migrate/replacements/icons.d.ts +3 -1
- package/schematics/migrate/replacements/icons.js +15 -5
- package/schematics/migrate/replacements/icons.js.map +1 -1
- package/schematics/migrate-all/index.js +1 -0
- package/schematics/migrate-all/index.js.map +1 -1
- package/types/eui-core.d.ts +2099 -2168
- package/types/eui-core.d.ts.map +1 -1
|
@@ -1701,12 +1701,12 @@
|
|
|
1701
1701
|
},
|
|
1702
1702
|
{
|
|
1703
1703
|
"name": "MigrateAllSchema",
|
|
1704
|
-
"id": "interface-MigrateAllSchema-
|
|
1704
|
+
"id": "interface-MigrateAllSchema-ff00527ff10e4024860df7a58f0718a519bbe44a55f6951c767c763c2e9519909a5ab8d7d3c2a9d7b753290eb09171c3d3caa3ca2709c44cb457da119f42d4e0",
|
|
1705
1705
|
"file": "packages/core/schematics/migrate-all/index.ts",
|
|
1706
1706
|
"deprecated": false,
|
|
1707
1707
|
"deprecationMessage": "",
|
|
1708
1708
|
"type": "interface",
|
|
1709
|
-
"sourceCode": "import { Rule, chain, schematic } from '@angular-devkit/schematics';\n\nexport interface MigrateAllSchema {\n path?: string;\n dryRun?: boolean;\n mwp?: boolean;\n useClassArray?: boolean;\n}\n\nexport function migrateAll(options: MigrateAllSchema): Rule {\n const base = { path: options.path || './src', dryRun: options.dryRun || false };\n\n return chain([\n schematic('migrate', { ...base, mwp: options.mwp || false }),\n schematic('migrate-eui-tabs', base),\n schematic('migrate-to-standalone', base),\n schematic('migrate-eui-alert', base),\n schematic('migrate-eui-progress-circle', base),\n schematic('migrate-eui-popover', base),\n schematic('migrate-eui-icon-toggle', base),\n schematic('migrate-eui-icon-svg', base),\n schematic('migrate-eui-fieldset', base),\n schematic('migrate-eui-avatar', base),\n schematic('migrate-eui-editor', base),\n schematic('migrate-eui-discussion-thread', base),\n schematic('migrate-eui-button', base),\n schematic('migrate-eui-accent', base),\n schematic('migrate-eui-toolbar-menu', base),\n schematic('migrate-eui-table', base),\n schematic('migrate-eui-chip-list', base),\n schematic('migrate-eui-chip', base),\n schematic('migrate-eui-tooltip', base),\n schematic('migrate-to-signals', base),\n schematic('add-eui-imports', { ...base, useClassArray: options.useClassArray || false }),\n schematic('fix-no-multiple-empty-lines', base),\n ]);\n}\n",
|
|
1709
|
+
"sourceCode": "import { Rule, chain, schematic } from '@angular-devkit/schematics';\n\nexport interface MigrateAllSchema {\n path?: string;\n dryRun?: boolean;\n mwp?: boolean;\n useClassArray?: boolean;\n}\n\nexport function migrateAll(options: MigrateAllSchema): Rule {\n const base = { path: options.path || './src', dryRun: options.dryRun || false };\n\n return chain([\n schematic('migrate', { ...base, mwp: options.mwp || false }),\n schematic('migrate-eui-tabs', base),\n schematic('migrate-to-standalone', base),\n schematic('migrate-eui-alert', base),\n schematic('migrate-eui-progress-circle', base),\n schematic('migrate-eui-popover', base),\n schematic('migrate-eui-icon-toggle', base),\n schematic('migrate-eui-icon-svg', base),\n schematic('migrate-eui-fieldset', base),\n schematic('migrate-eui-avatar', base),\n schematic('migrate-eui-editor', base),\n schematic('migrate-eui-discussion-thread', base),\n schematic('migrate-eui-button', base),\n schematic('migrate-eui-accent', base),\n schematic('migrate-eui-toolbar-menu', base),\n schematic('migrate-eui-table', base),\n schematic('migrate-eui-chip-list', base),\n schematic('migrate-eui-chip', base),\n schematic('migrate-eui-tooltip', base),\n schematic('migrate-eui-datepicker', base),\n schematic('migrate-to-signals', base),\n schematic('add-eui-imports', { ...base, useClassArray: options.useClassArray || false }),\n schematic('fix-no-multiple-empty-lines', base),\n ]);\n}\n",
|
|
1710
1710
|
"displayName": "MigrateAllSchema",
|
|
1711
1711
|
"properties": [
|
|
1712
1712
|
{
|
|
@@ -2630,7 +2630,54 @@
|
|
|
2630
2630
|
},
|
|
2631
2631
|
{
|
|
2632
2632
|
"name": "Schema",
|
|
2633
|
-
"id": "interface-Schema-
|
|
2633
|
+
"id": "interface-Schema-034783c11a28141757a2de014303eca4a8256ffd2b18334db3a1d414f90247bcb476298452a8da2444dd3023cd12ac4e1ad90de3d59103874dca0b32b1b04800-10",
|
|
2634
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
2635
|
+
"deprecated": false,
|
|
2636
|
+
"deprecationMessage": "",
|
|
2637
|
+
"type": "interface",
|
|
2638
|
+
"sourceCode": "import { parseTemplate, TmplAstElement, TmplAstNode } from '@angular/compiler';\nimport { DirEntry, Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport { logDryRunNote } from '../utils/dry-run';\n\ninterface Schema {\n path?: string;\n dryRun?: boolean;\n}\n\n/**\n * Advisory migration for the eui-datepicker moment-locale breaking change.\n *\n * `eui-datepicker` no longer bundles the moment locale data (the internal\n * `import 'moment/min/locales'` was removed). Apps that relied on the datepicker\n * implicitly registering every moment locale must now import the locales they use\n * themselves, e.g. `import 'moment/locale/fr';`. This schematic cannot know which\n * locales an app needs (and auto-importing all of them would reintroduce the bundle\n * cost the change removed), so it only reports the files that use `eui-datepicker`\n * and the manual action required.\n */\nexport function migrateEuiDatepicker(options: Schema = {}): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const scanPath = options.path ? '/' + options.path.replace(/^\\.?\\//, '').replace(/\\/$/, '') : '';\n const matches: string[] = [];\n\n const dir = tree.getDir(scanPath || '/');\n visitDir(dir, (path) => {\n const buffer = tree.read(path);\n if (!buffer) return;\n\n const content = buffer.toString('utf-8');\n if (!content.includes('eui-datepicker')) return;\n\n const usesDatepicker = path.endsWith('.html')\n ? templateUsesDatepicker(content)\n : inlineTemplateUsesDatepicker(content);\n\n if (usesDatepicker) {\n matches.push(path);\n }\n });\n\n if (matches.length === 0) {\n context.logger.info('No eui-datepicker usage found; no moment-locale action required.');\n return tree;\n }\n\n context.logger.warn(\n 'Breaking change: eui-datepicker no longer bundles moment locale data. '\n + 'Import the moment locales your app uses (e.g. `import \\'moment/locale/fr\\';`) '\n + 'in the module/bootstrap where the datepicker is used; otherwise dates fall back '\n + 'to the active moment locale and may format incorrectly.',\n );\n for (const path of matches) {\n context.logger.warn(` Manual action needed: ${path} uses eui-datepicker — ensure the required moment locale(s) are imported.`);\n }\n context.logger.info(`eui-datepicker moment-locale check: ${matches.length} file(s) use eui-datepicker.`);\n\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('.html') && !file.endsWith('.ts')) 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\nfunction templateUsesDatepicker(source: string): boolean {\n try {\n const parsed = parseTemplate(source, '', { preserveWhitespaces: true });\n return nodesContainDatepicker(parsed.nodes);\n } catch {\n // Fall back to a substring check if the template cannot be parsed.\n return source.includes('eui-datepicker');\n }\n}\n\nfunction inlineTemplateUsesDatepicker(source: string): boolean {\n const templateRegex = /template\\s*:\\s*`([^`]*)`/gs;\n let match: RegExpExecArray | null;\n while ((match = templateRegex.exec(source)) !== null) {\n if (match[1].includes('eui-datepicker') && templateUsesDatepicker(match[1])) {\n return true;\n }\n }\n return false;\n}\n\nfunction nodesContainDatepicker(nodes: TmplAstNode[]): boolean {\n for (const node of nodes) {\n if (node instanceof TmplAstElement) {\n if (node.name === 'eui-datepicker') {\n return true;\n }\n if (nodesContainDatepicker(node.children)) {\n return true;\n }\n }\n }\n return false;\n}\n",
|
|
2639
|
+
"displayName": "Schema",
|
|
2640
|
+
"properties": [
|
|
2641
|
+
{
|
|
2642
|
+
"name": "dryRun",
|
|
2643
|
+
"coverageIgnore": false,
|
|
2644
|
+
"deprecated": false,
|
|
2645
|
+
"deprecationMessage": "",
|
|
2646
|
+
"type": "boolean",
|
|
2647
|
+
"indexKey": "",
|
|
2648
|
+
"optional": true,
|
|
2649
|
+
"description": "",
|
|
2650
|
+
"line": 7,
|
|
2651
|
+
"rawdescription": "\n"
|
|
2652
|
+
},
|
|
2653
|
+
{
|
|
2654
|
+
"name": "path",
|
|
2655
|
+
"coverageIgnore": false,
|
|
2656
|
+
"deprecated": false,
|
|
2657
|
+
"deprecationMessage": "",
|
|
2658
|
+
"type": "string",
|
|
2659
|
+
"indexKey": "",
|
|
2660
|
+
"optional": true,
|
|
2661
|
+
"description": "",
|
|
2662
|
+
"line": 6,
|
|
2663
|
+
"rawdescription": "\n"
|
|
2664
|
+
}
|
|
2665
|
+
],
|
|
2666
|
+
"indexSignatures": [],
|
|
2667
|
+
"kind": 172,
|
|
2668
|
+
"methods": [],
|
|
2669
|
+
"extends": [],
|
|
2670
|
+
"isDuplicate": true,
|
|
2671
|
+
"duplicateId": 10,
|
|
2672
|
+
"duplicateName": "Schema-10",
|
|
2673
|
+
"relationships": {
|
|
2674
|
+
"incoming": [],
|
|
2675
|
+
"outgoing": []
|
|
2676
|
+
}
|
|
2677
|
+
},
|
|
2678
|
+
{
|
|
2679
|
+
"name": "Schema",
|
|
2680
|
+
"id": "interface-Schema-869dfc324e9111966817cbebb3553eabfe200acfe33bb77efa71a6c46e1cba0ff5852de7b9ade3060f87264035b99591361331a9e0622daaac22b8d59146c761-11",
|
|
2634
2681
|
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
2635
2682
|
"deprecated": false,
|
|
2636
2683
|
"deprecationMessage": "",
|
|
@@ -2668,8 +2715,8 @@
|
|
|
2668
2715
|
"methods": [],
|
|
2669
2716
|
"extends": [],
|
|
2670
2717
|
"isDuplicate": true,
|
|
2671
|
-
"duplicateId":
|
|
2672
|
-
"duplicateName": "Schema-
|
|
2718
|
+
"duplicateId": 11,
|
|
2719
|
+
"duplicateName": "Schema-11",
|
|
2673
2720
|
"relationships": {
|
|
2674
2721
|
"incoming": [],
|
|
2675
2722
|
"outgoing": []
|
|
@@ -2677,7 +2724,7 @@
|
|
|
2677
2724
|
},
|
|
2678
2725
|
{
|
|
2679
2726
|
"name": "Schema",
|
|
2680
|
-
"id": "interface-Schema-375dc0924084a2acbafe4a6a32577d59f631c9a386d151180d8fb1c89e7e7cd23da9fd459e597592ed823692adb6ad2633c50baf16621f003246e8c9bb1c6ce0-
|
|
2727
|
+
"id": "interface-Schema-375dc0924084a2acbafe4a6a32577d59f631c9a386d151180d8fb1c89e7e7cd23da9fd459e597592ed823692adb6ad2633c50baf16621f003246e8c9bb1c6ce0-12",
|
|
2681
2728
|
"file": "packages/core/schematics/migrate-eui-editor/index.ts",
|
|
2682
2729
|
"deprecated": false,
|
|
2683
2730
|
"deprecationMessage": "",
|
|
@@ -2715,8 +2762,8 @@
|
|
|
2715
2762
|
"methods": [],
|
|
2716
2763
|
"extends": [],
|
|
2717
2764
|
"isDuplicate": true,
|
|
2718
|
-
"duplicateId":
|
|
2719
|
-
"duplicateName": "Schema-
|
|
2765
|
+
"duplicateId": 12,
|
|
2766
|
+
"duplicateName": "Schema-12",
|
|
2720
2767
|
"relationships": {
|
|
2721
2768
|
"incoming": [],
|
|
2722
2769
|
"outgoing": []
|
|
@@ -2724,7 +2771,7 @@
|
|
|
2724
2771
|
},
|
|
2725
2772
|
{
|
|
2726
2773
|
"name": "Schema",
|
|
2727
|
-
"id": "interface-Schema-0ee574e11dd651dd971057cb66220845e5b87b2949c69c623c8ddf7355af92a396c58c237a52a05f18c22a5332a2695b717bcfeb8ea840c4e7df8d0084c2b49c-
|
|
2774
|
+
"id": "interface-Schema-0ee574e11dd651dd971057cb66220845e5b87b2949c69c623c8ddf7355af92a396c58c237a52a05f18c22a5332a2695b717bcfeb8ea840c4e7df8d0084c2b49c-13",
|
|
2728
2775
|
"file": "packages/core/schematics/migrate-eui-fieldset/index.ts",
|
|
2729
2776
|
"deprecated": false,
|
|
2730
2777
|
"deprecationMessage": "",
|
|
@@ -2762,8 +2809,8 @@
|
|
|
2762
2809
|
"methods": [],
|
|
2763
2810
|
"extends": [],
|
|
2764
2811
|
"isDuplicate": true,
|
|
2765
|
-
"duplicateId":
|
|
2766
|
-
"duplicateName": "Schema-
|
|
2812
|
+
"duplicateId": 13,
|
|
2813
|
+
"duplicateName": "Schema-13",
|
|
2767
2814
|
"relationships": {
|
|
2768
2815
|
"incoming": [],
|
|
2769
2816
|
"outgoing": []
|
|
@@ -2771,7 +2818,7 @@
|
|
|
2771
2818
|
},
|
|
2772
2819
|
{
|
|
2773
2820
|
"name": "Schema",
|
|
2774
|
-
"id": "interface-Schema-b3ff4600c4a5ca1888c45e5baf3600fa6dc6477f1e473e5241ff6682e2929dc8950a5dfa8b1048a348dba7ad1f0ce8cc3681471933911b689e04713334ef4811-
|
|
2821
|
+
"id": "interface-Schema-b3ff4600c4a5ca1888c45e5baf3600fa6dc6477f1e473e5241ff6682e2929dc8950a5dfa8b1048a348dba7ad1f0ce8cc3681471933911b689e04713334ef4811-14",
|
|
2775
2822
|
"file": "packages/core/schematics/migrate-eui-icon-svg/index.ts",
|
|
2776
2823
|
"deprecated": false,
|
|
2777
2824
|
"deprecationMessage": "",
|
|
@@ -2809,8 +2856,8 @@
|
|
|
2809
2856
|
"methods": [],
|
|
2810
2857
|
"extends": [],
|
|
2811
2858
|
"isDuplicate": true,
|
|
2812
|
-
"duplicateId":
|
|
2813
|
-
"duplicateName": "Schema-
|
|
2859
|
+
"duplicateId": 14,
|
|
2860
|
+
"duplicateName": "Schema-14",
|
|
2814
2861
|
"relationships": {
|
|
2815
2862
|
"incoming": [],
|
|
2816
2863
|
"outgoing": []
|
|
@@ -2818,7 +2865,7 @@
|
|
|
2818
2865
|
},
|
|
2819
2866
|
{
|
|
2820
2867
|
"name": "Schema",
|
|
2821
|
-
"id": "interface-Schema-21147930d3fbc38fbb3052a2ed9e7aa2b7505e6ed8c88c28796ce7101bd2ad914726eb230dda5826647036190edec6dae7e7e1d172387cd3803aa00bcdf790be-
|
|
2868
|
+
"id": "interface-Schema-21147930d3fbc38fbb3052a2ed9e7aa2b7505e6ed8c88c28796ce7101bd2ad914726eb230dda5826647036190edec6dae7e7e1d172387cd3803aa00bcdf790be-15",
|
|
2822
2869
|
"file": "packages/core/schematics/migrate-eui-icon-toggle/index.ts",
|
|
2823
2870
|
"deprecated": false,
|
|
2824
2871
|
"deprecationMessage": "",
|
|
@@ -2856,8 +2903,8 @@
|
|
|
2856
2903
|
"methods": [],
|
|
2857
2904
|
"extends": [],
|
|
2858
2905
|
"isDuplicate": true,
|
|
2859
|
-
"duplicateId":
|
|
2860
|
-
"duplicateName": "Schema-
|
|
2906
|
+
"duplicateId": 15,
|
|
2907
|
+
"duplicateName": "Schema-15",
|
|
2861
2908
|
"relationships": {
|
|
2862
2909
|
"incoming": [],
|
|
2863
2910
|
"outgoing": []
|
|
@@ -2865,7 +2912,7 @@
|
|
|
2865
2912
|
},
|
|
2866
2913
|
{
|
|
2867
2914
|
"name": "Schema",
|
|
2868
|
-
"id": "interface-Schema-a806c1769fb526271565003a6a3ef9ab4c67e421d93ee0cb54e1f6de223807afc1f16ad294656ef614a77a91a38cc914ce41ac97ed3a8a4195a1e74a729c0c08-
|
|
2915
|
+
"id": "interface-Schema-a806c1769fb526271565003a6a3ef9ab4c67e421d93ee0cb54e1f6de223807afc1f16ad294656ef614a77a91a38cc914ce41ac97ed3a8a4195a1e74a729c0c08-16",
|
|
2869
2916
|
"file": "packages/core/schematics/migrate-eui-popover/index.ts",
|
|
2870
2917
|
"deprecated": false,
|
|
2871
2918
|
"deprecationMessage": "",
|
|
@@ -2903,8 +2950,8 @@
|
|
|
2903
2950
|
"methods": [],
|
|
2904
2951
|
"extends": [],
|
|
2905
2952
|
"isDuplicate": true,
|
|
2906
|
-
"duplicateId":
|
|
2907
|
-
"duplicateName": "Schema-
|
|
2953
|
+
"duplicateId": 16,
|
|
2954
|
+
"duplicateName": "Schema-16",
|
|
2908
2955
|
"relationships": {
|
|
2909
2956
|
"incoming": [],
|
|
2910
2957
|
"outgoing": []
|
|
@@ -2912,7 +2959,7 @@
|
|
|
2912
2959
|
},
|
|
2913
2960
|
{
|
|
2914
2961
|
"name": "Schema",
|
|
2915
|
-
"id": "interface-Schema-90e62c16ce9ada881e8d434336bb633dae9745236106ddf60964afbd11de6aa579255a13d6036b384281860eb6ed2ee329194b519c51fdaf20f79bc511d0f64f-
|
|
2962
|
+
"id": "interface-Schema-90e62c16ce9ada881e8d434336bb633dae9745236106ddf60964afbd11de6aa579255a13d6036b384281860eb6ed2ee329194b519c51fdaf20f79bc511d0f64f-17",
|
|
2916
2963
|
"file": "packages/core/schematics/migrate-eui-progress-circle/index.ts",
|
|
2917
2964
|
"deprecated": false,
|
|
2918
2965
|
"deprecationMessage": "",
|
|
@@ -2950,8 +2997,8 @@
|
|
|
2950
2997
|
"methods": [],
|
|
2951
2998
|
"extends": [],
|
|
2952
2999
|
"isDuplicate": true,
|
|
2953
|
-
"duplicateId":
|
|
2954
|
-
"duplicateName": "Schema-
|
|
3000
|
+
"duplicateId": 17,
|
|
3001
|
+
"duplicateName": "Schema-17",
|
|
2955
3002
|
"relationships": {
|
|
2956
3003
|
"incoming": [],
|
|
2957
3004
|
"outgoing": []
|
|
@@ -2959,7 +3006,7 @@
|
|
|
2959
3006
|
},
|
|
2960
3007
|
{
|
|
2961
3008
|
"name": "Schema",
|
|
2962
|
-
"id": "interface-Schema-91c9f900bf3ebb82488fb65644938ef486ceaa447cff8bfd9d710df9595d82acb267b26f3c252173bc684353f362473120226426ed7ee5d98b33e30011dd9383-
|
|
3009
|
+
"id": "interface-Schema-91c9f900bf3ebb82488fb65644938ef486ceaa447cff8bfd9d710df9595d82acb267b26f3c252173bc684353f362473120226426ed7ee5d98b33e30011dd9383-18",
|
|
2963
3010
|
"file": "packages/core/schematics/migrate-eui-table/index.ts",
|
|
2964
3011
|
"deprecated": false,
|
|
2965
3012
|
"deprecationMessage": "",
|
|
@@ -2997,8 +3044,8 @@
|
|
|
2997
3044
|
"methods": [],
|
|
2998
3045
|
"extends": [],
|
|
2999
3046
|
"isDuplicate": true,
|
|
3000
|
-
"duplicateId":
|
|
3001
|
-
"duplicateName": "Schema-
|
|
3047
|
+
"duplicateId": 18,
|
|
3048
|
+
"duplicateName": "Schema-18",
|
|
3002
3049
|
"relationships": {
|
|
3003
3050
|
"incoming": [],
|
|
3004
3051
|
"outgoing": []
|
|
@@ -3006,7 +3053,7 @@
|
|
|
3006
3053
|
},
|
|
3007
3054
|
{
|
|
3008
3055
|
"name": "Schema",
|
|
3009
|
-
"id": "interface-Schema-760dec88d3f709d5b38226e55f7cbfb1e5fabcea6c004fd46e611be1dd563b8b247e9e6c77667e5582fe7b443374ba2c4facd2b2db2985edb46c9a4a37a8a876-
|
|
3056
|
+
"id": "interface-Schema-760dec88d3f709d5b38226e55f7cbfb1e5fabcea6c004fd46e611be1dd563b8b247e9e6c77667e5582fe7b443374ba2c4facd2b2db2985edb46c9a4a37a8a876-19",
|
|
3010
3057
|
"file": "packages/core/schematics/migrate-eui-tabs/index.ts",
|
|
3011
3058
|
"deprecated": false,
|
|
3012
3059
|
"deprecationMessage": "",
|
|
@@ -3044,8 +3091,8 @@
|
|
|
3044
3091
|
"methods": [],
|
|
3045
3092
|
"extends": [],
|
|
3046
3093
|
"isDuplicate": true,
|
|
3047
|
-
"duplicateId":
|
|
3048
|
-
"duplicateName": "Schema-
|
|
3094
|
+
"duplicateId": 19,
|
|
3095
|
+
"duplicateName": "Schema-19",
|
|
3049
3096
|
"relationships": {
|
|
3050
3097
|
"incoming": [],
|
|
3051
3098
|
"outgoing": []
|
|
@@ -3053,7 +3100,7 @@
|
|
|
3053
3100
|
},
|
|
3054
3101
|
{
|
|
3055
3102
|
"name": "Schema",
|
|
3056
|
-
"id": "interface-Schema-e1cd02924eb82a618c71a0b26c081bdd020519d2699aa0e2dc98640c4e0f347c3649b967c5fc87543e41bbbfabd1304835850ccc38f40684d6521c242b2030ed-
|
|
3103
|
+
"id": "interface-Schema-e1cd02924eb82a618c71a0b26c081bdd020519d2699aa0e2dc98640c4e0f347c3649b967c5fc87543e41bbbfabd1304835850ccc38f40684d6521c242b2030ed-20",
|
|
3057
3104
|
"file": "packages/core/schematics/migrate-eui-toolbar-menu/index.ts",
|
|
3058
3105
|
"deprecated": false,
|
|
3059
3106
|
"deprecationMessage": "",
|
|
@@ -3091,8 +3138,8 @@
|
|
|
3091
3138
|
"methods": [],
|
|
3092
3139
|
"extends": [],
|
|
3093
3140
|
"isDuplicate": true,
|
|
3094
|
-
"duplicateId":
|
|
3095
|
-
"duplicateName": "Schema-
|
|
3141
|
+
"duplicateId": 20,
|
|
3142
|
+
"duplicateName": "Schema-20",
|
|
3096
3143
|
"relationships": {
|
|
3097
3144
|
"incoming": [],
|
|
3098
3145
|
"outgoing": []
|
|
@@ -3100,7 +3147,7 @@
|
|
|
3100
3147
|
},
|
|
3101
3148
|
{
|
|
3102
3149
|
"name": "Schema",
|
|
3103
|
-
"id": "interface-Schema-d36032102ed30a7ada1e3d36bb9ca41b7234b855760cac9783a25818f7ffe2097e1ebd8e808b574ddec0760f827272f6cd561f45f3eb1578f87f39ee2633730a-
|
|
3150
|
+
"id": "interface-Schema-d36032102ed30a7ada1e3d36bb9ca41b7234b855760cac9783a25818f7ffe2097e1ebd8e808b574ddec0760f827272f6cd561f45f3eb1578f87f39ee2633730a-21",
|
|
3104
3151
|
"file": "packages/core/schematics/migrate-eui-tooltip/index.ts",
|
|
3105
3152
|
"deprecated": false,
|
|
3106
3153
|
"deprecationMessage": "",
|
|
@@ -3138,8 +3185,8 @@
|
|
|
3138
3185
|
"methods": [],
|
|
3139
3186
|
"extends": [],
|
|
3140
3187
|
"isDuplicate": true,
|
|
3141
|
-
"duplicateId":
|
|
3142
|
-
"duplicateName": "Schema-
|
|
3188
|
+
"duplicateId": 21,
|
|
3189
|
+
"duplicateName": "Schema-21",
|
|
3143
3190
|
"relationships": {
|
|
3144
3191
|
"incoming": [],
|
|
3145
3192
|
"outgoing": []
|
|
@@ -3147,7 +3194,7 @@
|
|
|
3147
3194
|
},
|
|
3148
3195
|
{
|
|
3149
3196
|
"name": "Schema",
|
|
3150
|
-
"id": "interface-Schema-cac2ac952d8245647e8a48b450e8f127a36bcffb394cf2cd81fe9c0810ed02c19e5e1629dbf29a68a5c6f675aed99570e9ac04ae470e13315e20c92cc0c6c453-
|
|
3197
|
+
"id": "interface-Schema-cac2ac952d8245647e8a48b450e8f127a36bcffb394cf2cd81fe9c0810ed02c19e5e1629dbf29a68a5c6f675aed99570e9ac04ae470e13315e20c92cc0c6c453-22",
|
|
3151
3198
|
"file": "packages/core/schematics/migrate-to-signals/index.ts",
|
|
3152
3199
|
"deprecated": false,
|
|
3153
3200
|
"deprecationMessage": "",
|
|
@@ -3185,8 +3232,8 @@
|
|
|
3185
3232
|
"methods": [],
|
|
3186
3233
|
"extends": [],
|
|
3187
3234
|
"isDuplicate": true,
|
|
3188
|
-
"duplicateId":
|
|
3189
|
-
"duplicateName": "Schema-
|
|
3235
|
+
"duplicateId": 22,
|
|
3236
|
+
"duplicateName": "Schema-22",
|
|
3190
3237
|
"relationships": {
|
|
3191
3238
|
"incoming": [],
|
|
3192
3239
|
"outgoing": []
|
|
@@ -3194,7 +3241,7 @@
|
|
|
3194
3241
|
},
|
|
3195
3242
|
{
|
|
3196
3243
|
"name": "Schema",
|
|
3197
|
-
"id": "interface-Schema-817c4b549cc3eab9fcf4936acab2e71182d90a4480369f5c003cbbda10792efa587ad99d65acf049f64e7030e32589e4fabc4a6d7a5621e4fe54725ef91dc9e8-
|
|
3244
|
+
"id": "interface-Schema-817c4b549cc3eab9fcf4936acab2e71182d90a4480369f5c003cbbda10792efa587ad99d65acf049f64e7030e32589e4fabc4a6d7a5621e4fe54725ef91dc9e8-23",
|
|
3198
3245
|
"file": "packages/core/schematics/migrate-to-standalone/index.ts",
|
|
3199
3246
|
"deprecated": false,
|
|
3200
3247
|
"deprecationMessage": "",
|
|
@@ -3232,8 +3279,8 @@
|
|
|
3232
3279
|
"methods": [],
|
|
3233
3280
|
"extends": [],
|
|
3234
3281
|
"isDuplicate": true,
|
|
3235
|
-
"duplicateId":
|
|
3236
|
-
"duplicateName": "Schema-
|
|
3282
|
+
"duplicateId": 23,
|
|
3283
|
+
"duplicateName": "Schema-23",
|
|
3237
3284
|
"relationships": {
|
|
3238
3285
|
"incoming": [],
|
|
3239
3286
|
"outgoing": []
|
|
@@ -3574,12 +3621,12 @@
|
|
|
3574
3621
|
},
|
|
3575
3622
|
{
|
|
3576
3623
|
"name": "UIState",
|
|
3577
|
-
"id": "interface-UIState-
|
|
3624
|
+
"id": "interface-UIState-f1976eab5525bcef6ad2f5270074f44d49266217cac22255920e3a5be7eee4095f689d809e4fe56262d28a85ea12a19c67cf46a343134587fb48f0ce841014cf",
|
|
3578
3625
|
"file": "packages/core/src/lib/services/eui-app-shell.service.ts",
|
|
3579
3626
|
"deprecated": false,
|
|
3580
3627
|
"deprecationMessage": "",
|
|
3581
3628
|
"type": "interface",
|
|
3582
|
-
"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 isShrinkHeaderActive?: 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 hasFixedPosition?: boolean;\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 isShrinkHeaderActive: 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 //eslint-disable-next-line @typescript-eslint/no-explicit-any\n setState(nextState: UIState<any, any, any, any>, 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",
|
|
3629
|
+
"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 isShrinkHeaderActive?: 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 hasFixedPosition?: boolean;\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 isShrinkHeaderActive: 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 //eslint-disable-next-line @typescript-eslint/no-explicit-any\n setState(nextState: UIState<any, any, any, any>, 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 if (!this.i18nService) {\n return;\n }\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",
|
|
3583
3630
|
"displayName": "UIState<BP = any, DI = any, AMD =any, BPV = any>",
|
|
3584
3631
|
"typeParameters": [
|
|
3585
3632
|
"BP = any",
|
|
@@ -5047,7 +5094,7 @@
|
|
|
5047
5094
|
},
|
|
5048
5095
|
{
|
|
5049
5096
|
"name": "EuiAppShellService",
|
|
5050
|
-
"id": "injectable-EuiAppShellService-
|
|
5097
|
+
"id": "injectable-EuiAppShellService-f1976eab5525bcef6ad2f5270074f44d49266217cac22255920e3a5be7eee4095f689d809e4fe56262d28a85ea12a19c67cf46a343134587fb48f0ce841014cf",
|
|
5051
5098
|
"file": "packages/core/src/lib/services/eui-app-shell.service.ts",
|
|
5052
5099
|
"coverageIgnore": false,
|
|
5053
5100
|
"properties": [
|
|
@@ -5389,8 +5436,8 @@
|
|
|
5389
5436
|
"jsdoctags": [
|
|
5390
5437
|
{
|
|
5391
5438
|
"name": {
|
|
5392
|
-
"pos":
|
|
5393
|
-
"end":
|
|
5439
|
+
"pos": 9112,
|
|
5440
|
+
"end": 9115,
|
|
5394
5441
|
"kind": 80,
|
|
5395
5442
|
"id": 0,
|
|
5396
5443
|
"flags": 16842752,
|
|
@@ -5403,8 +5450,8 @@
|
|
|
5403
5450
|
"deprecated": false,
|
|
5404
5451
|
"deprecationMessage": "",
|
|
5405
5452
|
"tagName": {
|
|
5406
|
-
"pos":
|
|
5407
|
-
"end":
|
|
5453
|
+
"pos": 9106,
|
|
5454
|
+
"end": 9111,
|
|
5408
5455
|
"kind": 80,
|
|
5409
5456
|
"id": 0,
|
|
5410
5457
|
"flags": 16842752,
|
|
@@ -5568,7 +5615,7 @@
|
|
|
5568
5615
|
"deprecationMessage": "",
|
|
5569
5616
|
"description": "",
|
|
5570
5617
|
"rawdescription": "\n",
|
|
5571
|
-
"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 isShrinkHeaderActive?: 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 hasFixedPosition?: boolean;\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 isShrinkHeaderActive: 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 //eslint-disable-next-line @typescript-eslint/no-explicit-any\n setState(nextState: UIState<any, any, any, any>, 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",
|
|
5618
|
+
"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 isShrinkHeaderActive?: 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 hasFixedPosition?: boolean;\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 isShrinkHeaderActive: 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 //eslint-disable-next-line @typescript-eslint/no-explicit-any\n setState(nextState: UIState<any, any, any, any>, 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 if (!this.i18nService) {\n return;\n }\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",
|
|
5572
5619
|
"constructorObj": {
|
|
5573
5620
|
"name": "constructor",
|
|
5574
5621
|
"description": "",
|
|
@@ -29629,6 +29676,38 @@
|
|
|
29629
29676
|
}
|
|
29630
29677
|
]
|
|
29631
29678
|
},
|
|
29679
|
+
{
|
|
29680
|
+
"name": "inlineTemplateUsesDatepicker",
|
|
29681
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
29682
|
+
"ctype": "miscellaneous",
|
|
29683
|
+
"subtype": "function",
|
|
29684
|
+
"coverageIgnore": false,
|
|
29685
|
+
"deprecated": false,
|
|
29686
|
+
"deprecationMessage": "",
|
|
29687
|
+
"rawdescription": "",
|
|
29688
|
+
"description": "",
|
|
29689
|
+
"displayName": "inlineTemplateUsesDatepicker",
|
|
29690
|
+
"args": [
|
|
29691
|
+
{
|
|
29692
|
+
"name": "source",
|
|
29693
|
+
"type": "string",
|
|
29694
|
+
"deprecated": false,
|
|
29695
|
+
"deprecationMessage": ""
|
|
29696
|
+
}
|
|
29697
|
+
],
|
|
29698
|
+
"returnType": "boolean",
|
|
29699
|
+
"jsdoctags": [
|
|
29700
|
+
{
|
|
29701
|
+
"name": "source",
|
|
29702
|
+
"type": "string",
|
|
29703
|
+
"deprecated": false,
|
|
29704
|
+
"deprecationMessage": "",
|
|
29705
|
+
"tagName": {
|
|
29706
|
+
"text": "param"
|
|
29707
|
+
}
|
|
29708
|
+
}
|
|
29709
|
+
]
|
|
29710
|
+
},
|
|
29632
29711
|
{
|
|
29633
29712
|
"name": "isArgumentsChanged",
|
|
29634
29713
|
"file": "packages/core/src/lib/services/store/ngrx_kit.ts",
|
|
@@ -31789,6 +31868,40 @@
|
|
|
31789
31868
|
}
|
|
31790
31869
|
]
|
|
31791
31870
|
},
|
|
31871
|
+
{
|
|
31872
|
+
"name": "migrateEuiDatepicker",
|
|
31873
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
31874
|
+
"ctype": "miscellaneous",
|
|
31875
|
+
"subtype": "function",
|
|
31876
|
+
"coverageIgnore": false,
|
|
31877
|
+
"deprecated": false,
|
|
31878
|
+
"deprecationMessage": "",
|
|
31879
|
+
"rawdescription": "Advisory migration for the eui-datepicker moment-locale breaking change.\n\n`eui-datepicker` no longer bundles the moment locale data (the internal\n`import 'moment/min/locales'` was removed). Apps that relied on the datepicker\nimplicitly registering every moment locale must now import the locales they use\nthemselves, e.g. `import 'moment/locale/fr';`. This schematic cannot know which\nlocales an app needs (and auto-importing all of them would reintroduce the bundle\ncost the change removed), so it only reports the files that use `eui-datepicker`\nand the manual action required.",
|
|
31880
|
+
"description": "<p>Advisory migration for the eui-datepicker moment-locale breaking change.</p>\n<p><code>eui-datepicker</code> no longer bundles the moment locale data (the internal\n<code>import 'moment/min/locales'</code> was removed). Apps that relied on the datepicker\nimplicitly registering every moment locale must now import the locales they use\nthemselves, e.g. <code>import 'moment/locale/fr';</code>. This schematic cannot know which\nlocales an app needs (and auto-importing all of them would reintroduce the bundle\ncost the change removed), so it only reports the files that use <code>eui-datepicker</code>\nand the manual action required.</p>\n",
|
|
31881
|
+
"displayName": "migrateEuiDatepicker",
|
|
31882
|
+
"args": [
|
|
31883
|
+
{
|
|
31884
|
+
"name": "options",
|
|
31885
|
+
"type": "Schema",
|
|
31886
|
+
"deprecated": false,
|
|
31887
|
+
"deprecationMessage": "",
|
|
31888
|
+
"defaultValue": "{}"
|
|
31889
|
+
}
|
|
31890
|
+
],
|
|
31891
|
+
"returnType": "Rule",
|
|
31892
|
+
"jsdoctags": [
|
|
31893
|
+
{
|
|
31894
|
+
"name": "options",
|
|
31895
|
+
"type": "Schema",
|
|
31896
|
+
"deprecated": false,
|
|
31897
|
+
"deprecationMessage": "",
|
|
31898
|
+
"defaultValue": "{}",
|
|
31899
|
+
"tagName": {
|
|
31900
|
+
"text": "param"
|
|
31901
|
+
}
|
|
31902
|
+
}
|
|
31903
|
+
]
|
|
31904
|
+
},
|
|
31792
31905
|
{
|
|
31793
31906
|
"name": "migrateEuiDiscussionThread",
|
|
31794
31907
|
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
@@ -33760,6 +33873,36 @@
|
|
|
33760
33873
|
}
|
|
33761
33874
|
]
|
|
33762
33875
|
},
|
|
33876
|
+
{
|
|
33877
|
+
"name": "nodesContainDatepicker",
|
|
33878
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
33879
|
+
"ctype": "miscellaneous",
|
|
33880
|
+
"subtype": "function",
|
|
33881
|
+
"coverageIgnore": false,
|
|
33882
|
+
"deprecated": false,
|
|
33883
|
+
"deprecationMessage": "",
|
|
33884
|
+
"rawdescription": "",
|
|
33885
|
+
"description": "",
|
|
33886
|
+
"displayName": "nodesContainDatepicker",
|
|
33887
|
+
"args": [
|
|
33888
|
+
{
|
|
33889
|
+
"name": "nodes",
|
|
33890
|
+
"deprecated": false,
|
|
33891
|
+
"deprecationMessage": ""
|
|
33892
|
+
}
|
|
33893
|
+
],
|
|
33894
|
+
"returnType": "boolean",
|
|
33895
|
+
"jsdoctags": [
|
|
33896
|
+
{
|
|
33897
|
+
"name": "nodes",
|
|
33898
|
+
"deprecated": false,
|
|
33899
|
+
"deprecationMessage": "",
|
|
33900
|
+
"tagName": {
|
|
33901
|
+
"text": "param"
|
|
33902
|
+
}
|
|
33903
|
+
}
|
|
33904
|
+
]
|
|
33905
|
+
},
|
|
33763
33906
|
{
|
|
33764
33907
|
"name": "parseSelector",
|
|
33765
33908
|
"file": "packages/core/schematics/add-eui-imports/selector-map.ts",
|
|
@@ -34625,8 +34768,8 @@
|
|
|
34625
34768
|
"coverageIgnore": false,
|
|
34626
34769
|
"deprecated": false,
|
|
34627
34770
|
"deprecationMessage": "",
|
|
34628
|
-
"rawdescription": "Replaces old icon names with new ones in a single line.\
|
|
34629
|
-
"description": "<p>Replaces old icon names with new ones in a single line.\
|
|
34771
|
+
"rawdescription": "Replaces old icon names with new ones in a single line.\nHandles both double-quoted and single-quoted icon values, including\nicon=\"...\" attributes on <eui-icon-svg> element lines.\nSkips import lines and lines that contain eui element tags but no icon attribute.\nReturns true if the line was modified.",
|
|
34772
|
+
"description": "<p>Replaces old icon names with new ones in a single line.\nHandles both double-quoted and single-quoted icon values, including\nicon="..." attributes on <eui-icon-svg> element lines.\nSkips import lines and lines that contain eui element tags but no icon attribute.\nReturns true if the line was modified.</p>\n",
|
|
34630
34773
|
"displayName": "replaceIcons",
|
|
34631
34774
|
"args": [
|
|
34632
34775
|
{
|
|
@@ -35191,6 +35334,38 @@
|
|
|
35191
35334
|
}
|
|
35192
35335
|
]
|
|
35193
35336
|
},
|
|
35337
|
+
{
|
|
35338
|
+
"name": "templateUsesDatepicker",
|
|
35339
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
35340
|
+
"ctype": "miscellaneous",
|
|
35341
|
+
"subtype": "function",
|
|
35342
|
+
"coverageIgnore": false,
|
|
35343
|
+
"deprecated": false,
|
|
35344
|
+
"deprecationMessage": "",
|
|
35345
|
+
"rawdescription": "",
|
|
35346
|
+
"description": "",
|
|
35347
|
+
"displayName": "templateUsesDatepicker",
|
|
35348
|
+
"args": [
|
|
35349
|
+
{
|
|
35350
|
+
"name": "source",
|
|
35351
|
+
"type": "string",
|
|
35352
|
+
"deprecated": false,
|
|
35353
|
+
"deprecationMessage": ""
|
|
35354
|
+
}
|
|
35355
|
+
],
|
|
35356
|
+
"returnType": "boolean",
|
|
35357
|
+
"jsdoctags": [
|
|
35358
|
+
{
|
|
35359
|
+
"name": "source",
|
|
35360
|
+
"type": "string",
|
|
35361
|
+
"deprecated": false,
|
|
35362
|
+
"deprecationMessage": "",
|
|
35363
|
+
"tagName": {
|
|
35364
|
+
"text": "param"
|
|
35365
|
+
}
|
|
35366
|
+
}
|
|
35367
|
+
]
|
|
35368
|
+
},
|
|
35194
35369
|
{
|
|
35195
35370
|
"name": "transformTranslations",
|
|
35196
35371
|
"file": "packages/core/src/lib/services/i18n/i18n-utils.ts",
|
|
@@ -36212,6 +36387,51 @@
|
|
|
36212
36387
|
}
|
|
36213
36388
|
]
|
|
36214
36389
|
},
|
|
36390
|
+
{
|
|
36391
|
+
"name": "visitDir",
|
|
36392
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
36393
|
+
"ctype": "miscellaneous",
|
|
36394
|
+
"subtype": "function",
|
|
36395
|
+
"coverageIgnore": false,
|
|
36396
|
+
"deprecated": false,
|
|
36397
|
+
"deprecationMessage": "",
|
|
36398
|
+
"rawdescription": "",
|
|
36399
|
+
"description": "",
|
|
36400
|
+
"displayName": "visitDir",
|
|
36401
|
+
"args": [
|
|
36402
|
+
{
|
|
36403
|
+
"name": "dir",
|
|
36404
|
+
"type": "DirEntry",
|
|
36405
|
+
"deprecated": false,
|
|
36406
|
+
"deprecationMessage": ""
|
|
36407
|
+
},
|
|
36408
|
+
{
|
|
36409
|
+
"name": "callback",
|
|
36410
|
+
"deprecated": false,
|
|
36411
|
+
"deprecationMessage": ""
|
|
36412
|
+
}
|
|
36413
|
+
],
|
|
36414
|
+
"returnType": "void",
|
|
36415
|
+
"jsdoctags": [
|
|
36416
|
+
{
|
|
36417
|
+
"name": "dir",
|
|
36418
|
+
"type": "DirEntry",
|
|
36419
|
+
"deprecated": false,
|
|
36420
|
+
"deprecationMessage": "",
|
|
36421
|
+
"tagName": {
|
|
36422
|
+
"text": "param"
|
|
36423
|
+
}
|
|
36424
|
+
},
|
|
36425
|
+
{
|
|
36426
|
+
"name": "callback",
|
|
36427
|
+
"deprecated": false,
|
|
36428
|
+
"deprecationMessage": "",
|
|
36429
|
+
"tagName": {
|
|
36430
|
+
"text": "param"
|
|
36431
|
+
}
|
|
36432
|
+
}
|
|
36433
|
+
]
|
|
36434
|
+
},
|
|
36215
36435
|
{
|
|
36216
36436
|
"name": "visitDir",
|
|
36217
36437
|
"file": "packages/core/schematics/migrate-eui-discussion-thread/index.ts",
|
|
@@ -53395,6 +53615,181 @@
|
|
|
53395
53615
|
]
|
|
53396
53616
|
}
|
|
53397
53617
|
],
|
|
53618
|
+
"packages/core/schematics/migrate-eui-datepicker/index.ts": [
|
|
53619
|
+
{
|
|
53620
|
+
"name": "inlineTemplateUsesDatepicker",
|
|
53621
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
53622
|
+
"ctype": "miscellaneous",
|
|
53623
|
+
"subtype": "function",
|
|
53624
|
+
"coverageIgnore": false,
|
|
53625
|
+
"deprecated": false,
|
|
53626
|
+
"deprecationMessage": "",
|
|
53627
|
+
"rawdescription": "",
|
|
53628
|
+
"description": "",
|
|
53629
|
+
"displayName": "inlineTemplateUsesDatepicker",
|
|
53630
|
+
"args": [
|
|
53631
|
+
{
|
|
53632
|
+
"name": "source",
|
|
53633
|
+
"type": "string",
|
|
53634
|
+
"deprecated": false,
|
|
53635
|
+
"deprecationMessage": ""
|
|
53636
|
+
}
|
|
53637
|
+
],
|
|
53638
|
+
"returnType": "boolean",
|
|
53639
|
+
"jsdoctags": [
|
|
53640
|
+
{
|
|
53641
|
+
"name": "source",
|
|
53642
|
+
"type": "string",
|
|
53643
|
+
"deprecated": false,
|
|
53644
|
+
"deprecationMessage": "",
|
|
53645
|
+
"tagName": {
|
|
53646
|
+
"text": "param"
|
|
53647
|
+
}
|
|
53648
|
+
}
|
|
53649
|
+
]
|
|
53650
|
+
},
|
|
53651
|
+
{
|
|
53652
|
+
"name": "migrateEuiDatepicker",
|
|
53653
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
53654
|
+
"ctype": "miscellaneous",
|
|
53655
|
+
"subtype": "function",
|
|
53656
|
+
"coverageIgnore": false,
|
|
53657
|
+
"deprecated": false,
|
|
53658
|
+
"deprecationMessage": "",
|
|
53659
|
+
"rawdescription": "Advisory migration for the eui-datepicker moment-locale breaking change.\n\n`eui-datepicker` no longer bundles the moment locale data (the internal\n`import 'moment/min/locales'` was removed). Apps that relied on the datepicker\nimplicitly registering every moment locale must now import the locales they use\nthemselves, e.g. `import 'moment/locale/fr';`. This schematic cannot know which\nlocales an app needs (and auto-importing all of them would reintroduce the bundle\ncost the change removed), so it only reports the files that use `eui-datepicker`\nand the manual action required.",
|
|
53660
|
+
"description": "<p>Advisory migration for the eui-datepicker moment-locale breaking change.</p>\n<p><code>eui-datepicker</code> no longer bundles the moment locale data (the internal\n<code>import 'moment/min/locales'</code> was removed). Apps that relied on the datepicker\nimplicitly registering every moment locale must now import the locales they use\nthemselves, e.g. <code>import 'moment/locale/fr';</code>. This schematic cannot know which\nlocales an app needs (and auto-importing all of them would reintroduce the bundle\ncost the change removed), so it only reports the files that use <code>eui-datepicker</code>\nand the manual action required.</p>\n",
|
|
53661
|
+
"displayName": "migrateEuiDatepicker",
|
|
53662
|
+
"args": [
|
|
53663
|
+
{
|
|
53664
|
+
"name": "options",
|
|
53665
|
+
"type": "Schema",
|
|
53666
|
+
"deprecated": false,
|
|
53667
|
+
"deprecationMessage": "",
|
|
53668
|
+
"defaultValue": "{}"
|
|
53669
|
+
}
|
|
53670
|
+
],
|
|
53671
|
+
"returnType": "Rule",
|
|
53672
|
+
"jsdoctags": [
|
|
53673
|
+
{
|
|
53674
|
+
"name": "options",
|
|
53675
|
+
"type": "Schema",
|
|
53676
|
+
"deprecated": false,
|
|
53677
|
+
"deprecationMessage": "",
|
|
53678
|
+
"defaultValue": "{}",
|
|
53679
|
+
"tagName": {
|
|
53680
|
+
"text": "param"
|
|
53681
|
+
}
|
|
53682
|
+
}
|
|
53683
|
+
]
|
|
53684
|
+
},
|
|
53685
|
+
{
|
|
53686
|
+
"name": "nodesContainDatepicker",
|
|
53687
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
53688
|
+
"ctype": "miscellaneous",
|
|
53689
|
+
"subtype": "function",
|
|
53690
|
+
"coverageIgnore": false,
|
|
53691
|
+
"deprecated": false,
|
|
53692
|
+
"deprecationMessage": "",
|
|
53693
|
+
"rawdescription": "",
|
|
53694
|
+
"description": "",
|
|
53695
|
+
"displayName": "nodesContainDatepicker",
|
|
53696
|
+
"args": [
|
|
53697
|
+
{
|
|
53698
|
+
"name": "nodes",
|
|
53699
|
+
"deprecated": false,
|
|
53700
|
+
"deprecationMessage": ""
|
|
53701
|
+
}
|
|
53702
|
+
],
|
|
53703
|
+
"returnType": "boolean",
|
|
53704
|
+
"jsdoctags": [
|
|
53705
|
+
{
|
|
53706
|
+
"name": "nodes",
|
|
53707
|
+
"deprecated": false,
|
|
53708
|
+
"deprecationMessage": "",
|
|
53709
|
+
"tagName": {
|
|
53710
|
+
"text": "param"
|
|
53711
|
+
}
|
|
53712
|
+
}
|
|
53713
|
+
]
|
|
53714
|
+
},
|
|
53715
|
+
{
|
|
53716
|
+
"name": "templateUsesDatepicker",
|
|
53717
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
53718
|
+
"ctype": "miscellaneous",
|
|
53719
|
+
"subtype": "function",
|
|
53720
|
+
"coverageIgnore": false,
|
|
53721
|
+
"deprecated": false,
|
|
53722
|
+
"deprecationMessage": "",
|
|
53723
|
+
"rawdescription": "",
|
|
53724
|
+
"description": "",
|
|
53725
|
+
"displayName": "templateUsesDatepicker",
|
|
53726
|
+
"args": [
|
|
53727
|
+
{
|
|
53728
|
+
"name": "source",
|
|
53729
|
+
"type": "string",
|
|
53730
|
+
"deprecated": false,
|
|
53731
|
+
"deprecationMessage": ""
|
|
53732
|
+
}
|
|
53733
|
+
],
|
|
53734
|
+
"returnType": "boolean",
|
|
53735
|
+
"jsdoctags": [
|
|
53736
|
+
{
|
|
53737
|
+
"name": "source",
|
|
53738
|
+
"type": "string",
|
|
53739
|
+
"deprecated": false,
|
|
53740
|
+
"deprecationMessage": "",
|
|
53741
|
+
"tagName": {
|
|
53742
|
+
"text": "param"
|
|
53743
|
+
}
|
|
53744
|
+
}
|
|
53745
|
+
]
|
|
53746
|
+
},
|
|
53747
|
+
{
|
|
53748
|
+
"name": "visitDir",
|
|
53749
|
+
"file": "packages/core/schematics/migrate-eui-datepicker/index.ts",
|
|
53750
|
+
"ctype": "miscellaneous",
|
|
53751
|
+
"subtype": "function",
|
|
53752
|
+
"coverageIgnore": false,
|
|
53753
|
+
"deprecated": false,
|
|
53754
|
+
"deprecationMessage": "",
|
|
53755
|
+
"rawdescription": "",
|
|
53756
|
+
"description": "",
|
|
53757
|
+
"displayName": "visitDir",
|
|
53758
|
+
"args": [
|
|
53759
|
+
{
|
|
53760
|
+
"name": "dir",
|
|
53761
|
+
"type": "DirEntry",
|
|
53762
|
+
"deprecated": false,
|
|
53763
|
+
"deprecationMessage": ""
|
|
53764
|
+
},
|
|
53765
|
+
{
|
|
53766
|
+
"name": "callback",
|
|
53767
|
+
"deprecated": false,
|
|
53768
|
+
"deprecationMessage": ""
|
|
53769
|
+
}
|
|
53770
|
+
],
|
|
53771
|
+
"returnType": "void",
|
|
53772
|
+
"jsdoctags": [
|
|
53773
|
+
{
|
|
53774
|
+
"name": "dir",
|
|
53775
|
+
"type": "DirEntry",
|
|
53776
|
+
"deprecated": false,
|
|
53777
|
+
"deprecationMessage": "",
|
|
53778
|
+
"tagName": {
|
|
53779
|
+
"text": "param"
|
|
53780
|
+
}
|
|
53781
|
+
},
|
|
53782
|
+
{
|
|
53783
|
+
"name": "callback",
|
|
53784
|
+
"deprecated": false,
|
|
53785
|
+
"deprecationMessage": "",
|
|
53786
|
+
"tagName": {
|
|
53787
|
+
"text": "param"
|
|
53788
|
+
}
|
|
53789
|
+
}
|
|
53790
|
+
]
|
|
53791
|
+
}
|
|
53792
|
+
],
|
|
53398
53793
|
"packages/core/src/lib/services/app/eui-pre-init-app.ts": [
|
|
53399
53794
|
{
|
|
53400
53795
|
"name": "loadEuiDynamicEnvironmentConfig",
|
|
@@ -54237,8 +54632,8 @@
|
|
|
54237
54632
|
"coverageIgnore": false,
|
|
54238
54633
|
"deprecated": false,
|
|
54239
54634
|
"deprecationMessage": "",
|
|
54240
|
-
"rawdescription": "Replaces old icon names with new ones in a single line.\
|
|
54241
|
-
"description": "<p>Replaces old icon names with new ones in a single line.\
|
|
54635
|
+
"rawdescription": "Replaces old icon names with new ones in a single line.\nHandles both double-quoted and single-quoted icon values, including\nicon=\"...\" attributes on <eui-icon-svg> element lines.\nSkips import lines and lines that contain eui element tags but no icon attribute.\nReturns true if the line was modified.",
|
|
54636
|
+
"description": "<p>Replaces old icon names with new ones in a single line.\nHandles both double-quoted and single-quoted icon values, including\nicon="..." attributes on <eui-icon-svg> element lines.\nSkips import lines and lines that contain eui element tags but no icon attribute.\nReturns true if the line was modified.</p>\n",
|
|
54242
54637
|
"displayName": "replaceIcons",
|
|
54243
54638
|
"args": [
|
|
54244
54639
|
{
|