All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.prod.InitialConfiguration.js.map Maven / Gradle / Ivy

{
  "version": 3,
  "sources": ["../../src/InitialConfiguration.ts"],
  "sourcesContent": ["import merge from \"./thirdparty/merge.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport { DEFAULT_THEME } from \"./generated/AssetParameters.js\";\nimport validateThemeRoot from \"./validateThemeRoot.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type { FormatSettings } from \"./config/FormatSettings.js\";\nimport AnimationMode from \"./types/AnimationMode.js\";\nimport type CalendarType from \"./types/CalendarType.js\";\n\nlet initialized = false;\n\ntype InitialConfig = {\n\t[key: string]: any,\n\tanimationMode: AnimationMode,\n\ttheme: string,\n\tthemeRoot: string | undefined,\n\tlanguage: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\tsecondaryCalendarType: CalendarType | undefined,\n\ttimezone: string | undefined,\n\tnoConflict: boolean,\n\tformatSettings: FormatSettings,\n\tfetchDefaultLanguage: boolean,\n\tdefaultFontLoading: boolean,\n};\n\nlet initialConfig: InitialConfig = {\n\tanimationMode: AnimationMode.Full,\n\ttheme: DEFAULT_THEME,\n\tthemeRoot: undefined,\n\trtl: undefined,\n\tlanguage: undefined,\n\ttimezone: undefined,\n\tcalendarType: undefined,\n\tsecondaryCalendarType: undefined,\n\tnoConflict: false, // no URL\n\tformatSettings: {},\n\tfetchDefaultLanguage: false,\n\tdefaultFontLoading: true,\n};\n\n/* General settings */\nconst getAnimationMode = () => {\n\tinitConfiguration();\n\treturn initialConfig.animationMode;\n};\n\nconst getTheme = () => {\n\tinitConfiguration();\n\treturn initialConfig.theme;\n};\n\nconst getThemeRoot = () => {\n\tinitConfiguration();\n\treturn initialConfig.themeRoot;\n};\n\nconst getLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.language;\n};\n\n/**\n * Returns if the default language, that is inlined at build time,\n * should be fetched over the network instead.\n * @returns {Boolean}\n */\nconst getFetchDefaultLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.fetchDefaultLanguage;\n};\n\nconst getNoConflict = () => {\n\tinitConfiguration();\n\treturn initialConfig.noConflict;\n};\n\nconst getDefaultFontLoading = () => {\n\tinitConfiguration();\n\treturn initialConfig.defaultFontLoading;\n};\n\n/**\n * Get the configured calendar type\n * @returns { String } the name of the configured calendar type\n */\nconst getCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.calendarType;\n};\n\nconst getSecondaryCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.secondaryCalendarType;\n};\n\n/**\n * Returns the configured IANA timezone ID.\n * @returns { String } the configured IANA timezone ID, e.g. \"America/New_York\"\n */\nconst getTimezone = () => {\n\tinitConfiguration();\n\treturn initialConfig.timezone;\n};\n\nconst getFormatSettings = () => {\n\tinitConfiguration();\n\treturn initialConfig.formatSettings;\n};\n\nconst booleanMapping = new Map();\nbooleanMapping.set(\"true\", true);\nbooleanMapping.set(\"false\", false);\n\nconst parseConfigurationScript = () => {\n\tconst configScript = document.querySelector(\"[data-ui5-config]\") || document.querySelector(\"[data-id='sap-ui-config']\"); // for backward compatibility\n\n\tlet configJSON;\n\n\tif (configScript) {\n\t\ttry {\n\t\t\tconfigJSON = JSON.parse(configScript.innerHTML);\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"Incorrect data-sap-ui-config format. Please use JSON\"); /* eslint-disable-line */\n\t\t}\n\n\t\tif (configJSON) {\n\t\t\tinitialConfig = merge(initialConfig, configJSON);\n\t\t}\n\t}\n};\n\nconst parseURLParameters = () => {\n\tconst params = new URLSearchParams(window.location.search);\n\n\t// Process \"sap-*\" params first\n\tparams.forEach((value, key) => {\n\t\tconst parts = key.split(\"sap-\").length;\n\t\tif (parts === 0 || parts === key.split(\"sap-ui-\").length) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap\");\n\t});\n\n\t// Process \"sap-ui-*\" params\n\tparams.forEach((value, key) => {\n\t\tif (!key.startsWith(\"sap-ui\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap-ui\");\n\t});\n};\n\nconst normalizeThemeRootParamValue = (value: string) => {\n\tconst themeRoot = value.split(\"@\")[1];\n\n\treturn validateThemeRoot(themeRoot);\n};\n\nconst normalizeThemeParamValue = (param: string, value: string) => {\n\tif (param === \"theme\" && value.includes(\"@\")) { // the theme parameter might have @ in the value - strip this\n\t\treturn value.split(\"@\")[0];\n\t}\n\n\treturn value;\n};\n\nconst applyURLParam = (key: string, value: string, paramType: string) => {\n\tconst lowerCaseValue = value.toLowerCase();\n\tconst param = key.split(`${paramType}-`)[1];\n\n\tif (booleanMapping.has(value)) {\n\t\tvalue = booleanMapping.get(lowerCaseValue);\n\t}\n\n\tif (param === \"theme\") {\n\t\tinitialConfig.theme = normalizeThemeParamValue(param, value);\n\n\t\tif (value && value.includes(\"@\")) {\n\t\t\tinitialConfig.themeRoot = normalizeThemeRootParamValue(value);\n\t\t}\n\t} else {\n\t\tinitialConfig[param] = value;\n\t}\n};\n\nconst applyOpenUI5Configuration = () => {\n\tconst openUI5Support = getFeature(\"OpenUI5Support\");\n\tif (!openUI5Support || !openUI5Support.isOpenUI5Detected()) {\n\t\treturn;\n\t}\n\n\tconst OpenUI5Config = openUI5Support.getConfigurationSettingsObject();\n\tinitialConfig = merge(initialConfig, OpenUI5Config);\n};\n\nconst initConfiguration = () => {\n\tif (typeof document === \"undefined\" || initialized) {\n\t\treturn;\n\t}\n\n\t// 1. Lowest priority - configuration script\n\tparseConfigurationScript();\n\n\t// 2. URL parameters overwrite configuration script parameters\n\tparseURLParameters();\n\n\t// 3. If OpenUI5 is detected, it has the highest priority\n\tapplyOpenUI5Configuration();\n\n\tinitialized = true;\n};\n\nexport {\n\tgetAnimationMode,\n\tgetTheme,\n\tgetThemeRoot,\n\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetSecondaryCalendarType,\n\tgetTimez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EAGnBY,EAA0B,EAE1B9B,EAAc,GACf,EAEA,OACCE,KAAA,iBACAE,KAAA,SACAC,KAAA,aACAC,KAAA,YACAC,KAAA,wBACAC,KAAA,cACAE,KAAA,gBACAC,KAAA,yBACAC,KAAA,YACAC,KAAA,kBACAJ,KAAA",
  "names": ["merge", "getFeature", "DEFAULT_THEME", "validateThemeRoot", "AnimationMode", "initialized", "initialConfig", "getAnimationMode", "initConfiguration", "getTheme", "getThemeRoot", "getLanguage", "getFetchDefaultLanguage", "getNoConflict", "getDefaultFontLoading", "getCalendarType", "getSecondaryCalendarType", "getTimezone", "getFormatSettings", "booleanMapping", "parseConfigurationScript", "configScript", "configJSON", "parseURLParameters", "params", "value", "key", "parts", "applyURLParam", "normalizeThemeRootParamValue", "themeRoot", "normalizeThemeParamValue", "param", "paramType", "lowerCaseValue", "applyOpenUI5Configuration", "openUI5Support", "OpenUI5Config"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy