Skip to content

Commit dd618e5

Browse files
committed
Merge branch 'develop'
2 parents 5a8379f + d305a52 commit dd618e5

File tree

4 files changed

+86
-6
lines changed

4 files changed

+86
-6
lines changed

gulp/build.js

+27-6
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ gulp.task('compile:component', ['clean:component'], function(cb) {
119119
runSequence(['scripts', 'styles', 'partials'], cb);
120120
});
121121

122-
gulp.task('build:component', ['compile:component'], function() {
122+
gulp.task('build.component.minified', ['compile:component'], function () {
123123
var jsFilter = $.filter('**/*.js', { restore: true });
124124
var cssFilter = $.filter('**/*.css', { restore: true });
125125

@@ -129,14 +129,35 @@ gulp.task('build:component', ['compile:component'], function() {
129129
path.join(conf.paths.tmp, 'partials/templateCacheHtml.js')
130130
])
131131
.pipe(jsFilter)
132-
.pipe(concat({ path: 'angularjs-dropdown-multiselect.min.js'}))
133-
.pipe($.sourcemaps.init())
134-
.pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify'))
135-
.pipe($.sourcemaps.write('maps'))
132+
.pipe(concat({ path: 'angularjs-dropdown-multiselect.min.js' }))
133+
.pipe($.sourcemaps.init())
134+
.pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify'))
135+
.pipe($.sourcemaps.write('maps'))
136136
.pipe(jsFilter.restore)
137137
.pipe(cssFilter)
138138
.pipe($.cssnano())
139139
.pipe(cssFilter.restore)
140140
.pipe(gulp.dest(path.join(conf.paths.dist, '/')))
141-
.pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));
141+
.pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));
142+
});
143+
144+
gulp.task('build.component', ['compile:component'], function () {
145+
var jsFilter = $.filter('**/*.js', { restore: true });
146+
var cssFilter = $.filter('**/*.css', { restore: true });
147+
148+
return gulp.src([
149+
path.join(conf.paths.tmp, 'serve/app/index.css'),
150+
path.join(conf.paths.tmp, 'serve/app/index.module.js'),
151+
path.join(conf.paths.tmp, 'partials/templateCacheHtml.js')
152+
])
153+
.pipe(jsFilter)
154+
.pipe(concat({ path: 'angularjs-dropdown-multiselect.js' }))
155+
.pipe(jsFilter.restore)
156+
.pipe(cssFilter)
157+
.pipe($.cssnano())
158+
.pipe(cssFilter.restore)
159+
.pipe(gulp.dest(path.join(conf.paths.dist, '/src')))
160+
.pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));
142161
});
162+
163+
gulp.task('build:component', ['build.component.minified', 'build.component']);

src/app/component/angularjs-dropdown-multiselect.controller.js

+4
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ export default function dropdownMultiselectController(
230230

231231
function getButtonText() {
232232
if ($scope.settings.dynamicTitle && $scope.selectedModel && $scope.selectedModel.length > 0) {
233+
if (angular.isFunction($scope.settings.smartButtonTextProvider)) {
234+
return $scope.settings.smartButtonTextProvider($scope.selectedModel);
235+
}
236+
233237
if ($scope.settings.smartButtonMaxItems > 0) {
234238
const paddingWidth = 12 * 2;
235239
const borderWidth = 1 * 2;

src/app/main/main.controller.js

+13
Original file line numberDiff line numberDiff line change
@@ -324,5 +324,18 @@ export default class MainController {
324324
$scope.idPropertySettings = {
325325
idProperty: 'id',
326326
};
327+
328+
$scope.smartButtonTextProviderModel = [
329+
];
330+
$scope.smartButtonTextProviderData = [
331+
{ id: 1, label: 'David' },
332+
{ id: 2, label: 'Jhon' },
333+
{ id: 3, label: 'Danny' },
334+
];
335+
$scope.smartButtonTextProviderSettings = {
336+
smartButtonTextProvider(selectionArray) {
337+
return selectionArray.length + 2;
338+
},
339+
};
327340
}
328341
}

src/app/main/main.template.html

+42
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,48 @@ <h3>Code</h3>
10581058
];
10591059
$scope.idPropertySettings = {
10601060
idProperty: 'id',
1061+
};
1062+
</div>
1063+
</div>
1064+
</div>
1065+
</div>
1066+
<div uib-accordion-group heading="Button text provider">
1067+
<div class="row">
1068+
<div class="col-xs-12">
1069+
When there is a selection this method will be called with the selection as a parameter. The function is supposed to return the text that you want to display on the button.
1070+
</div>
1071+
</div>
1072+
<div class="row">
1073+
<div class="col-xs-12 col-sm-6">
1074+
<h3>Demo</h3>
1075+
<div class="well">
1076+
<div ng-dropdown-multiselect="" options="smartButtonTextProviderData" selected-model="smartButtonTextProviderModel" extra-settings="smartButtonTextProviderSettings">
1077+
</div>
1078+
</div>
1079+
</div>
1080+
<div class="col-xs-12 col-sm-6">
1081+
<h3>The model:</h3>
1082+
<pre>{{smartButtonTextProviderModel|json}}</pre>
1083+
</div>
1084+
</div>
1085+
<div class="row">
1086+
<div class="col-md-12">
1087+
<h3>Code</h3>
1088+
<div hljs language="javascript">
1089+
// HTML
1090+
<div ng-dropdown-multiselect="" options="idPropertyData" selected-model="idPropertyModel" extra-settings="idPropertySettings">
1091+
</div>
1092+
1093+
$scope.smartButtonTextProviderModel = [];
1094+
$scope.smartButtonTextProviderData = [
1095+
{ id: 1, label: 'David' },
1096+
{ id: 2, label: 'Jhon' },
1097+
{ id: 3, label: 'Danny' },
1098+
];
1099+
$scope.idPropertySettings = {
1100+
smartButtonTextProvider(selectionArray) {
1101+
return selectionArray.length + 2;
1102+
},
10611103
};
10621104
</div>
10631105
</div>

0 commit comments

Comments
 (0)