Skip to content

Commit

Permalink
0.2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
tamtakoe committed Dec 7, 2015
1 parent c2a096d commit 48358b6
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 18 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.2.20

#### Features

- **oi-select-options:**
- listFilter: 'oiSelectAscSort:true' shows sorted original list

## 0.2.19

#### Features
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#oi.select — AngularJS directive of select element

**[Download 0.2.19](https://github.com/tamtakoe/oi.select/tree/master/dist)**
**[Download 0.2.20](https://github.com/tamtakoe/oi.select/tree/master/dist)**

## Features

Expand Down Expand Up @@ -94,7 +94,7 @@ Use `oi-select` directive:
* `searchFilter` — filter name for items in search field
* `dropdownFilter` — filter name for items in dropdown
* `groupFilter` — filter name for group header
* `listFilter` — filter name for items order in dropdown. Use `none` to disable filtering
* `listFilter` — filter name for items order in dropdown. Use `none` to disable filtering. You can set special options (see Filtered example)
* `editItem` — function which get `lastQuery`, `removedItem` and `getLabel(item)` and return string for input after element was removed (default: ''). `editItem = true` allows you to edit a deleted item. `editItem = 'correct'` same as `true` but does not edit the first time
* `saveTrigger` — Trigger on which element is stored in the model. May be `enter`, `blur`, `space`, `tab` and any characters devided by spaces (default: `enter tab blur`)
* `cleanModel` — Clean model on click for single select.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "https://github.com/tamtakoe"
},
"name": "oi.select",
"version": "0.2.19",
"version": "0.2.20",
"main": ["./dist/select-tpls.min.js", "./dist/select.min.css"],
"dependencies": {
"angular": ">=1.2",
Expand Down
20 changes: 16 additions & 4 deletions dist/select-tpls.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ angular.module('oi.select')
saveTrigger: 'enter tab blur'
},
version: {
full: '0.2.19',
full: '0.2.20',
major: 0,
minor: 2,
dot: 19
dot: 20
},
$get: function() {
return {
Expand Down Expand Up @@ -1071,15 +1071,15 @@ angular.module('oi.select')

.filter('oiSelectAscSort', ['oiSelectEscape', function(oiSelectEscape) {
function ascSort(input, query, getLabel, options) {
var i, j, isFound, output, output1 = [], output2 = [], output3 = [];
var i, j, isFound, output, output1 = [], output2 = [], output3 = [], output4 = [];

if (query) {
query = oiSelectEscape(String(query));

for (i = 0, isFound = false; i < input.length; i++) {
isFound = getLabel(input[i]).match(new RegExp(query, "i"));

if (!isFound && options) {
if (!isFound && options && (options.length || options.fields)) {
for (j = 0; j < options.length; j++) {
if (isFound) break;

Expand All @@ -1099,6 +1099,18 @@ angular.module('oi.select')
}
}
output = output2.concat(output3);

if (options && (options === true || options.all)) {
inputLabel: for (i = 0; i < input.length; i++) {
for (j = 0; j < output.length; j++) {
if (input[i] === output[j]) {
continue inputLabel;
}
}
output4.push(input[i]);
}
output = output.concat(output4);
}
} else {
output = [].concat(input);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/select-tpls.min.js

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions dist/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ angular.module('oi.select')
saveTrigger: 'enter tab blur'
},
version: {
full: '0.2.19',
full: '0.2.20',
major: 0,
minor: 2,
dot: 19
dot: 20
},
$get: function() {
return {
Expand Down Expand Up @@ -1071,15 +1071,15 @@ angular.module('oi.select')

.filter('oiSelectAscSort', ['oiSelectEscape', function(oiSelectEscape) {
function ascSort(input, query, getLabel, options) {
var i, j, isFound, output, output1 = [], output2 = [], output3 = [];
var i, j, isFound, output, output1 = [], output2 = [], output3 = [], output4 = [];

if (query) {
query = oiSelectEscape(String(query));

for (i = 0, isFound = false; i < input.length; i++) {
isFound = getLabel(input[i]).match(new RegExp(query, "i"));

if (!isFound && options) {
if (!isFound && options && (options.length || options.fields)) {
for (j = 0; j < options.length; j++) {
if (isFound) break;

Expand All @@ -1099,6 +1099,18 @@ angular.module('oi.select')
}
}
output = output2.concat(output3);

if (options && (options === true || options.all)) {
inputLabel: for (i = 0; i < input.length; i++) {
for (j = 0; j < output.length; j++) {
if (input[i] === output[j]) {
continue inputLabel;
}
}
output4.push(input[i]);
}
output = output.concat(output4);
}
} else {
output = [].concat(input);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/select.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/examples/filtered/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ angular.module('selectDemo')
"name": "shirt",
"category": "clothes"
}];

$scope.bundle3 = [];
});
31 changes: 31 additions & 0 deletions docs/examples/filtered/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,35 @@ <h2>Filtered</h2>
{{bundle2}}
</pre></div>
</div>

<p>You can use <code>oiSelectAscSort:true</code> for show original list sorted by ASC</p>
<div class="row">
<div class="col-md-8">
<oi-select
oi-options="item.name for item in shopArr track by item.id"
ng-model="bundle3"
oi-select-options="{
listFilter: 'oiSelectAscSort:true'
}"
multiple
placeholder="Select"
></oi-select>
</div>
</div>

<div class="row">
<div hljs class="col-md-8">
oi-options="item.name for item in shopArr track by item.id"
ng-model="bundle3"
oi-select-options="{
listFilter: 'oiSelectAscSort:true'
}"
multiple
</div>
<div class="col-md-4"><pre>
{{bundle3}}
</pre></div>
</div>

<p>Also you can use both of variants <code>oiSelectAscSort:{fields: [\'id\', \'category\'], all: true}</code></p>
</div>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oi.select",
"license": "MIT",
"version": "0.2.19",
"version": "0.2.20",
"repository": {
"type": "git",
"url": "git://github.com/tamtakoe/oi.select.git"
Expand Down
16 changes: 14 additions & 2 deletions src/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ angular.module('oi.select')

.filter('oiSelectAscSort', ['oiSelectEscape', function(oiSelectEscape) {
function ascSort(input, query, getLabel, options) {
var i, j, isFound, output, output1 = [], output2 = [], output3 = [];
var i, j, isFound, output, output1 = [], output2 = [], output3 = [], output4 = [];

if (query) {
query = oiSelectEscape(String(query));

for (i = 0, isFound = false; i < input.length; i++) {
isFound = getLabel(input[i]).match(new RegExp(query, "i"));

if (!isFound && options) {
if (!isFound && options && (options.length || options.fields)) {
for (j = 0; j < options.length; j++) {
if (isFound) break;

Expand All @@ -61,6 +61,18 @@ angular.module('oi.select')
}
}
output = output2.concat(output3);

if (options && (options === true || options.all)) {
inputLabel: for (i = 0; i < input.length; i++) {
for (j = 0; j < output.length; j++) {
if (input[i] === output[j]) {
continue inputLabel;
}
}
output4.push(input[i]);
}
output = output.concat(output4);
}
} else {
output = [].concat(input);
}
Expand Down
4 changes: 2 additions & 2 deletions src/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ angular.module('oi.select')
saveTrigger: 'enter tab blur'
},
version: {
full: '0.2.19',
full: '0.2.20',
major: 0,
minor: 2,
dot: 19
dot: 20
},
$get: function() {
return {
Expand Down

0 comments on commit 48358b6

Please sign in to comment.