Skip to content

Commit c2a1e1a

Browse files
authored
Merge pull request #1436 from adumesny/develop
attempt at let user bring own jquery libs
2 parents a740945 + 7109f74 commit c2a1e1a

File tree

6 files changed

+20
-9
lines changed

6 files changed

+20
-9
lines changed

karma.conf.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22

33
module.exports = function(config) {
44
config.set({
5+
6+
// see https://www.npmjs.com/package/karma-typescript
57
karmaTypescriptConfig: {
68
compilerOptions: {
79
lib: ['dom', 'es6'],
10+
},
11+
bundlerOptions: {
12+
resolve: {
13+
alias: {
14+
'jquery': './src/jq/jquery.js',
15+
'jquery-ui': './src/jq/jquery-ui.js',
16+
}
17+
}
818
}
919
},
1020

src/gridstack.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export * from './gridstack-engine';
1818
export * from './gridstack-dd';
1919

2020
// TEMPORARY import the jquery-ui drag&drop since we don't have alternative yet and don't expect users to create their own yet
21-
import './jq/gridstack-dd-jqueryui';
2221
export * from './jq/gridstack-dd-jqueryui';
2322

2423
export type GridStackElement = string | HTMLElement | GridItemHTMLElement;

src/jq/gridstack-dd-jqueryui.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ import { GridStack, GridStackElement } from '../gridstack';
1010
import { GridStackDD, DDOpts, DDKey, DDDropOpt, DDCallback, DDValue } from '../gridstack-dd';
1111
import { GridItemHTMLElement, DDDragInOpt } from '../types';
1212

13-
// export all jq symbols see https://stackoverflow.com/questions/35345760/importing-jqueryui-with-typescript-and-requirejs
13+
// export jq symbols see
14+
// https://stackoverflow.com/questions/35345760/importing-jqueryui-with-typescript-and-requirejs
15+
// https://stackoverflow.com/questions/33998262/jquery-ui-and-webpack-how-to-manage-it-into-module
1416
// TODO: let user bring their own jq or jq-ui version
15-
import * as $ from './jquery';
17+
import * as $ from './jquery'; // compile this in... having issues TS/ES6 app would include instead
1618
export { $ };
17-
export * from './jquery-ui';
19+
import './jquery-ui';
1820

1921
/**
2022
* legacy Jquery-ui based drag'n'drop plugin.

src/jq/jquery-ui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
// AMD. Register as an anonymous module.
1212
define([ "jquery" ], factory );
13-
} else */{
13+
} else */ {
1414

1515
// Browser globals
1616
factory( jQuery );

src/jq/jquery.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10861,8 +10861,8 @@ jQuery.noConflict = function( deep ) {
1086110861
// Expose jQuery and $ identifiers, even in AMD
1086210862
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
1086310863
// and CommonJS for browser emulators (#13566)
10864-
//if ( !noGlobal ) { [alain] noGlobal=true when using webpack/TS, yet we compile this in, not AMD load, so always expose
10865-
window.jQuery = window.$ = jQuery;
10864+
//if ( !noGlobal ) { [alain] noGlobal=true when using runing karma test cases, not sure how to run otherwise...
10865+
window.jQuery = window.$ = jQuery;
1086610866
//}
1086710867

1086810868

webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ module.exports = {
2222
resolve: {
2323
extensions: [ '.ts', '.js' ],
2424
alias: {
25-
'jquery': './src/jq/jquery.js',
26-
'jquery-ui': './src/jq/jquery-ui.js',
25+
'jquery': '/src/jq/jquery.js',
26+
'jquery-ui': '/src/jq/jquery-ui.js',
2727
}
2828
},
2929
output: {

0 commit comments

Comments
 (0)