Skip to content

Commit 14b917c

Browse files
committed
New Feature - Disabled
1 parent 202cdc5 commit 14b917c

File tree

7 files changed

+34
-2
lines changed

7 files changed

+34
-2
lines changed

examples/01-simple.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
<h1>AngularJS Color Picker</h1>
1717
<p>An AngularJS directive for a color picker. No requirement on jQuery.</p>
1818
<form class="col-sm-12">
19+
<div class="row">
20+
<label class="control-label">Disabled (disabled)</label>
21+
<select ng-model="disabled" class="form-control" ng-options="option.value as option.label for option in boolOptions"></select>
22+
</div>
23+
1924
<div class="row">
2025
<label class="control-label">Format (format)</label>
2126
<select ng-model="format" class="form-control" ng-options="option.value as option.label for option in formatOptions"></select>
@@ -60,6 +65,7 @@ <h1>AngularJS Color Picker</h1>
6065
<label class="control-label">Color</label>
6166
<color-picker
6267
ng-model="color"
68+
color-picker-disabled="disabled"
6369
color-picker-format="format"
6470
color-picker-alpha="alpha"
6571
color-picker-swatch="swatch"

examples/02-testing-lib.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<h1>AngularJS Color Picker</h1>
2020
<p>An AngularJS directive for a color picker. No requirement on jQuery.</p>
2121
<form class="col-sm-12">
22+
<div class="row">
23+
<label class="control-label">Disabled (disabled)</label>
24+
<select ng-model="disabled" class="form-control" ng-options="option.value as option.label for option in boolOptions"></select>
25+
</div>
26+
2227
<div class="row">
2328
<label class="control-label">Format (format)</label>
2429
<select ng-model="format" class="form-control" ng-options="option.value as option.label for option in formatOptions"></select>
@@ -63,6 +68,7 @@ <h1>AngularJS Color Picker</h1>
6368
<label class="control-label">Color</label>
6469
<color-picker
6570
ng-model="color"
71+
color-picker-disabled="disabled"
6672
color-picker-format="format"
6773
color-picker-alpha="alpha"
6874
color-picker-swatch="swatch"

examples/03-testing-preset-value.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<h1>AngularJS Color Picker</h1>
2020
<p>An AngularJS directive for a color picker. No requirement on jQuery.</p>
2121
<form class="col-sm-12">
22+
<div class="row">
23+
<label class="control-label">Disabled (disabled)</label>
24+
<select ng-model="disabled" class="form-control" ng-options="option.value as option.label for option in boolOptions"></select>
25+
</div>
26+
2227
<div class="row">
2328
<label class="control-label">Format (format)</label>
2429
<select ng-model="format" class="form-control" ng-options="option.value as option.label for option in formatOptions"></select>
@@ -63,6 +68,7 @@ <h1>AngularJS Color Picker</h1>
6368
<label class="control-label">Color</label>
6469
<color-picker
6570
ng-model="color"
71+
color-picker-disabled="disabled"
6672
color-picker-format="format"
6773
color-picker-alpha="alpha"
6874
color-picker-swatch="swatch"

examples/04-testing-lib-angularjs-1.3.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<h1>AngularJS Color Picker</h1>
2020
<p>An AngularJS directive for a color picker. No requirement on jQuery.</p>
2121
<form class="col-sm-12">
22+
<div class="row">
23+
<label class="control-label">Disabled (disabled)</label>
24+
<select ng-model="disabled" class="form-control" ng-options="option.value as option.label for option in boolOptions"></select>
25+
</div>
26+
2227
<div class="row">
2328
<label class="control-label">Format (format)</label>
2429
<select ng-model="format" class="form-control" ng-options="option.value as option.label for option in formatOptions"></select>
@@ -63,6 +68,7 @@ <h1>AngularJS Color Picker</h1>
6368
<label class="control-label">Color</label>
6469
<color-picker
6570
ng-model="color"
71+
color-picker-disabled="disabled"
6672
color-picker-format="format"
6773
color-picker-alpha="alpha"
6874
color-picker-swatch="swatch"

examples/05-testing-bootstrap.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
<h1>AngularJS Color Picker</h1>
2323
<p>An AngularJS directive for a color picker. No requirement on jQuery.</p>
2424
<form class="col-sm-12">
25+
<div class="row">
26+
<label class="control-label">Disabled (disabled)</label>
27+
<select ng-model="disabled" class="form-control" ng-options="option.value as option.label for option in boolOptions"></select>
28+
</div>
29+
2530
<div class="row">
2631
<label class="control-label">Format (format)</label>
2732
<select ng-model="format" class="form-control" ng-options="option.value as option.label for option in formatOptions"></select>
@@ -66,6 +71,7 @@ <h1>AngularJS Color Picker</h1>
6671
<label class="control-label">Color</label>
6772
<color-picker
6873
ng-model="color"
74+
color-picker-disabled="disabled"
6975
color-picker-format="format"
7076
color-picker-alpha="alpha"
7177
color-picker-swatch="swatch"

lib/scripts/directive.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
require: ['^ngModel'],
88
scope: {
99
ngModel: '=',
10+
colorPickerDisabled: '=',
1011
colorPickerAlpha: '=',
1112
colorPickerCase: '=',
1213
colorPickerFormat: '=',
@@ -137,6 +138,7 @@
137138

138139
$scope.initConfig = function() {
139140
$scope.config = {};
141+
$scope.config.disabled = $scope.colorPickerDisabled === undefined ? false : $scope.colorPickerDisabled;
140142
$scope.config.alpha = $scope.colorPickerAlpha === undefined ? true : $scope.colorPickerAlpha;
141143
$scope.config.case = $scope.colorPickerCase === undefined ? 'upper' : $scope.colorPickerCase;
142144
$scope.config.format = $scope.colorPickerFormat === undefined ? 'hsl' : $scope.colorPickerFormat;
@@ -313,7 +315,7 @@
313315
);
314316

315317
$scope.$watchGroup(
316-
['colorPickerSwatchPos', 'colorPickerSwatchBootstrap', 'colorPickerSwatchOnly', 'colorPickerSwatch', 'colorPickerPos'],
318+
['colorPickerDisabled', 'colorPickerSwatchPos', 'colorPickerSwatchBootstrap', 'colorPickerSwatchOnly', 'colorPickerSwatch', 'colorPickerPos'],
317319
function (newValue, oldValue) {
318320
if (newValue !== undefined) {
319321
$scope.initConfig();

lib/scripts/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ angular.module('color.picker').run(['$templateCache', function($templateCache) {
33
'<div class="color-picker-wrapper" ng-class="{\'color-picker-swatch-only\': config.swatchOnly}">\n' +
44
' <div class="color-picker-input-wrapper" ng-class="{\'input-group\': config.swatchBootstrap && config.swatch}">\n' +
55
' <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}"></span>\n' +
6-
' <input class="color-picker-input form-control" type="text" ng-model="ngModel" ng-change="onChange($event)" size="7" ng-focus="show()" ng-class="{\'color-picker-input-swatch\': config.swatch && !config.swatchOnly && config.swatchPos === \'left\'}">\n' +
6+
' <input class="color-picker-input form-control" type="text" ng-model="ngModel" ng-disabled="config.disabled" ng-change="onChange($event)" size="7" ng-focus="show()" ng-class="{\'color-picker-input-swatch\': config.swatch && !config.swatchOnly && config.swatchPos === \'left\'}">\n' +
77
' <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}"></span>\n' +
88
' </div>\n' +
99
' <div class="color-picker-panel" ng-show="visible" ng-class="{\n' +

0 commit comments

Comments
 (0)