0

Environment :

Framework : SAPUI5 V1.38
IDE : SAP WEB IDE

Problem :

I would like to use this like to use this 3rd party https://seballot.github.io/spectrum/ in my SAPUI5 Application (there is not yet colorPicker standard component in V1.38), and this use jQuery, how can I load these ressources properly in SAPUI5 (if possible in Manifest.json or Component.js) ?

My try :

In manifest.json:

"resources": {
    "js": [
        {
            "uri": "https://cdn.jsdelivr.net/npm/spectrum-colorpicker2@2.0.0/dist/spectrum.min.js"
        },
        {
            "uri": "https://code.jquery.com/jquery-3.5.1.min.js"
        }
    ],
    "css": [
        {
            "uri": "css/style.css"
        },
        {
            "uri": "css/style_default.css"
        },
        {
            "uri": "https://cdn.jsdelivr.net/npm/spectrum-colorpicker2@2.0.0/dist/spectrum.min.css"
        }
    ]
},

This is not working (as the path are not a relative, they are CDN).
I would like an API/CDN solution as I which also to link Google Map API and reCaptcha V2.0

SylwekFr
  • 308
  • 3
  • 21
  • Have you tried downloading the source files for colorpicker? Go to that URL in a web browser and download the css and Javascript files and place them in the local directory. You shouldn't need to do this with jQuery as SAPUI5 already contains jQuery. – orogers Jun 10 '20 at 10:04
  • Thank you @orogers for your reply however I would prefer a way with CDN if their ks on as for example the project also contain CSS, also I would like to use for example Google Maps and ReCaptcha and I cannot download the source in this case – SylwekFr Jun 13 '20 at 07:06
  • About the color picker: have you considered using [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color) instead? Might be a good option to take advantage of the existing native HTML control instead of adding a 3rd party lib - unless your target browser is IE which doesn't support `type="color"` – Boghyon Hoffmann Jun 15 '20 at 09:46
  • thank you @BoghyonHoffmann, I didn't though about it however the application should be compliant also with IE 11 – SylwekFr Jun 15 '20 at 10:14

1 Answers1

0

Download all you resources, put them into your project and then include in a manifest.json like:

    "resources": {
        "js": [
            {
                "uri": "js/sourceCode.js"
            }
        ]
    },
Petr Bečka
  • 774
  • 3
  • 16
  • 39
  • Technically it is a solution but I would like to use the solution as an API, here I put the example of a color picker but in this same code I wish to use Google Map API and Google reCaptcha V2.0, and I cannot (or don't know how to) get the source of those – SylwekFr Jun 13 '20 at 07:08