|
1 | 1 | /*! |
2 | | - * angular-color-picker v0.4.0 |
| 2 | + * angular-color-picker v0.5.0 |
3 | 3 | * https://github.com/ruhley/angular-color-picker/ |
4 | 4 | * |
5 | 5 | * Copyright 2015 ruhley |
6 | 6 | * |
7 | | - * 2015-05-28 13:06:45 |
| 7 | + * 2015-06-04 14:13:50 |
8 | 8 | * |
9 | 9 | */ |
10 | 10 | (function() { |
|
29 | 29 | colorPickerSwatch: '=', |
30 | 30 | colorPickerSwatchOnly: '=', |
31 | 31 | colorPickerSwatchPos: '=', |
| 32 | + colorPickerSwatchBootstrap: '=' |
32 | 33 | }, |
33 | 34 | templateUrl: 'template/color-picker/directive.html', |
34 | 35 | link: function ($scope, element, attrs, control) { |
|
66 | 67 | $scope.config.swatch = $scope.colorPickerSwatch === undefined ? true : $scope.colorPickerSwatch; |
67 | 68 | $scope.config.swatchOnly = $scope.colorPickerSwatchOnly === undefined ? false : $scope.colorPickerSwatchOnly; |
68 | 69 | $scope.config.swatchPos = $scope.colorPickerSwatchPos === undefined ? 'left' : $scope.colorPickerSwatchPos; |
| 70 | + $scope.config.swatchBootstrap = $scope.colorPickerSwatchBootstrap === undefined ? true : $scope.colorPickerSwatchBootstrap; |
69 | 71 | $scope.log('Color Picker: Config', $scope.config); |
70 | 72 | }; |
71 | 73 |
|
|
205 | 207 | ); |
206 | 208 |
|
207 | 209 | $scope.$watchGroup( |
208 | | - ['colorPickerSwatchPos', 'colorPickerSwatchOnly', 'colorPickerSwatch', 'colorPickerPos'], |
| 210 | + ['colorPickerSwatchPos', 'colorPickerSwatchBootstrap', 'colorPickerSwatchOnly', 'colorPickerSwatch', 'colorPickerPos'], |
209 | 211 | function (newValue, oldValue) { |
210 | 212 | if (newValue !== undefined) { |
211 | 213 | $scope.initConfig(); |
|
421 | 423 | })(); |
422 | 424 |
|
423 | 425 | angular.module('color.picker').run(['$templateCache', function($templateCache) { |
424 | | - $templateCache.put('template/color-picker/directive.html', |
425 | | - '<div class="color-picker-wrapper" ng-class="{\'color-picker-swatch-only\': config.swatchOnly}">\n' + |
426 | | - ' <input class="color-picker-input form-control" type="text" ng-model="ngModel" size="7" ng-focus="show()" ng-class="{\'color-picker-input-swatch\': config.swatch && !config.swatchOnly && config.swatchPos === \'left\'}">\n' + |
427 | | - ' <span class="color-picker-swatch" ng-click="focus()" ng-show="config.swatch" ng-class="{\'color-picker-swatch-left\': config.swatchPos !== \'right\', \'color-picker-swatch-right\': config.swatchPos === \'right\'}">\n' + |
428 | | - ' <span class="color-picker-swatch-color" style="background-color: {{swatchColor}};"></span>\n' + |
429 | | - ' </span>\n' + |
430 | | - ' <div class="color-picker-panel" ng-show="visible" ng-class="{\n' + |
431 | | - ' \'color-picker-panel-top color-picker-panel-right\': config.pos === \'top right\',\n' + |
432 | | - ' \'color-picker-panel-top color-picker-panel-left\': config.pos === \'top left\',\n' + |
433 | | - ' \'color-picker-panel-bottom color-picker-panel-right\': config.pos === \'bottom right\',\n' + |
434 | | - ' \'color-picker-panel-bottom color-picker-panel-left\': config.pos === \'bottom left\',\n' + |
435 | | - ' }">\n' + |
436 | | - ' <div class="color-picker-hue color-picker-sprite" ng-click="hueChange($event, true)" ng-mousemove="hueChange($event, false)" ng-mousedown="hueDown()" ng-mouseup="hueUp()">\n' + |
437 | | - ' <div class="color-picker-slider" style="top: {{huePos}}%;"></div>\n' + |
438 | | - ' </div>\n' + |
439 | | - ' <div class="color-picker-opacity color-picker-sprite" ng-show="config.alpha" ng-click="opacityChange($event, true)" ng-mousemove="opacityChange($event, false)" ng-mousedown="opacityDown()" ng-mouseup="opacityUp()">\n' + |
440 | | - ' <div class="color-picker-slider" style="top: {{opacityPos}}%;"></div>\n' + |
441 | | - ' </div>\n' + |
442 | | - ' <div class="color-picker-grid color-picker-sprite" style="background-color: {{grid}};" ng-click="colorChange($event, true)" ng-mousemove="colorChange($event, false)" ng-mousedown="colorDown()" ng-mouseup="colorUp()">\n' + |
443 | | - ' <div class="color-picker-grid-inner"></div>\n' + |
444 | | - ' <div class="color-picker-picker" style="top: {{lightnessPos}}%; left: {{saturationPos}}%;">\n' + |
445 | | - ' <div></div>\n' + |
446 | | - ' </div>\n' + |
447 | | - ' </div>\n' + |
448 | | - ' </div>\n' + |
449 | | - '</div>' + |
450 | | - ''); |
| 426 | + $templateCache.put('template/color-picker/directive.html', |
| 427 | + '<div class="color-picker-wrapper" ng-class="{\'color-picker-swatch-only\': config.swatchOnly}">\n' + |
| 428 | + ' <div ng-class="{\'input-group\': config.swatchBootstrap}">\n' + |
| 429 | + ' <span ng-if="config.swatchPos === \'left\'" class="color-picker-swatch" ng-click="focus()" ng-show="config.swatch" ng-class="{\'color-picker-swatch-left\': config.swatchPos !== \'right\', \'color-picker-swatch-right\': config.swatchPos === \'right\', \'input-group-addon\': config.swatchBootstrap}">\n' + |
| 430 | + ' <span class="color-picker-swatch-color" style="background-color: {{swatchColor}};"></span>\n' + |
| 431 | + ' </span>\n' + |
| 432 | + ' <input class="color-picker-input form-control" type="text" ng-model="ngModel" size="7" ng-focus="show()" ng-class="{\'color-picker-input-swatch\': config.swatch && !config.swatchOnly && config.swatchPos === \'left\'}">\n' + |
| 433 | + ' <span ng-if="config.swatchPos === \'right\'" class="color-picker-swatch" ng-click="focus()" ng-show="config.swatch" ng-class="{\'color-picker-swatch-left\': config.swatchPos !== \'right\', \'color-picker-swatch-right\': config.swatchPos === \'right\', \'input-group-addon\': config.swatchBootstrap}">\n' + |
| 434 | + ' <span class="color-picker-swatch-color" style="background-color: {{swatchColor}};"></span>\n' + |
| 435 | + ' </span>\n' + |
| 436 | + ' </div>\n' + |
| 437 | + ' <div class="color-picker-panel" ng-show="visible" ng-class="{\n' + |
| 438 | + ' \'color-picker-panel-top color-picker-panel-right\': config.pos === \'top right\',\n' + |
| 439 | + ' \'color-picker-panel-top color-picker-panel-left\': config.pos === \'top left\',\n' + |
| 440 | + ' \'color-picker-panel-bottom color-picker-panel-right\': config.pos === \'bottom right\',\n' + |
| 441 | + ' \'color-picker-panel-bottom color-picker-panel-left\': config.pos === \'bottom left\',\n' + |
| 442 | + ' }">\n' + |
| 443 | + ' <div class="color-picker-hue color-picker-sprite" ng-click="hueChange($event, true)" ng-mousemove="hueChange($event, false)" ng-mousedown="hueDown()" ng-mouseup="hueUp()">\n' + |
| 444 | + ' <div class="color-picker-slider" style="top: {{huePos}}%;"></div>\n' + |
| 445 | + ' </div>\n' + |
| 446 | + ' <div class="color-picker-opacity color-picker-sprite" ng-show="config.alpha" ng-click="opacityChange($event, true)" ng-mousemove="opacityChange($event, false)" ng-mousedown="opacityDown()" ng-mouseup="opacityUp()">\n' + |
| 447 | + ' <div class="color-picker-slider" style="top: {{opacityPos}}%;"></div>\n' + |
| 448 | + ' </div>\n' + |
| 449 | + ' <div class="color-picker-grid color-picker-sprite" style="background-color: {{grid}};" ng-click="colorChange($event, true)" ng-mousemove="colorChange($event, false)" ng-mousedown="colorDown()" ng-mouseup="colorUp()">\n' + |
| 450 | + ' <div class="color-picker-grid-inner"></div>\n' + |
| 451 | + ' <div class="color-picker-picker" style="top: {{lightnessPos}}%; left: {{saturationPos}}%;">\n' + |
| 452 | + ' <div></div>\n' + |
| 453 | + ' </div>\n' + |
| 454 | + ' </div>\n' + |
| 455 | + ' </div>\n' + |
| 456 | + '</div>' |
| 457 | + ); |
| 458 | + |
451 | 459 | }]); |
0 commit comments