Skip to content

Commit

Permalink
Packing v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
indrimuska committed Aug 26, 2016
1 parent 2b74db8 commit a83415a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ disable | `Boolean` | `false` | Enable/disable the select. Note the name is `dis
disableSearch | `Boolean` | `false` | Enable/disable the search input field.
require | `Boolean` | `false` | Sets required validation. Note the name is `require` not `required` to avoid collisions with the HTML5 required attribute.
multi | `Boolean` | `false` | Allows to select more than one value. Note the name is `multi` not `multiple` to avoid collisions with the HTML5 multiple attribute.
limit | `Integer` | `Infinity` | Maximum number of selectable items when `multi` is `true`.
placeholder | `String` | | Optional placeholder text to display if input is empty.
options | `Array` | `[]` | Set of options to display.<br><br>Each object must contain a `label` key and a `value` key, otherwise you need to use a custom template (`viewItemTemplate` and `dropdownItemTemplate`) or change the default values of `valueAttr` and `labelAttr` properties.
valueAttr | `String` | `null` | Name of the value key in options array. This also sets the type of result for the model: if you don't set this attribute (`null` by default) the entire object option is returned, otherwise it will be returned only the selected property.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-selector",
"version": "1.4.4",
"version": "1.5.0",
"authors": [
"Indri Muska <indrimuska@gmail.com>"
],
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-selector.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! angular-selector - v1.4.4 - https://github.com/indrimuska/angular-selector - (c) 2015 Indri Muska - MIT */
/*! angular-selector - v1.5.0 - https://github.com/indrimuska/angular-selector - (c) 2015 Indri Muska - MIT */
@-webkit-keyframes selector-rotate { 0% { -webkit-transform: rotateZ(-359deg); } 100% { -webkit-transform: rotateZ(0deg); } }
@-moz-keyframes selector-rotate { 0% { -moz-transform: rotateZ(-359deg); } 100% { -moz-transform: rotateZ(0deg); } }
@-o-keyframes selector-rotate { 0% { -o-transform: rotateZ(-359deg); } 100% { -o-transform: rotateZ(0deg); } }
Expand Down
17 changes: 11 additions & 6 deletions dist/angular-selector.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! angular-selector - v1.4.4 - https://github.com/indrimuska/angular-selector - (c) 2015 Indri Muska - MIT */
/*! angular-selector - v1.5.0 - https://github.com/indrimuska/angular-selector - (c) 2015 Indri Muska - MIT */
(function (angular) {

// Key codes
Expand Down Expand Up @@ -34,6 +34,7 @@
options: '=?',
debounce: '=?',
create: '&?',
limit: '=?',
rtl: '=?',
api: '=?',
change: '&?',
Expand Down Expand Up @@ -76,6 +77,7 @@
groupAttr: 'group',
options: [],
debounce: 0,
limit: Infinity,
remoteParam: 'q',
remoteValidationParam: 'value',
removeButton: true,
Expand Down Expand Up @@ -271,6 +273,7 @@
});
};
scope.open = function () {
if (scope.multiple && (scope.selectedValues || []).length >= scope.limit) return;
scope.isOpen = true;
scope.dropdownPosition();
$timeout(scope.scrollToHighlighted);
Expand Down Expand Up @@ -330,6 +333,8 @@
});
};
scope.set = function (option) {
if (scope.multiple && (scope.selectedValues || []).length >= scope.limit) return;

if (!angular.isDefined(option))
option = scope.filteredOptions[scope.highlighted];

Expand All @@ -340,7 +345,7 @@
if (scope.selectedValues.indexOf(option) < 0)
scope.selectedValues.push(option);
}
if (!scope.multiple || scope.closeAfterSelection) scope.close();
if (!scope.multiple || scope.closeAfterSelection || (scope.selectedValues || []).length >= scope.limit) scope.close();
scope.resetInput();
selectCtrl.$setDirty();
};
Expand Down Expand Up @@ -492,7 +497,7 @@
return filter(scope.options, function (option) {
return scope.optionEquals(option, value);
})[0];
}).filter(function (value) { return angular.isDefined(value); });
}).filter(function (value) { return angular.isDefined(value); }).slice(0, scope.limit);
};
scope.$watch('value', function (newValue, oldValue) {
if (angular.equals(newValue, oldValue)) return;
Expand Down Expand Up @@ -576,7 +581,7 @@
'ng-class="{open: isOpen, empty: !filteredOptions.length && (!create || !search), multiple: multiple, \'has-value\': hasValue(), rtl: rtl, ' +
'loading: loading, \'remove-button\': removeButton, disabled: disabled}">' +
'<select name="{{name}}" ng-hide="true" ng-required="required && !hasValue()" ' +
'ng-model="selectedValues" multiple ng-options="option as getObjValue(option, labelAttr) for option in selectedValues" ng-hide="true"></select>' +
'ng-model="selectedValues" multiple ng-options="option as getObjValue(option, labelAttr) for option in selectedValues"></select>' +
'<label class="selector-input">' +
'<ul class="selector-values">' +
'<li ng-repeat="(index, option) in selectedValues track by index">' +
Expand All @@ -586,8 +591,8 @@
'</div>' +
'</li>' +
'</ul>' +
'<input ng-model="search" placeholder="{{!hasValue() ? placeholder : \'\'}}" ng-model-options="{ debounce: debounce }"' +
'ng-disabled="disabled" ng-readonly="disableSearch" ng-required="required && !hasValue()">' +
'<input ng-model="search" placeholder="{{!hasValue() ? placeholder : \'\'}}" ng-model-options="{debounce: debounce}"' +
'ng-disabled="disabled" ng-readonly="disableSearch" ng-required="required && !hasValue()" autocomplete="off">' +
'<div ng-if="!multiple || loading" class="selector-helper selector-global-helper" ng-click="!disabled && removeButton && unset()">' +
'<span class="selector-icon"></span>' +
'</div>' +
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-selector.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a83415a

Please sign in to comment.