nice-elements 1.9.6 → 1.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +2 -1
- package/bower.json +1 -1
- package/dist/nice.js +115 -3
- package/dist/nice.min.js +1 -1
- package/dist/style.css +55 -1
- package/dist/style.css.map +2 -1
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-search2/nice-search2.js +3 -1
- package/src/components/nice-toggle/nice-toggle.html +13 -0
- package/src/components/nice-toggle/nice-toggle.js +95 -0
- package/src/components/nice-toggle/nice-toggle.scss +68 -0
- package/src/services/nice-service.js +1 -1
- package/src/styles/_nice.scss +1 -0
- package/src/styles/_variables.scss +3 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
# Nice elements v1.9.
|
|
3
|
+
# Nice elements v1.9.8
|
|
4
4
|
|
|
5
5
|
Nice elements is an AngularJS v1.5.8 module that contains nice form elements like inputs, choice fields, search, toggle, dropdown, etc.
|
|
6
6
|
|
|
@@ -46,6 +46,7 @@ Nice elements is an AngularJS v1.5.8 module that contains nice form elements lik
|
|
|
46
46
|
- nice-upload
|
|
47
47
|
- nice-yesno
|
|
48
48
|
- nice-pill
|
|
49
|
+
- nice-toggle
|
|
49
50
|
- ~~nice-datetime-picker~~ (DEPREACATED)
|
|
50
51
|
- ~~nice-datetimerange-picker~~ (DEPREACATED)
|
|
51
52
|
- ~~nice-dtp~~ (DEPREACATED)
|
package/bower.json
CHANGED
package/dist/nice.js
CHANGED
|
@@ -5057,7 +5057,9 @@ angular.module('niceElements')
|
|
|
5057
5057
|
// ------------------------ Clear search ------------------------
|
|
5058
5058
|
$scope.clear = function () {
|
|
5059
5059
|
$scope.model = "";
|
|
5060
|
-
|
|
5060
|
+
$timeout(function () {
|
|
5061
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
5062
|
+
});
|
|
5061
5063
|
};
|
|
5062
5064
|
|
|
5063
5065
|
|
|
@@ -5345,6 +5347,102 @@ angular.module('niceElements')
|
|
|
5345
5347
|
});
|
|
5346
5348
|
'use strict';
|
|
5347
5349
|
|
|
5350
|
+
/**
|
|
5351
|
+
* @ngdoc directive
|
|
5352
|
+
* @name niceElements.directive:niceToggle
|
|
5353
|
+
* @description
|
|
5354
|
+
* # niceToggle
|
|
5355
|
+
*/
|
|
5356
|
+
angular.module('niceElements')
|
|
5357
|
+
.directive('niceToggle', function () {
|
|
5358
|
+
return {
|
|
5359
|
+
templateUrl: 'src/components/nice-toggle/nice-toggle.html',
|
|
5360
|
+
restrict: 'E',
|
|
5361
|
+
scope: {
|
|
5362
|
+
model: '=',
|
|
5363
|
+
title: '@',
|
|
5364
|
+
isDisabled: '=',
|
|
5365
|
+
fieldWidth: '@',
|
|
5366
|
+
labelWidth: '@',
|
|
5367
|
+
defaultFalse: '@',
|
|
5368
|
+
noMargin: '@',
|
|
5369
|
+
onChange: '&?',
|
|
5370
|
+
isInline: '=',
|
|
5371
|
+
help: '@'
|
|
5372
|
+
},
|
|
5373
|
+
controller: function ($scope) {
|
|
5374
|
+
if (!$scope.title) { $scope.title = ''; }
|
|
5375
|
+
if (!$scope.fieldWidth) { $scope.fieldWidth = 'col-sm-8'; }
|
|
5376
|
+
if (!$scope.labelWidth) { $scope.labelWidth = 'col-sm-4'; }
|
|
5377
|
+
|
|
5378
|
+
// ------------------------- Set overlay button position based on passed state in $scope.model -------------------------
|
|
5379
|
+
$scope.setButtonPosition = function (state) {
|
|
5380
|
+
if (state) {
|
|
5381
|
+
$scope.buttonClass = "yesno-button-yes";
|
|
5382
|
+
} else {
|
|
5383
|
+
$scope.buttonClass = "yesno-button-no";
|
|
5384
|
+
}
|
|
5385
|
+
};
|
|
5386
|
+
|
|
5387
|
+
// ------------------------- Watch for changes from outside -------------------------
|
|
5388
|
+
$scope.$watch('model', function (value_new, value_old) {
|
|
5389
|
+
if (angular.isDefined($scope.model)) {
|
|
5390
|
+
$scope.setButtonLabel($scope.model);
|
|
5391
|
+
$scope.setButtonPosition($scope.model);
|
|
5392
|
+
}
|
|
5393
|
+
});
|
|
5394
|
+
|
|
5395
|
+
// ------------------------- Watch for model value -------------------------
|
|
5396
|
+
$scope.$watch('modelValue', function (value_new, value_old) {
|
|
5397
|
+
if ($scope.options) {
|
|
5398
|
+
$scope.model = $scope.modelValue == $scope.options[0];
|
|
5399
|
+
}
|
|
5400
|
+
});
|
|
5401
|
+
|
|
5402
|
+
// ------------------------- Set button label -------------------------
|
|
5403
|
+
$scope.setButtonLabel = function (state) {
|
|
5404
|
+
if (state) {
|
|
5405
|
+
$scope.state = $scope.yes;
|
|
5406
|
+
} else {
|
|
5407
|
+
$scope.state = $scope.no;
|
|
5408
|
+
}
|
|
5409
|
+
};
|
|
5410
|
+
|
|
5411
|
+
// ------------------------- Set width -------------------------
|
|
5412
|
+
$scope.setWidth = function (width, el) {
|
|
5413
|
+
el.style.width = width;
|
|
5414
|
+
};
|
|
5415
|
+
|
|
5416
|
+
|
|
5417
|
+
// ------------------------- Switch -------------------------
|
|
5418
|
+
$scope.switch = function () {
|
|
5419
|
+
if (!$scope.isDisabled) {
|
|
5420
|
+
$scope.model = !$scope.model;
|
|
5421
|
+
|
|
5422
|
+
if ($scope.options) {
|
|
5423
|
+
if ($scope.model) {
|
|
5424
|
+
$scope.modelValue = $scope.options[0];
|
|
5425
|
+
} else {
|
|
5426
|
+
$scope.modelValue = $scope.options[1];
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
|
|
5430
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
5431
|
+
$scope.formYesno.$setDirty();
|
|
5432
|
+
}
|
|
5433
|
+
};
|
|
5434
|
+
|
|
5435
|
+
// Call it first time
|
|
5436
|
+
$scope.setButtonPosition($scope.model);
|
|
5437
|
+
|
|
5438
|
+
// Set label based on state passed in $scope.model
|
|
5439
|
+
$scope.setButtonLabel($scope.model);
|
|
5440
|
+
}
|
|
5441
|
+
};
|
|
5442
|
+
});
|
|
5443
|
+
|
|
5444
|
+
'use strict';
|
|
5445
|
+
|
|
5348
5446
|
/**
|
|
5349
5447
|
* @ngdoc directive
|
|
5350
5448
|
* @name niceElements.directive:niceTooltip
|
|
@@ -5726,7 +5824,7 @@ angular.module('niceElements')
|
|
|
5726
5824
|
.service('NiceService', function () {
|
|
5727
5825
|
var service = {
|
|
5728
5826
|
name: "Nice elements",
|
|
5729
|
-
version: "1.9.
|
|
5827
|
+
version: "1.9.8",
|
|
5730
5828
|
getHeader: function () {
|
|
5731
5829
|
return {};
|
|
5732
5830
|
}
|
|
@@ -7623,7 +7721,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
7623
7721
|
"<path d=\"m364 102.4-1.8-1.4c.4 0 .7 0 1-.2.1-.1.3-.4.3-.8l1.1 1 .6.5v.4a.5.5 0 0 1 0 .2.6.6 0 0 1-.4.2h-.7z\"/>\n" +
|
|
7624
7722
|
"<path d=\"M366.2 103.8a11.8 11.8 0 0 1-2-1.3h.7a.8.8 0 0 0 .4-.2l.1-.4a1 1 0 0 0 0-.2 10.5 10.5 0 0 0 2.1 1.4c0 .3 0 .4-.3.5a3 3 0 0 1-1 .1z\"/>\n" +
|
|
7625
7723
|
"<path d=\"M368.4 104.7a11.9 11.9 0 0 1-2-.8c.4 0 .7 0 1-.2.2 0 .3-.2.3-.5a10.8 10.8 0 0 0 1.3.6v.4l-.5.4s-.1 0 0 0z\"/>\n" +
|
|
7626
|
-
"<path d=\"M373.2 104.2s.4-.1.2 0c-1.4 1-3.1 1-4.8.5.3-.1.5-.2.6-.4a.6.6 0 0 0 0-.5l1.7.4a.4.4 0 0 1-.1.3l-.5.3s-.1 0 0 .1c0 .1 0 0 0 0 .3 0 .5-.2.6-.3a.6.6 0 0 0 .2-.4 9 9 0 0 0 2 0zm-9.7 24-.2.4-1.2.3c0 .3 0 .4.3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.6.3-.2.2-.5.1-.8a2 2 0 0 1-.5 0 3.4 3.4 0 0 1-.5-.3l-.7-.2zm2.8-26.4h.3l.6.1a4.5 4.5 0 0 1 1.7-.3 5.7 5.7 0 0 1 1.7-.2v-.2c.3-.3.4-.6.3-.9-.1-.2-.4-.5-.8-.7h-1.3a4 4 0 0 0-.8.1l.6.4.4 1c-.2.1-.2 0-.2 0 0-.4-.2-.6-.3-.9l-.8-.4a9 9 0 0 0-1.3.2c-.3 0-.5.2-.7.3l.8.1c.3.1.5.4.6.8-.1.1-.1 0-.1 0a1 1 0 0 0-.5-.6c-.4-.2-1.3 0-1.7.2a4.2 4.2 0 0 0-.6.6l2 .4zm-2.3-.4v-.1l.7-.6.7-.4a2 2 0 0 1 1-.5l1.3-.2a1 1 0 0 0-.5-.5l-.8-.1-1.5.8h.5l.1.2h-.4a1.4 1.4 0 0 0-.4 0h-.1l-1.3 1c.3.1.6.2.7.4z\"/>\n" +
|
|
7627
7725
|
"</g>\n" +
|
|
7628
7726
|
"<path fill=\"#0093dd\" d=\"m409 156.5 20.8-47-15.3-24.7-27.3 10-12.7 49.8a219.4 219.4 0 0 1 34.5 11.9z\"/>\n" +
|
|
7629
7727
|
"<path fill=\"#fff\" d=\"M382.6 113a251.7 251.7 0 0 1 39.6 13.7l-8 18.2a232 232 0 0 0-36.5-12.7z\"/>\n" +
|
|
@@ -7711,6 +7809,20 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
7711
7809
|
);
|
|
7712
7810
|
|
|
7713
7811
|
|
|
7812
|
+
$templateCache.put('src/components/nice-toggle/nice-toggle.html',
|
|
7813
|
+
"<div class=\"nice-component nice-toggle\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\" ng-form=\"formToggle\">\n" +
|
|
7814
|
+
"<div class=\"row\">\n" +
|
|
7815
|
+
"<nice-title text=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
|
|
7816
|
+
"<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
|
|
7817
|
+
"<button class=\"nice-toggle-field\" ng-click=\"switch()\" ng-disabled=\"isDisabled\" type=\"button\">\n" +
|
|
7818
|
+
"<div class=\"nice-toggle-field-handle\" ng-class=\"{ 'active': model }\">{{ state }}</div>\n" +
|
|
7819
|
+
"</button>\n" +
|
|
7820
|
+
"</div>\n" +
|
|
7821
|
+
"</div>\n" +
|
|
7822
|
+
"</div>"
|
|
7823
|
+
);
|
|
7824
|
+
|
|
7825
|
+
|
|
7714
7826
|
$templateCache.put('src/components/nice-upload/nice-upload.html',
|
|
7715
7827
|
"<ng-form class=\"nice-component nice-upload\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\" name=\"form\">\n" +
|
|
7716
7828
|
"<div class=\"row\">\n" +
|