Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 47x 47x 47x 47x 47x 47x 47x 47x | import UIComponent from "sap/ui/core/UIComponent";
import models from "./model/models";
import Device from "sap/ui/Device";
/**
* @namespace de.itsfullofstars.sap.pam
*/
export default class Component extends UIComponent {
public static metadata = {
manifest: "json",
interfaces: ["sap.ui.core.IAsyncContentCreation"]
};
private contentDensityClass: string;
/** Initializes the component: base init, the "device" model, and the router. */
public init(): void {
// call the base component's init function
super.init();
// create the device model
this.setModel(models.createDeviceModel(), "device");
// create the views based on the url/hash
this.getRouter().initialize();
}
/**
* This method can be called to determine whether the sapUiSizeCompact or sapUiSizeCozy
* design mode class should be set, which influences the size appearance of some controls.
* @public
* @returns css class, either 'sapUiSizeCompact' or 'sapUiSizeCozy' - or an empty string if no css class should be set
*/
public getContentDensityClass(): string {
Eif (this.contentDensityClass === undefined) {
// check whether FLP has already set the content density class; do nothing in this case
if (document.body.classList.contains("sapUiSizeCozy") || document.body.classList.contains("sapUiSizeCompact")) {
this.contentDensityClass = "";
} else Eif (!Device.support.touch) {
// apply "compact" mode if touch is not supported
this.contentDensityClass = "sapUiSizeCompact";
} else {
// "cozy" in case of touch support; default for most sap.m controls, but needed for desktop-first controls like sap.ui.table.Table
this.contentDensityClass = "sapUiSizeCozy";
}
}
return this.contentDensityClass;
}
}
|