UNPKG

@pnp/spfx-controls-react

Version:

Reusable React controls for SharePoint Framework solutions

50 lines 2.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initializeAdaptiveCardHost = void 0; var sp_core_library_1 = require("@microsoft/sp-core-library"); var fluentUIThemes_1 = require("../../common/fluentUIThemes"); var HostCapability_1 = require("./fluentUI/HostCapability"); var HostConfig_1 = require("./fluentUI/HostConfig"); var Styles_1 = require("./fluentUI/Styles"); var AdaptiveCardHostThemeType_1 = require("./models/AdaptiveCardHostThemeType"); var initializeAdaptiveCardHost = function (themeType, currentTheme) { var hostConfigResult; switch (themeType) { case AdaptiveCardHostThemeType_1.AdaptiveCardHostThemeType.SharePoint: hostConfigResult = { theme: currentTheme, hostConfig: (0, HostConfig_1.createSharePointHostConfig)(currentTheme) }; break; case AdaptiveCardHostThemeType_1.AdaptiveCardHostThemeType.Teams: hostConfigResult = { theme: fluentUIThemes_1.fluentUITeamsDefaultTheme, hostConfig: (0, HostConfig_1.createDefaultTeamsHostConfig)(fluentUIThemes_1.fluentUITeamsDefaultTheme) }; break; case AdaptiveCardHostThemeType_1.AdaptiveCardHostThemeType.TeamsDark: hostConfigResult = { theme: fluentUIThemes_1.fluentUITeamsDarkTheme, hostConfig: (0, HostConfig_1.createDarkTeamsHostConfig)(fluentUIThemes_1.fluentUITeamsDarkTheme) }; break; case AdaptiveCardHostThemeType_1.AdaptiveCardHostThemeType.TeamsHighContrast: hostConfigResult = { theme: fluentUIThemes_1.fluentUITeamsHighContrastTheme, hostConfig: (0, HostConfig_1.createHighContrastTeamsHostConfig)(fluentUIThemes_1.fluentUITeamsHighContrastTheme) }; break; default: hostConfigResult = { theme: currentTheme, hostConfig: (0, HostConfig_1.createSharePointHostConfig)(currentTheme) }; break; } hostConfigResult.hostConfig.cssClassNamePrefix = "ach".concat(sp_core_library_1.Text.replaceAll(Math.random().toString(), ".", "")); (0, HostCapability_1.setFluentUIThemeAsHostCapability)(hostConfigResult.hostConfig, hostConfigResult.theme); (0, Styles_1.applyAdaptiveCardHostStyles)(hostConfigResult.theme, hostConfigResult.hostConfig.cssClassNamePrefix); return hostConfigResult; }; exports.initializeAdaptiveCardHost = initializeAdaptiveCardHost; //# sourceMappingURL=AdaptiveCardHost.HostConfig.js.map