SAPUI import javascript class as library in launchpad - sapui5

I am trying to upload to the SAPUI app a pure java script file that contains 4 classes, I want to use this classes globally on all controllers, at the moment I set the file in manifest, in a local host everything works fine and I can use those classes and their methods,
when I build the project to the launchpad the app does not recognize the class And in the network the file not loaded, I saw that the builder adds "-dbg" to the file name so I changed in manifest, now I see in the network that the file is loaded and still can not use the classes.
manifest:
enter image description here
LocalHost network
enter image description here
use the class in the local host
enter image description here
launchpad network after add in manifest "-dbg" to file name, else it wont load the file.
in lanuchpad:
enter image description here
enter image description here
I can't find how to import those classes . Any ideas?
Thanks and Best regards,
Gal Tager

I would suggest organizing a pure java script file as a module.
For example, there is a project manifest.json
{
"_version": "1.1.0",
"sap.app": {
"_version": "1.1.0",
"id": "com.work.myproject",
"type": "application", ...
a GsIntegration.js file in a project path ./module/GsIntegration.js
the module can be loaded in a control:
sap.ui.define(["sap/ui/core/mvc/Controller", "com/work/GsIntegration"],
function(Controller, GsIntegration) ...

Related

making sure the polymer build process doesn't mess with a dependency of my element

I have built a custom element/web component to load and display Unity generated WebGL content. The web component imports the UnityLoader.js module - and works fine when used within an app served with 'polymer serve'.
However, when I build an app that uses my web component via the Polymer-CLI build process, no errors are given, but when I access a page using my component I always end up with an error from within UnityLoader.js:
"ReferenceError: BabelHelpers is not defined"
If I create the element directly within my app (in other words it is no longer managed by bower) then I can exclude the minification and compilation steps within the build section of my application's polymer.json file and the built version of the app works fine.
"builds": [
{
"preset": "es5-bundled",
"js": {
"compile": {"exclude": ["content/**/*","UnityLoader.js"]},
"minify": {"exclude": ["content/**/*","UnityLoader.js"]}
},
"html": {
"minify": {"exclude": ["content/**/*"]}
}
}
]
I've looked at my application's polymer.json file and I can see that the extraDependecies node contains some dependencies that other web components have placed there:
"extraDependencies": [
"bower_components/webcomponentsjs/*.js",
"!bower_components/webcomponentsjs/gulpfile.js",
"manifest.json",
"bower_components/plastic-image/intersection-observer.js",
"bower_components/ua-parser-js/dist/ua-parser.min.js"
],
I have UnityLoader.js within the extraDependencies of the element's polymer.json but that isn't getting cascaded up to an application that imports/consumes the element - which I guess must be possible as plastic-image and ua-parser-js have done it (I've looked at their bower_components folders and nothing seems obvious - other than the latter is installed as a dependency of the former).
Any ideas on how I can make sure that the UnityLoader.js that my web component uses is not compiled or minified during the build process of an application that consumes it?
I was having a similar issue with firebase-auth.js when making an ES5 build using polymer-cli 1.7.0. There might be a problem when compiling/minifying specific files. I had to roll back to 1.6.0 using npm install -g polymer-cli#1.6.0 to fix the problem.

How do you load just one component when using aurelia-syncfusion-bridge with aurelia-cli

Windows x64
aurelia-syncfusion-bridge 1.0.0
syncfusion-javascript 15.3.26
I would like to use just the grid component and its necessary and optional components but building traces all components.
Per install instructions the plugin is set to syncfusion.useAll() and I did not see any other documentation about changing this setting.
Thanks for your interest in Syncfusion components.
We can use required component by modifying couple of steps followed in the below user guide documentation.
https://help.syncfusion.com/aurelia/getting-started/aurelia-cli-integration
In aurelia_project/aurelia.json file, modify the following lines which was already configured in build.bundles.dependencies. here
{
"name": "aurelia-syncfusion-bridge",
"path": "../node_modules/aurelia-syncfusion-bridge/dist/amd",
"main": "index",
"resources": [
"grid/*.js", // <--- Required files --->
"common/template.js" // Remove this, if template rendering not required
]
}
Register the aurelia-syncfusion-bridge plugin with Aurelia in our main.js file which is in src folder. here.
.plugin('aurelia-syncfusion-bridge', (syncfusion) => syncfusion.ejGrid().ejTemplate());
// Remove ejTemplate(), if template rendering not required
For your convenience, we have prepared sample and attached below.
Sample
How to run.?
Run the below commands in the sample's root location.
npm install
au run --watch
Thanks,
Karthick T

How to exclude certain files from a package managed by jspm and systemjs?

For instance with bower I could do something like this to get only the scss files (excluding js):
{
"dependencies": {
"bootstrap-sass": "~3.3.5"
},
"overrides": {
"bootstrap-sass": {
"main": [
"assets/stylesheets/_bootstrap.scss"
]
}
}
}
I am having an hard time understanding how to do it with systemjs. in the config.js file I guess but even reading the docs I could not figure it out.
My use case is: while developing I am loading Material angular with systemjs but I want to load only the js files, not the css, which I want to manage indenpdently in my scss. Instead systemjs keep loading the file angular-material.css. I just started with systemjs and jspm, hope you can help.
nb: my problem is not related to the jspm build or bundle process but to the development time with these tools.
JSPM supports overrides as well. See https://github.com/jspm/registry/wiki/Configuring-Packages-for-jspm#testing-configuration for configuration options.
Using JSPM overrides you can easily override the main file and directories and files that you need from a module.
Upd. The css dependency is defined in the registry: https://github.com/jspm/registry/blob/974beb8b6520f4c1b3c6373db32ad05da5c82446/package-overrides/github/angular/bower-material%400.4.0.json It needs to be overwritten with the local override.

No main manifest attribute, in itextpdf-5.5.5.jar file

I'm trying to use the "Itext" applications. I've downloaded the "jar" file from http://sourceforge.net/projects/itext/ and trying to launch the file: itextpdf-5.5.5.jar but get an error:
"no main manifest attribute, in itextpdf-5.5.5.jar"
Could you please help me and explain how can I launch it? It seems that there is no declared main class in the manifest.

Adding a custom library as a dependency in SAP Fiori

I have a custom library com.foo.library I would like to include as a dependency of a Fiori-like app I have built.
SAP Fiori Launchpad for Developers -> Best Practices for Launchpad Apps
Declare configuration information, like the location of icons, and library dependencies in the component.js configuration file
makes sense, adding my library as a dependency would look like
dependencies: {
libs: ["sap.m", "sap.ui.layout", "com.foo.library"],
components: []
},
with Fiori you have the constraint that you must use relative paths.
eg for my dependency to work it must be found at
/resources/com/foo/library
What are the steps for uploading a custom library into the ABAP SAPUI5 Repository and having it served with a relative path?
EDIT:
Currently i have the library loaded on Component.init using
sap.ui.getCore().loadLibrary("com.foo.library", "absolute path to library");
it works, however I want to set the library as a dependency
ComponentMetadata.prototype._loadDependencies = function() {
..
if (aLibraries) {
jQuery.each(aLibraries, function(i, sLib) {
jQuery.sap.log.info("Component \"" + that.getName() +
sap.ui.getCore().loadLibrary(sLib);
});
}
from code above I can see there is no option to pass in a url when the component loads the library dependencies, so i am assuming that the library has to be found relative to the resources
In your Fiori App:
Put your dependencie into the app descriptor (manifest.json) (or if no app descriptor used into the config inside the Component.js)
dependencies: {
libs: ["sap.m", "sap.ui.layout", "com.foo.library"],
components: [com.foo.component]
}
Let sap.ui.core know where to search for the namespace of your library.(Top of your Component.js)
jQuery.sap.registerModulePath("com.foo", "/Path/on/the/server/");
And now you can use your dependencies. And here is why:
Before a module is loaded, the longest registered prefix of its module
name is searched for and the associated URL prefix is used as a prefix
for the request URL. The remainder of the module name is attached to
the request URL by replacing dots ('.') with slashes ('/').
The registration and search operates on full name segments only.
Source: SAP UI5 API Documentation