-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(framework): OpenUI5 integration (#1138)
- Loading branch information
1 parent
b1459ce
commit 5527990
Showing
49 changed files
with
267 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { registerFeature } from "../FeaturesRegistry.js"; | ||
import { setTheme } from "../config/Theme.js"; | ||
|
||
const sap = window.sap; | ||
const core = sap && sap.ui && typeof sap.ui.getCore === "function" && sap.ui.getCore(); | ||
|
||
const isLoaded = () => { | ||
return !!core; | ||
}; | ||
|
||
const init = () => { | ||
if (!core) { | ||
return Promise.resolve(); | ||
} | ||
|
||
return new Promise(resolve => { | ||
core.attachInit(() => { | ||
sap.ui.require(["sap/ui/core/LocaleData"], resolve); | ||
}); | ||
}); | ||
}; | ||
|
||
const getConfigurationSettingsObject = () => { | ||
if (!core) { | ||
return; | ||
} | ||
|
||
const config = core.getConfiguration(); | ||
const LocaleData = sap.ui.require("sap/ui/core/LocaleData"); | ||
|
||
return { | ||
animationMode: config.getAnimationMode(), | ||
language: config.getLanguage(), | ||
theme: config.getTheme(), | ||
rtl: config.getRTL(), | ||
calendarType: config.getCalendarType(), | ||
formatSettings: { | ||
firstDayOfWeek: LocaleData.getInstance(config.getLocale()).getFirstDayOfWeek(), | ||
}, | ||
}; | ||
}; | ||
|
||
const getLocaleDataObject = () => { | ||
if (!core) { | ||
return; | ||
} | ||
|
||
const config = core.getConfiguration(); | ||
const LocaleData = sap.ui.require("sap/ui/core/LocaleData"); | ||
return LocaleData.getInstance(config.getLocale()).mData; | ||
}; | ||
|
||
const listenForThemeChange = () => { | ||
const config = core.getConfiguration(); | ||
core.attachThemeChanged(async () => { | ||
await setTheme(config.getTheme()); | ||
}); | ||
}; | ||
|
||
const attachListeners = () => { | ||
if (!core) { | ||
return; | ||
} | ||
|
||
listenForThemeChange(); | ||
}; | ||
|
||
const OpenUI5Support = { | ||
isLoaded, | ||
init, | ||
getConfigurationSettingsObject, | ||
getLocaleDataObject, | ||
attachListeners, | ||
}; | ||
|
||
registerFeature("OpenUI5Support", OpenUI5Support); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.