angularjs-color-picker
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "angular-color-picker", | ||
"description": "Color Picker Directive For AngularJS", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"homepage": "https://github.com/ruhley/angular-color-picker", | ||
@@ -6,0 +6,0 @@ "repository": { |
/*! | ||
* angularjs-color-picker v1.1.1 | ||
* angularjs-color-picker v1.1.2 | ||
* https://github.com/ruhley/angular-color-picker/ | ||
@@ -7,3 +7,3 @@ * | ||
* | ||
* 2016-05-06 09:41:26 | ||
* 2016-05-18 10:16:06 | ||
* | ||
@@ -166,4 +166,6 @@ */ | ||
$scope.onBlur = function() { | ||
$scope.updateModel = true; | ||
$scope.update(); | ||
if ($scope.ngModel !== $scope.onChangeValue) { | ||
$scope.updateModel = true; | ||
$scope.update(); | ||
} | ||
}; | ||
@@ -195,2 +197,7 @@ | ||
$scope.show = function () { | ||
// if already visible then don't run show again | ||
if ($scope.visible) { | ||
return true; | ||
} | ||
$scope.log('Color Picker: Show Event'); | ||
@@ -197,0 +204,0 @@ $scope.visible = true; |
/*! | ||
* angularjs-color-picker v1.1.1 | ||
* angularjs-color-picker v1.1.2 | ||
* https://github.com/ruhley/angular-color-picker/ | ||
@@ -7,3 +7,3 @@ * | ||
* | ||
* 2016-05-06 09:41:26 | ||
* 2016-05-18 10:16:06 | ||
* | ||
@@ -25,5 +25,7 @@ */ | ||
// mouse event on color grid | ||
c.colorMouse?(c.colorChange(a),c.$apply()):c.hueMouse?(c.hueChange(a),c.$apply()):c.opacityMouse&&(c.opacityChange(a),c.$apply())},c.onColorClick=function(a){c.config.disabled||(c.colorChange(a),c.$apply(),c.onChange(a))},c.onHueClick=function(a){c.config.disabled||(c.hueChange(a),c.$apply(),c.onChange(a))},c.onOpacityClick=function(a){c.config.disabled||(c.opacityChange(a),c.$apply(),c.onChange(a))},c.onChange=function(a){c.ngModel!==c.onChangeValue&&(c.onChangeValue=c.ngModel,c.colorPickerOnChange({$event:a,color:c.ngModel}))},c.onBlur=function(){c.updateModel=!0,c.update()},c.initConfig=function(){c.config={},c.config.disabled=void 0===c.colorPickerDisabled?!1:c.colorPickerDisabled,c.config.alpha=void 0===c.colorPickerAlpha?!0:c.colorPickerAlpha,c.config.case=void 0===c.colorPickerCase?"upper":c.colorPickerCase,c.config.format=void 0===c.colorPickerFormat?"hsl":c.colorPickerFormat,c.config.pos=void 0===c.colorPickerPos?"bottom left":c.colorPickerPos,c.config.swatch=void 0===c.colorPickerSwatch?!0:c.colorPickerSwatch,c.config.swatchOnly=void 0===c.colorPickerSwatchOnly?!1:c.colorPickerSwatchOnly,c.config.swatchPos=void 0===c.colorPickerSwatchPos?"left":c.colorPickerSwatchPos,c.config.swatchBootstrap=void 0===c.colorPickerSwatchBootstrap?!0:c.colorPickerSwatchBootstrap,c.config.inline=void 0===c.colorPickerInline?!1:c.colorPickerInline,c.visible=c.config.inline,c.log("Color Picker: Config",c.config)},c.focus=function(){c.log("Color Picker: Focus Event"),c.find(".color-picker-input")[0].focus()},c.show=function(){c.log("Color Picker: Show Event"),c.visible=!0,c.hueMouse=!1,c.opacityMouse=!1,c.colorMouse=!1, | ||
c.colorMouse?(c.colorChange(a),c.$apply()):c.hueMouse?(c.hueChange(a),c.$apply()):c.opacityMouse&&(c.opacityChange(a),c.$apply())},c.onColorClick=function(a){c.config.disabled||(c.colorChange(a),c.$apply(),c.onChange(a))},c.onHueClick=function(a){c.config.disabled||(c.hueChange(a),c.$apply(),c.onChange(a))},c.onOpacityClick=function(a){c.config.disabled||(c.opacityChange(a),c.$apply(),c.onChange(a))},c.onChange=function(a){c.ngModel!==c.onChangeValue&&(c.onChangeValue=c.ngModel,c.colorPickerOnChange({$event:a,color:c.ngModel}))},c.onBlur=function(){c.ngModel!==c.onChangeValue&&(c.updateModel=!0,c.update())},c.initConfig=function(){c.config={},c.config.disabled=void 0===c.colorPickerDisabled?!1:c.colorPickerDisabled,c.config.alpha=void 0===c.colorPickerAlpha?!0:c.colorPickerAlpha,c.config.case=void 0===c.colorPickerCase?"upper":c.colorPickerCase,c.config.format=void 0===c.colorPickerFormat?"hsl":c.colorPickerFormat,c.config.pos=void 0===c.colorPickerPos?"bottom left":c.colorPickerPos,c.config.swatch=void 0===c.colorPickerSwatch?!0:c.colorPickerSwatch,c.config.swatchOnly=void 0===c.colorPickerSwatchOnly?!1:c.colorPickerSwatchOnly,c.config.swatchPos=void 0===c.colorPickerSwatchPos?"left":c.colorPickerSwatchPos,c.config.swatchBootstrap=void 0===c.colorPickerSwatchBootstrap?!0:c.colorPickerSwatchBootstrap,c.config.inline=void 0===c.colorPickerInline?!1:c.colorPickerInline,c.visible=c.config.inline,c.log("Color Picker: Config",c.config)},c.focus=function(){c.log("Color Picker: Focus Event"),c.find(".color-picker-input")[0].focus()},c.show=function(){ | ||
// if already visible then don't run show again | ||
// if already visible then don't run show again | ||
// force the grid selection circle to redraw and fix its position | ||
c.saturationUpdate(),c.lightnessUpdate()},c.hide=function(){c.config.inline||!c.visible&&null===d[0].querySelector(".color-picker-panel").offsetParent||(c.log("Color Picker: Hide Event"),c.visible=!1,c.$apply())},c.setDefaults=function(){void 0===c.hue&&(c.hue=0),void 0===c.saturation&&(c.saturation=0),void 0===c.lightness&&(c.lightness=100),void 0===c.opacity&&(c.opacity=100)},c.update=function(){if(void 0===c.hue&&void 0===c.saturation&&void 0===c.lightness)return!1;c.setDefaults();var a,b=tinycolor({h:c.hue,s:c.saturation/100,v:c.lightness/100});switch(c.config.alpha&&b.setAlpha(c.opacity/100),c.log("Color Picker: COLOR CHANGED TO ",b,c.hue,c.saturation,c.lightness,c.opacity),c.swatchColor=b.toHslString(),c.config.format){case"rgb":a=b.toRgbString();break;case"hex":a=b.toHexString(),a="lower"===c.config.case?a.toLowerCase():a.toUpperCase();break;case"hex8":a=b.toHex8String(),a="lower"===c.config.case?a.toLowerCase():a.toUpperCase();break;case"hsv":a=b.toHsvString();break;default:a=b.toHslString()}c.updateModel&&(c.ngModel=a)},c.updateSwatchBackground=function(){var a=angular.element(d[0].querySelector(".color-picker-swatch"));a.css({"background-color":c.swatchColor})},c.$watch("ngModel",function(a,d){if(void 0!==a&&null!==a&&a!==d&&a.length>4){c.log("Color Picker: MODEL - CHANGED",a);var g=tinycolor(a);if(g.isValid()){var h=g.toHsv();c.updateModel=!1,c.hue=h.h,c.saturation=100*h.s,c.lightness=100*h.v,c.config.alpha&&(c.opacity=100*h.a),b(function(){c.updateModel=!0}),c.isValid=!0}else c.isValid=!1;f[0].$setValidity(e.name,c.isValid),void 0!==d&&"function"==typeof f[0].$setDirty&&f[0].$setDirty()}else null!==a&&""!==a||(c.hue=void 0,c.saturation=void 0,c.lightness=void 0,c.opacity=void 0),c.swatchColor=""}),c.$watchGroup(["colorPickerFormat","colorPickerAlpha","colorPickerCase"],function(a,b){void 0!==a&&(c.initConfig(),c.update())}),c.$watchGroup(["colorPickerDisabled","colorPickerSwatchBootstrap","colorPickerSwatchOnly","colorPickerSwatch","colorPickerPos","colorPickerInline"],function(a,b){void 0!==a&&c.initConfig()}),c.$watch("colorPickerSwatchPos",function(a,d){void 0!==a&&(c.initConfig(),b(function(){c.updateSwatchBackground()}))}), | ||
return c.visible?!0:(c.log("Color Picker: Show Event"),c.visible=!0,c.hueMouse=!1,c.opacityMouse=!1,c.colorMouse=!1,c.saturationUpdate(),void c.lightnessUpdate())},c.hide=function(){c.config.inline||!c.visible&&null===d[0].querySelector(".color-picker-panel").offsetParent||(c.log("Color Picker: Hide Event"),c.visible=!1,c.$apply())},c.setDefaults=function(){void 0===c.hue&&(c.hue=0),void 0===c.saturation&&(c.saturation=0),void 0===c.lightness&&(c.lightness=100),void 0===c.opacity&&(c.opacity=100)},c.update=function(){if(void 0===c.hue&&void 0===c.saturation&&void 0===c.lightness)return!1;c.setDefaults();var a,b=tinycolor({h:c.hue,s:c.saturation/100,v:c.lightness/100});switch(c.config.alpha&&b.setAlpha(c.opacity/100),c.log("Color Picker: COLOR CHANGED TO ",b,c.hue,c.saturation,c.lightness,c.opacity),c.swatchColor=b.toHslString(),c.config.format){case"rgb":a=b.toRgbString();break;case"hex":a=b.toHexString(),a="lower"===c.config.case?a.toLowerCase():a.toUpperCase();break;case"hex8":a=b.toHex8String(),a="lower"===c.config.case?a.toLowerCase():a.toUpperCase();break;case"hsv":a=b.toHsvString();break;default:a=b.toHslString()}c.updateModel&&(c.ngModel=a)},c.updateSwatchBackground=function(){var a=angular.element(d[0].querySelector(".color-picker-swatch"));a.css({"background-color":c.swatchColor})},c.$watch("ngModel",function(a,d){if(void 0!==a&&null!==a&&a!==d&&a.length>4){c.log("Color Picker: MODEL - CHANGED",a);var g=tinycolor(a);if(g.isValid()){var h=g.toHsv();c.updateModel=!1,c.hue=h.h,c.saturation=100*h.s,c.lightness=100*h.v,c.config.alpha&&(c.opacity=100*h.a),b(function(){c.updateModel=!0}),c.isValid=!0}else c.isValid=!1;f[0].$setValidity(e.name,c.isValid),void 0!==d&&"function"==typeof f[0].$setDirty&&f[0].$setDirty()}else null!==a&&""!==a||(c.hue=void 0,c.saturation=void 0,c.lightness=void 0,c.opacity=void 0),c.swatchColor=""}),c.$watchGroup(["colorPickerFormat","colorPickerAlpha","colorPickerCase"],function(a,b){void 0!==a&&(c.initConfig(),c.update())}),c.$watchGroup(["colorPickerDisabled","colorPickerSwatchBootstrap","colorPickerSwatchOnly","colorPickerSwatch","colorPickerPos","colorPickerInline"],function(a,b){void 0!==a&&c.initConfig()}),c.$watch("colorPickerSwatchPos",function(a,d){void 0!==a&&(c.initConfig(),b(function(){c.updateSwatchBackground()}))}), | ||
//--------------------------- | ||
@@ -30,0 +32,0 @@ // Update Positions And Colors On Elements |
@@ -15,4 +15,4 @@ angular | ||
$scope.onColorChange = function($event, color) { | ||
console.log($event, color); | ||
console.log($event, color, $scope.color); | ||
} | ||
}); |
@@ -146,4 +146,6 @@ (function() { | ||
$scope.onBlur = function() { | ||
$scope.updateModel = true; | ||
$scope.update(); | ||
if ($scope.ngModel !== $scope.onChangeValue) { | ||
$scope.updateModel = true; | ||
$scope.update(); | ||
} | ||
}; | ||
@@ -175,2 +177,7 @@ | ||
$scope.show = function () { | ||
// if already visible then don't run show again | ||
if ($scope.visible) { | ||
return true; | ||
} | ||
$scope.log('Color Picker: Show Event'); | ||
@@ -177,0 +184,0 @@ $scope.visible = true; |
{ | ||
"name": "angularjs-color-picker", | ||
"description": "Color Picker Directive For AngularJS", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "dist/angularjs-color-picker.min.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2219
454704
39