Skip to content

Commit fac8658

Browse files
authored
Merge pull request #123 from Sumragen/angular-2-wrapper
#120 added Angular 2 Wrapper
2 parents a8a5c5c + 63284f0 commit fac8658

10 files changed

+165
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2+
.idea
23
.idea

Gruntfile.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,22 @@ module.exports = function (grunt) {
5757
'<%= appConfig.dist %>/angularLocationpicker.jquery.js': ['<%= appConfig.app %>/angularLocationpicker.jquery.js']
5858
}
5959
}
60+
},
61+
copy: {
62+
main: {
63+
expand: true,
64+
cwd: 'src/ngLocationpicker/',
65+
src: '**',
66+
dest: 'dist/ngLocationpicker',
67+
}
6068
}
6169
});
6270

6371
grunt.registerTask('build', [
6472
'clean:dist',
6573
'uglify:minimize',
66-
'uglify:beautify'
74+
'uglify:beautify',
75+
'copy'
6776
]);
6877

6978
};

dist/angularLocationpicker.jquery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jquery-locationpicker - v0.1.15 - 2016-09-26 */
1+
/*! jquery-locationpicker - v0.1.16 - 2017-10-02 */
22
"use strict";
33

44
angular.module("angular-jquery-locationpicker", []).constant("angularJQueryLocationpickerDefaultValue", {

dist/angularLocationpicker.jquery.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/locationpicker.jquery.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jquery-locationpicker - v0.1.15 - 2016-09-26 */
1+
/*! jquery-locationpicker - v0.1.16 - 2017-10-02 */
22
(function($) {
33
function GMapContext(domElement, options) {
44
var _map = new google.maps.Map(domElement, options);
@@ -313,7 +313,7 @@
313313
return;
314314
}
315315
var settings = $.extend({}, $.fn.locationpicker.defaults, options);
316-
var gmapContext = new GMapContext(this, $.extend({}, settings.mapOptions, {
316+
var gmapContext = new GMapContext(this, $.extend({}, {
317317
zoom: settings.zoom,
318318
center: new google.maps.LatLng(settings.location.latitude, settings.location.longitude),
319319
mapTypeId: settings.mapTypeId,
@@ -331,7 +331,7 @@
331331
markerIcon: settings.markerIcon,
332332
markerDraggable: settings.markerDraggable,
333333
markerVisible: settings.markerVisible
334-
}));
334+
}, settings.mapOptions));
335335
$target.data("locationpicker", gmapContext);
336336
function displayMarkerWithSelectedArea() {
337337
GmUtility.setPosition(gmapContext, gmapContext.marker.position, function(context) {

dist/locationpicker.jquery.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/locationpicker.jquery.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import {Component, ElementRef, Input, NgModule, OnInit, Renderer2, ViewChild} from '@angular/core';
2+
import {CommonModule} from '@angular/common';
3+
4+
declare var $: any;
5+
declare var require: any;
6+
7+
@Component({
8+
selector: 'l-locationpicker',
9+
styles: [`
10+
.l-locationpicker-class {
11+
position: relative;
12+
display: inline-block;
13+
overflow: hidden;
14+
width: 700px;
15+
height: 500px;
16+
}
17+
`],
18+
template: `
19+
<div #locationpickerEl>
20+
<div class="locationpicker-loading">Loading</div>
21+
</div>
22+
`
23+
})
24+
export class LocationpickerComponent implements OnInit {
25+
26+
@Input() lSettings: object = {};
27+
28+
@Input() lClass: string = 'l-locationpicker-class';
29+
30+
@ViewChild('locationpickerEl') locationpickerEl: ElementRef;
31+
32+
$picker: any;
33+
34+
constructor(private rd: Renderer2) {
35+
}
36+
37+
ngOnInit() {
38+
require.ensure(['./../locationpicker.jquery.js'], require => {
39+
require('./../locationpicker.jquery.js');
40+
this.$picker = $(this.locationpickerEl.nativeElement).locationpicker(this.lSettings);
41+
this.rd.addClass(this.locationpickerEl.nativeElement, this.lClass)
42+
});
43+
}
44+
45+
getLocation() {
46+
return this.$picker.locationpicker('location');
47+
}
48+
49+
setPosition(position: { radius?: number, latitude: number, longitude: number }) {
50+
this.$picker.locationpicker('location', position);
51+
}
52+
53+
subscribeEvent(event: string, callback: () => void) {
54+
this.$picker.locationpicker('subscribe', {event, callback})
55+
}
56+
57+
getMap() {
58+
return this.$picker.locationpicker('map');
59+
}
60+
61+
autosize() {
62+
this.$picker.locationpicker('autosize');
63+
}
64+
}
65+
66+
@NgModule({
67+
imports: [CommonModule],
68+
declarations: [LocationpickerComponent],
69+
exports: [LocationpickerComponent]
70+
})
71+
export class LocationpickerModule {
72+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-locationpicker",
3-
"version": "0.1.15",
3+
"version": "0.1.16",
44
"keywords": [
55
"jquery-plugin",
66
"googlemap",
@@ -27,6 +27,7 @@
2727
"grunt": "~0.4.5",
2828
"grunt-contrib-clean": "^0.6.0",
2929
"grunt-contrib-concat": "^0.5.0",
30+
"grunt-contrib-copy": "^1.0.0",
3031
"grunt-contrib-uglify": "^0.8.0",
3132
"load-grunt-tasks": "^3.1.0"
3233
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import {Component, ElementRef, Input, NgModule, OnInit, Renderer2, ViewChild} from '@angular/core';
2+
import {CommonModule} from '@angular/common';
3+
4+
declare var $: any;
5+
declare var require: any;
6+
7+
@Component({
8+
selector: 'l-locationpicker',
9+
styles: [`
10+
.l-locationpicker-class {
11+
position: relative;
12+
display: inline-block;
13+
overflow: hidden;
14+
width: 700px;
15+
height: 500px;
16+
}
17+
`],
18+
template: `
19+
<div #locationpickerEl>
20+
<div class="locationpicker-loading">Loading</div>
21+
</div>
22+
`
23+
})
24+
export class LocationpickerComponent implements OnInit {
25+
26+
@Input() lSettings: object = {};
27+
28+
@Input() lClass: string = 'l-locationpicker-class';
29+
30+
@ViewChild('locationpickerEl') locationpickerEl: ElementRef;
31+
32+
$picker: any;
33+
34+
constructor(private rd: Renderer2) {
35+
}
36+
37+
ngOnInit() {
38+
require.ensure(['./../locationpicker.jquery.js'], require => {
39+
require('./../locationpicker.jquery.js');
40+
this.$picker = $(this.locationpickerEl.nativeElement).locationpicker(this.lSettings);
41+
this.rd.addClass(this.locationpickerEl.nativeElement, this.lClass)
42+
});
43+
}
44+
45+
getLocation() {
46+
return this.$picker.locationpicker('location');
47+
}
48+
49+
setPosition(position: { radius?: number, latitude: number, longitude: number }) {
50+
this.$picker.locationpicker('location', position);
51+
}
52+
53+
subscribeEvent(event: string, callback: () => void) {
54+
this.$picker.locationpicker('subscribe', {event, callback})
55+
}
56+
57+
getMap() {
58+
return this.$picker.locationpicker('map');
59+
}
60+
61+
autosize() {
62+
this.$picker.locationpicker('autosize');
63+
}
64+
}
65+
66+
@NgModule({
67+
imports: [CommonModule],
68+
declarations: [LocationpickerComponent],
69+
exports: [LocationpickerComponent]
70+
})
71+
export class LocationpickerModule {
72+
}

0 commit comments

Comments
 (0)