Gridstack.js: jquery-ui directories wrong in gridstack.js

Created on 18 Aug 2016  ·  4Comments  ·  Source: gridstack/gridstack.js

In jquery-ui 1.12.0, all associate files are moved to ui directory not in root directory. So the following code in gridstack.js is deprecated.

if (typeof define === 'function' && define.amd) {
define(['jquery', 'lodash', 'jquery-ui/data', 'jquery-ui/disable-selection', 'jquery-ui/focusable',
'jquery-ui/form', 'jquery-ui/ie', 'jquery-ui/keycode', 'jquery-ui/labels', 'jquery-ui/jquery-1-7',
'jquery-ui/plugin', 'jquery-ui/safe-active-element', 'jquery-ui/safe-blur', 'jquery-ui/scroll-parent',
'jquery-ui/tabbable', 'jquery-ui/unique-id', 'jquery-ui/version', 'jquery-ui/widget',
'jquery-ui/widgets/mouse', 'jquery-ui/widgets/draggable', 'jquery-ui/widgets/droppable',
'jquery-ui/widgets/resizable'], factory);

It's recommended to use define(['jquery', 'lodash', 'jquery-ui']) to substitute.

Most helpful comment

Redefining alias affects other jQueryUI plugins which are used in the project, if any, which is not acceptable.

All 4 comments

jquery-ui files were in /ui in v.1.11 for jquery-ui installed via bower. By not defining the exact location for jquery-ui in gridstack, we have actually enabled the user to have control.

Your main.js file may look something like this:

require.config({
    paths: {
        'jquery-ui': 'vendor/jquery-ui/ui/'
...

Based on jqui's own page (https://learn.jquery.com/jquery-ui/environments/amd/), this seems like the most suitable solution. If they have updated recommended settings, we are open to changing it, but for now this method continues to suffice for now. I do believe we will update this as more libraries update dependency to newer jqui.

Ok. I get it. Thanks.

原始邮件
发件人:[email protected]
收件人:troolee/gridstack.jsgridstack.[email protected]
抄送:[email protected]; [email protected]
发送时间:2016年8月19日(周五) 04:38
主题:Re: [troolee/gridstack.js] jquery-ui directories wrong ingridstack.js (#513)

jquery-ui files were in /ui in v.1.11 for jquery-ui installed via bower. By not defining the exact location for jquery-ui in gridstack, we have actually enabled the user to have control.
Your main.js file may look something like this:
require.config({ paths: { 'jquery-ui': 'vendor/jquery-ui/ui/' ...
Based on jqui's own page (https://learn.jquery.com/jquery-ui/environments/amd/), this seems like the most suitable solution. If they have updated recommended settings, we are open to changing it, but for now this method continues to suffice for now. I do believe we will update this as more libraries update dependency to newer jqui.

You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

I believe jquery-ui has updated their advice and now recommends the paths in gridstack.jQueryUI.js be changed to include the 'ui' folder.

See the jquery ui 1.12 upgrade guide where they state:

When you're ready to upgrade, you need to update your import paths.

Before:

var autocomplete = require( "jquery-ui/autocomplete" );
After:

var autocomplete = require( "jquery-ui/ui/widgets/autocomplete" );

I tried adding the path alias in my Angular 2 CLI project tsconfig.app.json file, but the angular compiler would then hang:
"baseUrl": "",
"paths":{
"jquery-ui/":["jquery-ui/ui/"]
}

I'm guessing it goes into an infinite recursion loop trying to resolve "jquery-ui". Perhaps there is a better way to add the alias to an Angular 2 CLI project?

Redefining alias affects other jQueryUI plugins which are used in the project, if any, which is not acceptable.

Was this page helpful?
0 / 5 - 0 ratings