Skip to content

Commit 7c1c0ca

Browse files
committed
Bumping to v2.1.0
1 parent 341d727 commit 7c1c0ca

8 files changed

+40
-28
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-color-picker",
33
"description": "Color Picker Directive For AngularJS",
4-
"version": "2.0.0",
4+
"version": "2.1.0",
55
"homepage": "https://github.com/ruhley/angular-color-picker",
66
"repository": {
77
"type": "git",

dist/angularjs-color-picker.css

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/angularjs-color-picker.js

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*!
2-
* angularjs-color-picker v2.0.0
2+
* angularjs-color-picker v2.1.0
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2016 ruhley
66
*
7-
* 2016-07-11 16:31:21
7+
* 2016-07-13 08:32:24
88
*
99
*/
1010

@@ -100,7 +100,7 @@
100100
_this.$document.off('mouseup', _this.onMouseUp);
101101
_this.$document.off('mousemove', _this.onMouseMove);
102102

103-
_this.callApiFunction('onDestroy');
103+
_this.eventApiDispatch('onDestroy');
104104
});
105105

106106
//---------------------------
@@ -178,7 +178,7 @@
178178
this.api = {};
179179
}
180180

181-
this.api.open = function () {
181+
this.api.open = function (event) {
182182
// if already visible then don't run show again
183183
if (_this4.visible) {
184184
return true;
@@ -195,7 +195,7 @@
195195
_this4.lightnessUpdate();
196196
_this4.opacityUpdate();
197197

198-
_this4.callApiFunction('onOpen');
198+
_this4.eventApiDispatch('onOpen', [event]);
199199
};
200200

201201
this.api.close = function () {
@@ -204,9 +204,13 @@
204204
_this4.visible = false;
205205
_this4.$scope.$apply();
206206

207-
_this4.callApiFunction('onClose');
207+
_this4.eventApiDispatch('onClose', [event]);
208208
}
209209
};
210+
211+
this.api.getElement = function () {
212+
return _this4.$element;
213+
};
210214
}
211215
}, {
212216
key: 'reInit',
@@ -278,7 +282,7 @@
278282
value: function onMouseUp(event) {
279283
// no current mouse events and not an element in the picker
280284
if (!this.colorMouse && !this.hueMouse && !this.opacityMouse && this.find(event.target).length === 0) {
281-
this.api.close();
285+
this.api.close(event);
282286
// mouse event on color grid
283287
} else if (this.colorMouse) {
284288
this.colorUp(event);
@@ -346,7 +350,7 @@
346350
if (this.ngModel !== this.onChangeValue) {
347351
this.onChangeValue = this.ngModel;
348352

349-
this.callApiFunction('onChange', [event, this.ngModel]);
353+
this.eventApiDispatch('onChange', [event]);
350354
}
351355
}
352356
}, {
@@ -357,7 +361,7 @@
357361
this.update();
358362
}
359363

360-
this.callApiFunction('onBlur', [event, this.ngModel]);
364+
this.eventApiDispatch(this.api, 'onBlur', [event]);
361365
}
362366
}, {
363367
key: 'initConfig',
@@ -723,10 +727,17 @@
723727
//---------------------------
724728

725729
}, {
726-
key: 'callApiFunction',
727-
value: function callApiFunction(name, args) {
728-
if (this.api && typeof this.api[name] === 'function') {
729-
this.api[name].apply(this, args);
730+
key: 'eventApiDispatch',
731+
value: function eventApiDispatch(name, args) {
732+
if (this.eventApi && typeof this.eventApi[name] === 'function') {
733+
if (!args) {
734+
args = [];
735+
}
736+
737+
args.unshift(this.ngModel);
738+
args.unshift(this.api);
739+
740+
this.eventApi[name].apply(this, args);
730741
}
731742
}
732743

@@ -819,7 +830,8 @@
819830
scope: {
820831
ngModel: '=',
821832
options: '=?',
822-
api: '=?'
833+
api: '=?',
834+
eventApi: '=?'
823835
},
824836
bindToController: true,
825837
templateUrl: 'template/color-picker/directive.html',
@@ -832,7 +844,7 @@
832844
}
833845

834846
function template($templateCache) {
835-
$templateCache.put('template/color-picker/directive.html', '<div class="color-picker-wrapper" ng-class="{\n' + '\'color-picker-disabled\': AngularColorPickerController.options.disabled,\n' + '\'color-picker-swatch-only\': AngularColorPickerController.options.swatchOnly,\n' + '}">\n' + ' <div class="color-picker-input-wrapper" ng-class="{\'input-group\': AngularColorPickerController.options.swatchBootstrap && AngularColorPickerController.options.swatch}">\n' + ' <span ng-if="AngularColorPickerController.options.swatchPos === \'left\'" class="color-picker-swatch" ng-click="AngularColorPickerController.focus()" ng-show="AngularColorPickerController.options.swatch" ng-class="{\'color-picker-swatch-left\': AngularColorPickerController.options.swatchPos !== \'right\', \'color-picker-swatch-right\': AngularColorPickerController.options.swatchPos === \'right\', \'input-group-addon\': AngularColorPickerController.options.swatchBootstrap}"></span>\n' + ' <input class="color-picker-input form-control" type="text" ng-model="AngularColorPickerController.ngModel" ng-readonly="AngularColorPickerController.options.swatchOnly" ng-disabled="AngularColorPickerController.options.disabled" ng-blur="AngularColorPickerController.onBlur($event)" ng-change="AngularColorPickerController.onChange($event)" size="7" ng-focus="AngularColorPickerController.api.open()" ng-class="{\'color-picker-input-swatch\': AngularColorPickerController.options.swatch && !AngularColorPickerController.options.swatchOnly && AngularColorPickerController.options.swatchPos === \'left\'}">\n' + ' <span ng-if="AngularColorPickerController.options.swatchPos === \'right\'" class="color-picker-swatch" ng-click="AngularColorPickerController.focus()" ng-show="AngularColorPickerController.options.swatch" ng-class="{\'color-picker-swatch-left\': AngularColorPickerController.options.swatchPos !== \'right\', \'color-picker-swatch-right\': AngularColorPickerController.options.swatchPos === \'right\', \'input-group-addon\': AngularColorPickerController.options.swatchBootstrap}"></span>\n' + ' </div>\n' + ' <div class="color-picker-panel" ng-show="AngularColorPickerController.visible" ng-class="{\n' + ' \'color-picker-panel-top color-picker-panel-right\': AngularColorPickerController.options.pos === \'top right\',\n' + ' \'color-picker-panel-top color-picker-panel-left\': AngularColorPickerController.options.pos === \'top left\',\n' + ' \'color-picker-panel-bottom color-picker-panel-right\': AngularColorPickerController.options.pos === \'bottom right\',\n' + ' \'color-picker-panel-bottom color-picker-panel-left\': AngularColorPickerController.options.pos === \'bottom left\',\n' + ' \'color-picker-show-alpha\': AngularColorPickerController.options.alpha && AngularColorPickerController.options.format !== \'hex\',\n' + ' \'color-picker-show-inline\': AngularColorPickerController.options.inline,\n' + ' }">\n' + ' <div class="color-picker-row">\n' + ' <div class="color-picker-grid color-picker-sprite">\n' + ' <div class="color-picker-grid-inner"></div>\n' + ' <div class="color-picker-picker">\n' + ' <div></div>\n' + ' </div>\n' + ' </div>\n' + ' <div class="color-picker-hue color-picker-sprite">\n' + ' <div class="color-picker-slider"></div>\n' + ' </div>\n' + ' <div class="color-picker-opacity color-picker-sprite" ng-show="AngularColorPickerController.options.alpha && AngularColorPickerController.options.format !== \'hex\'">\n' + ' <div class="color-picker-slider"></div>\n' + ' </div>\n' + ' </div>\n' + ' </div>\n' + '</div>');
847+
$templateCache.put('template/color-picker/directive.html', '<div class="color-picker-wrapper" ng-class="{\n' + '\'color-picker-disabled\': AngularColorPickerController.options.disabled,\n' + '\'color-picker-swatch-only\': AngularColorPickerController.options.swatchOnly,\n' + '}">\n' + ' <div class="color-picker-input-wrapper" ng-class="{\'input-group\': AngularColorPickerController.options.swatchBootstrap && AngularColorPickerController.options.swatch}">\n' + ' <span ng-if="AngularColorPickerController.options.swatchPos === \'left\'" class="color-picker-swatch" ng-click="AngularColorPickerController.focus()" ng-show="AngularColorPickerController.options.swatch" ng-class="{\'color-picker-swatch-left\': AngularColorPickerController.options.swatchPos !== \'right\', \'color-picker-swatch-right\': AngularColorPickerController.options.swatchPos === \'right\', \'input-group-addon\': AngularColorPickerController.options.swatchBootstrap}"></span>\n' + ' <input class="color-picker-input form-control" type="text" ng-model="AngularColorPickerController.ngModel" ng-readonly="AngularColorPickerController.options.swatchOnly" ng-disabled="AngularColorPickerController.options.disabled" ng-blur="AngularColorPickerController.onBlur($event)" ng-change="AngularColorPickerController.onChange($event)" size="7" ng-focus="AngularColorPickerController.api.open($event)" ng-class="{\'color-picker-input-swatch\': AngularColorPickerController.options.swatch && !AngularColorPickerController.options.swatchOnly && AngularColorPickerController.options.swatchPos === \'left\'}">\n' + ' <span ng-if="AngularColorPickerController.options.swatchPos === \'right\'" class="color-picker-swatch" ng-click="AngularColorPickerController.focus()" ng-show="AngularColorPickerController.options.swatch" ng-class="{\'color-picker-swatch-left\': AngularColorPickerController.options.swatchPos !== \'right\', \'color-picker-swatch-right\': AngularColorPickerController.options.swatchPos === \'right\', \'input-group-addon\': AngularColorPickerController.options.swatchBootstrap}"></span>\n' + ' </div>\n' + ' <div class="color-picker-panel" ng-show="AngularColorPickerController.visible" ng-class="{\n' + ' \'color-picker-panel-top color-picker-panel-right\': AngularColorPickerController.options.pos === \'top right\',\n' + ' \'color-picker-panel-top color-picker-panel-left\': AngularColorPickerController.options.pos === \'top left\',\n' + ' \'color-picker-panel-bottom color-picker-panel-right\': AngularColorPickerController.options.pos === \'bottom right\',\n' + ' \'color-picker-panel-bottom color-picker-panel-left\': AngularColorPickerController.options.pos === \'bottom left\',\n' + ' \'color-picker-show-alpha\': AngularColorPickerController.options.alpha && AngularColorPickerController.options.format !== \'hex\',\n' + ' \'color-picker-show-inline\': AngularColorPickerController.options.inline,\n' + ' }">\n' + ' <div class="color-picker-row">\n' + ' <div class="color-picker-grid color-picker-sprite">\n' + ' <div class="color-picker-grid-inner"></div>\n' + ' <div class="color-picker-picker">\n' + ' <div></div>\n' + ' </div>\n' + ' </div>\n' + ' <div class="color-picker-hue color-picker-sprite">\n' + ' <div class="color-picker-slider"></div>\n' + ' </div>\n' + ' <div class="color-picker-opacity color-picker-sprite" ng-show="AngularColorPickerController.options.alpha && AngularColorPickerController.options.format !== \'hex\'">\n' + ' <div class="color-picker-slider"></div>\n' + ' </div>\n' + ' </div>\n' + ' </div>\n' + '</div>');
836848
}
837849
template.$inject = ['$templateCache'];
838850

dist/angularjs-color-picker.min.css

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/angularjs-color-picker.min.js

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

dist/themes/angularjs-color-picker-bootstrap.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*!
2-
* angularjs-color-picker v2.0.0
2+
* angularjs-color-picker v2.1.0
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2016 ruhley
66
*
7-
* 2016-07-11 16:31:23
7+
* 2016-07-13 08:32:26
88
*
99
*/
1010
.color-picker-wrapper .color-picker-input-wrapper {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*!
2-
* angularjs-color-picker v2.0.0
2+
* angularjs-color-picker v2.1.0
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2016 ruhley
66
*
7-
* 2016-07-11 16:31:23
7+
* 2016-07-13 08:32:26
88
*
99
*/.color-picker-wrapper .color-picker-input-wrapper{width:100%}.color-picker-wrapper .color-picker-swatch:not(.input-group-addon){height:28px}.color-picker-wrapper.color-picker-swatch-only .input-group .input-group-addon{border-radius:4px}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angularjs-color-picker",
33
"description": "Color Picker Directive For AngularJS",
4-
"version": "2.0.0",
4+
"version": "2.1.0",
55
"license": "MIT",
66
"main": "dist/angularjs-color-picker.min.js",
77
"dependencies": {

0 commit comments

Comments
 (0)