nice-elements 1.7.6 → 1.7.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 +11 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +66 -67
- package/dist/nice.min.js +1 -1
- package/dist/style.css +52 -11
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +2 -2
- package/package.json +1 -1
- package/src/components/nice-checkbox/nice-checkbox.html +3 -3
- package/src/components/nice-checkbox/nice-checkbox.js +7 -5
- package/src/components/nice-checkbox/nice-checkbox.scss +25 -2
- package/src/components/nice-choice/nice-choice.html +2 -1
- package/src/components/nice-choice/nice-choice.js +34 -35
- package/src/components/nice-choice/nice-choice.scss +34 -10
- package/src/components/nice-dropdown/nice-dropdown.html +1 -2
- package/src/components/nice-quantity/nice-quantity.html +3 -3
- package/src/components/nice-quantity/nice-quantity.js +16 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.7.8 (10.2.2023)
|
|
4
|
+
|
|
5
|
+
- worked on nice-quantity component
|
|
6
|
+
|
|
7
|
+
## v1.7.7 (10.1.2023)
|
|
8
|
+
|
|
9
|
+
- fixed nice-checkbox shrink problem,
|
|
10
|
+
- added isDisabled to nice-checkbox,
|
|
11
|
+
- changed nice-choice to match nice-checkbox,
|
|
12
|
+
- worked on nice-choice disabled state
|
|
13
|
+
|
|
3
14
|
## v1.7.6 (9.1.2023)
|
|
4
15
|
|
|
5
16
|
- added form required check to nice dropdown
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
# Nice elements v1.7.
|
|
3
|
+
# Nice elements v1.7.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
|
|
package/bower.json
CHANGED
package/dist/nice.js
CHANGED
|
@@ -410,7 +410,7 @@ angular.module('niceElements')
|
|
|
410
410
|
* # niceCheckbox
|
|
411
411
|
*/
|
|
412
412
|
angular.module('niceElements')
|
|
413
|
-
.directive('niceCheckbox', function() {
|
|
413
|
+
.directive('niceCheckbox', function () {
|
|
414
414
|
return {
|
|
415
415
|
templateUrl: 'src/components/nice-checkbox/nice-checkbox.html',
|
|
416
416
|
restrict: 'E',
|
|
@@ -418,12 +418,14 @@ angular.module('niceElements')
|
|
|
418
418
|
model: '=',
|
|
419
419
|
title: '@',
|
|
420
420
|
noMargin: '@',
|
|
421
|
-
onChange: '&?'
|
|
421
|
+
onChange: '&?',
|
|
422
|
+
isDisabled: '=',
|
|
422
423
|
},
|
|
423
|
-
controller: function($scope) {
|
|
424
|
-
if($scope.model === undefined) $scope.model = false;
|
|
424
|
+
controller: function ($scope) {
|
|
425
|
+
if ($scope.model === undefined) $scope.model = false;
|
|
425
426
|
|
|
426
|
-
$scope.toggle = function(){
|
|
427
|
+
$scope.toggle = function () {
|
|
428
|
+
if ($scope.isDisabled) return;
|
|
427
429
|
$scope.model = !$scope.model;
|
|
428
430
|
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
429
431
|
};
|
|
@@ -473,17 +475,17 @@ angular.module('niceElements')
|
|
|
473
475
|
attr.multiple = angular.isDefined(attr.multiple);
|
|
474
476
|
|
|
475
477
|
scope.firstTime = true;
|
|
476
|
-
scope.checkIfFirstTime = function(){
|
|
477
|
-
if (scope.firstTime){
|
|
478
|
+
scope.checkIfFirstTime = function () {
|
|
479
|
+
if (scope.firstTime) {
|
|
478
480
|
scope.firstTime = false;
|
|
479
481
|
return true;
|
|
480
|
-
}else{
|
|
482
|
+
} else {
|
|
481
483
|
return false;
|
|
482
484
|
}
|
|
483
485
|
};
|
|
484
486
|
|
|
485
487
|
// If selected is not yet defined
|
|
486
|
-
if(!angular.isDefined(scope.model)){
|
|
488
|
+
if (!angular.isDefined(scope.model)) {
|
|
487
489
|
if (scope.multiple) {
|
|
488
490
|
scope.model = [];
|
|
489
491
|
}
|
|
@@ -493,7 +495,7 @@ angular.module('niceElements')
|
|
|
493
495
|
if (scope.listIsObj) {
|
|
494
496
|
scope.internalList = scope.list;
|
|
495
497
|
} else {
|
|
496
|
-
scope.internalList =_.map(scope.list, function(val) {
|
|
498
|
+
scope.internalList = _.map(scope.list, function (val) {
|
|
497
499
|
var obj = {};
|
|
498
500
|
obj[scope.objKey] = val;
|
|
499
501
|
obj[scope.objValue] = val;
|
|
@@ -504,9 +506,9 @@ angular.module('niceElements')
|
|
|
504
506
|
// Set internalSelected
|
|
505
507
|
if (scope.selectedIsObj) {
|
|
506
508
|
scope.internalSelected = scope.model;
|
|
507
|
-
}else {
|
|
509
|
+
} else {
|
|
508
510
|
if (scope.multiple) {
|
|
509
|
-
scope.internalSelected =_.map(scope.model, function(val) {
|
|
511
|
+
scope.internalSelected = _.map(scope.model, function (val) {
|
|
510
512
|
var obj = {};
|
|
511
513
|
obj[scope.objKey] = val;
|
|
512
514
|
obj[scope.objValue] = val;
|
|
@@ -518,14 +520,14 @@ angular.module('niceElements')
|
|
|
518
520
|
obj[scope.objKey] = scope.model;
|
|
519
521
|
obj[scope.objValue] = scope.model;
|
|
520
522
|
scope.internalSelected = obj;
|
|
521
|
-
}else{
|
|
523
|
+
} else {
|
|
522
524
|
scope.internalSelected = scope.internalList[0];
|
|
523
525
|
}
|
|
524
526
|
}
|
|
525
527
|
}
|
|
526
528
|
},
|
|
527
|
-
controller: function($rootScope, $scope) {
|
|
528
|
-
var getFilter = function(item){
|
|
529
|
+
controller: function ($rootScope, $scope) {
|
|
530
|
+
var getFilter = function (item) {
|
|
529
531
|
// Create filter for finding object by objValue with _.where()
|
|
530
532
|
var filter = {};
|
|
531
533
|
if (item.hasOwnProperty($scope.objKey))
|
|
@@ -535,40 +537,39 @@ angular.module('niceElements')
|
|
|
535
537
|
return filter;
|
|
536
538
|
};
|
|
537
539
|
|
|
538
|
-
$scope.setDefault = function(){
|
|
539
|
-
if(!$scope.multiple){
|
|
540
|
+
$scope.setDefault = function () {
|
|
541
|
+
if (!$scope.multiple) {
|
|
540
542
|
$scope.internalSelected = $scope.internalList[0];
|
|
541
543
|
}
|
|
542
544
|
};
|
|
543
545
|
|
|
544
|
-
$scope.isItemSelected = function(item){
|
|
546
|
+
$scope.isItemSelected = function (item) {
|
|
545
547
|
if (!$scope.internalSelected)
|
|
546
548
|
return false;
|
|
547
549
|
// Which item is selected
|
|
548
550
|
if ($scope.multiple) {
|
|
549
|
-
|
|
550
|
-
}else{
|
|
551
|
-
|
|
551
|
+
return _.where($scope.internalSelected, getFilter(item)).length > 0;
|
|
552
|
+
} else {
|
|
553
|
+
return $scope.internalSelected[$scope.objKey] == item[$scope.objKey];
|
|
552
554
|
}
|
|
553
555
|
};
|
|
554
556
|
|
|
555
|
-
$scope.toggle = function(item) {
|
|
556
|
-
if (
|
|
557
|
-
|
|
557
|
+
$scope.toggle = function (item) {
|
|
558
|
+
if ($scope.isDisabled) return;
|
|
559
|
+
$scope.formChoice.$setDirty();
|
|
558
560
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
+
if (!$scope.multiple) {
|
|
562
|
+
$scope.internalSelected = item;
|
|
563
|
+
} else {
|
|
564
|
+
if ($scope.isItemSelected(item)) {
|
|
565
|
+
$scope.internalSelected = _.without($scope.internalSelected, _.findWhere($scope.internalSelected, getFilter(item)));
|
|
561
566
|
} else {
|
|
562
|
-
|
|
563
|
-
$scope.internalSelected = _.without($scope.internalSelected, _.findWhere($scope.internalSelected, getFilter(item)));
|
|
564
|
-
} else {
|
|
565
|
-
$scope.internalSelected.push(item);
|
|
566
|
-
}
|
|
567
|
+
$scope.internalSelected.push(item);
|
|
567
568
|
}
|
|
568
569
|
}
|
|
569
570
|
};
|
|
570
571
|
|
|
571
|
-
$scope.getLabel = function(item){
|
|
572
|
+
$scope.getLabel = function (item) {
|
|
572
573
|
return item[$scope.objValue];
|
|
573
574
|
};
|
|
574
575
|
|
|
@@ -576,8 +577,8 @@ angular.module('niceElements')
|
|
|
576
577
|
// Set internalList
|
|
577
578
|
if ($scope.listIsObj) {
|
|
578
579
|
$scope.internalList = $scope.list;
|
|
579
|
-
}else{
|
|
580
|
-
$scope.internalList =_.map($scope.list, function(val) {
|
|
580
|
+
} else {
|
|
581
|
+
$scope.internalList = _.map($scope.list, function (val) {
|
|
581
582
|
var obj = {};
|
|
582
583
|
obj[$scope.objKey] = val;
|
|
583
584
|
obj[$scope.objValue] = val;
|
|
@@ -588,11 +589,11 @@ angular.module('niceElements')
|
|
|
588
589
|
|
|
589
590
|
$scope.$watchCollection('internalSelected', function (value_new, value_old) {
|
|
590
591
|
// Update $scope.selected based on settings
|
|
591
|
-
if (value_new && (!angular.equals(value_new, value_old) || $scope.checkIfFirstTime())){
|
|
592
|
-
if ($scope.selectedIsObj){
|
|
592
|
+
if (value_new && (!angular.equals(value_new, value_old) || $scope.checkIfFirstTime())) {
|
|
593
|
+
if ($scope.selectedIsObj) {
|
|
593
594
|
$scope.model = value_new;
|
|
594
595
|
} else {
|
|
595
|
-
if ($scope.multiple){
|
|
596
|
+
if ($scope.multiple) {
|
|
596
597
|
$scope.model = _.map(value_new, $scope.objKey);
|
|
597
598
|
} else {
|
|
598
599
|
$scope.model = value_new[$scope.objKey];
|
|
@@ -604,8 +605,8 @@ angular.module('niceElements')
|
|
|
604
605
|
|
|
605
606
|
$scope.$watchCollection('model', function (value_new, value_old) {
|
|
606
607
|
if (!angular.equals(value_new, value_old)) {
|
|
607
|
-
if (!value_new){
|
|
608
|
-
if(!$scope.multiple)
|
|
608
|
+
if (!value_new) {
|
|
609
|
+
if (!$scope.multiple)
|
|
609
610
|
$scope.internalSelected = $scope.internalList[0];
|
|
610
611
|
else
|
|
611
612
|
$scope.internalSelected = [];
|
|
@@ -626,7 +627,7 @@ angular.module('niceElements')
|
|
|
626
627
|
}
|
|
627
628
|
}
|
|
628
629
|
|
|
629
|
-
if(!value_new){
|
|
630
|
+
if (!value_new) {
|
|
630
631
|
if (!$scope.multiple) {
|
|
631
632
|
$scope.internalSelected = $scope.internalList[0];
|
|
632
633
|
}
|
|
@@ -4381,7 +4382,8 @@ angular.module('niceElements')
|
|
|
4381
4382
|
scope: {
|
|
4382
4383
|
title: '@',
|
|
4383
4384
|
model: '=',
|
|
4384
|
-
|
|
4385
|
+
min: '=?',
|
|
4386
|
+
max: '=?',
|
|
4385
4387
|
onChange: '&?',
|
|
4386
4388
|
noMargin: '@',
|
|
4387
4389
|
fieldWidth: '@',
|
|
@@ -4391,32 +4393,29 @@ angular.module('niceElements')
|
|
|
4391
4393
|
help: '@',
|
|
4392
4394
|
},
|
|
4393
4395
|
controller: function ($scope) {
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4396
|
+
$scope.min = Number($scope.min) || 0;
|
|
4397
|
+
$scope.max = Number($scope.max) || Infinity;
|
|
4398
|
+
if (!$scope.model) $scope.model = Number($scope.min);
|
|
4397
4399
|
|
|
4398
4400
|
$scope.add = function () {
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
$scope.model += 1;
|
|
4402
|
-
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
4403
|
-
}
|
|
4404
|
-
} else {
|
|
4405
|
-
$scope.model += 1;
|
|
4406
|
-
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
4407
|
-
}
|
|
4401
|
+
$scope.model += 1;
|
|
4402
|
+
$scope.handleChange();
|
|
4408
4403
|
};
|
|
4409
4404
|
|
|
4410
4405
|
$scope.sub = function () {
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
4414
|
-
}
|
|
4406
|
+
$scope.model -= 1;
|
|
4407
|
+
$scope.handleChange();
|
|
4415
4408
|
};
|
|
4416
4409
|
|
|
4417
4410
|
$scope.handleChange = function () {
|
|
4418
|
-
if ($scope.model) {
|
|
4411
|
+
if ($scope.model != undefined) {
|
|
4419
4412
|
$scope.model = Number($scope.model);
|
|
4413
|
+
if ($scope.model < $scope.min) $scope.model = angular.copy($scope.min);
|
|
4414
|
+
if ($scope.model > $scope.max) $scope.model = angular.copy($scope.max);
|
|
4415
|
+
if ($scope.onChange) $scope.onChange({ model: $scope.model });
|
|
4416
|
+
} else {
|
|
4417
|
+
$scope.model = angular.copy($scope.min);
|
|
4418
|
+
$scope.handleChange();
|
|
4420
4419
|
}
|
|
4421
4420
|
};
|
|
4422
4421
|
}
|
|
@@ -5563,11 +5562,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5563
5562
|
|
|
5564
5563
|
|
|
5565
5564
|
$templateCache.put('src/components/nice-checkbox/nice-checkbox.html',
|
|
5566
|
-
"<div class=\"nice-component nice-checkbox\" ng-class=\"{ 'checked': model, 'margin-bottom-0' : noMargin }\" ng-click=\"toggle()\">\n" +
|
|
5567
|
-
"<button class=\"btn checkbox\">\n" +
|
|
5565
|
+
"<div class=\"nice-component nice-checkbox\" ng-class=\"{ 'checked': model, 'margin-bottom-0' : noMargin, 'nice-checkbox-disabled': isDisabled }\" ng-click=\"toggle()\">\n" +
|
|
5566
|
+
"<button class=\"btn checkbox\" ng-disabled=\"isDisabled\">\n" +
|
|
5568
5567
|
"<nice-icon class=\"check\" icon=\"icon-check\"></nice-icon>\n" +
|
|
5569
5568
|
"</button>\n" +
|
|
5570
|
-
"<div ng-if=\"title\" class=\"message\">{{ title }}</div>\n" +
|
|
5569
|
+
"<div ng-if=\"title\" class=\"message\" ng-class=\"{ 'nice-disabled': isDisabled }\">{{ title }}</div>\n" +
|
|
5571
5570
|
"</div>"
|
|
5572
5571
|
);
|
|
5573
5572
|
|
|
@@ -5580,7 +5579,8 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5580
5579
|
"<ul class=\"list-unstyled\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
|
|
5581
5580
|
"<li ng-repeat=\"item in internalList\" ng-class=\"{ 'selected' : isItemSelected(item) }\" ng-click=\"toggle(item)\">\n" +
|
|
5582
5581
|
"<button class=\"choice-checkbox\" ng-class=\"{'circle' : !multiple }\" ng-disabled=\"isDisabled\">\n" +
|
|
5583
|
-
"<nice-icon icon=\"icon-check\"></nice-icon>\n" +
|
|
5582
|
+
"<nice-icon ng-if=\"multiple\" icon=\"icon-check\"></nice-icon>\n" +
|
|
5583
|
+
"<div ng-if=\"!multiple\" class=\"multiple-circle\"></div>\n" +
|
|
5584
5584
|
"</button>\n" +
|
|
5585
5585
|
"<div ng-transclude class=\"choice-label\">{{ getLabel(item) }}</div>\n" +
|
|
5586
5586
|
"</li>\n" +
|
|
@@ -5892,7 +5892,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5892
5892
|
|
|
5893
5893
|
|
|
5894
5894
|
$templateCache.put('src/components/nice-dropdown/nice-dropdown.html',
|
|
5895
|
-
"<div class=\"nice-component nice-dropdown\" ng-class=\"{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }\">\n" +
|
|
5895
|
+
"<div class=\"nice-component nice-dropdown\" ng-class=\"{ 'margin-bottom-0': noMargin, 'nice-component-inline': isInline }\" ng-form=\"formDropdown\">\n" +
|
|
5896
5896
|
"<div class=\"row\">\n" +
|
|
5897
5897
|
"<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
|
|
5898
5898
|
"<div class=\"nice-field col-xs-12\" ng-class=\"[ fieldWidth ? fieldWidth : 'col-sm-8', { 'open': isOpen, 'nice-disabled': isDisabled || emptyList } ]\" click-outside=\"close()\" is-open=\"{{ isOpen }}\">\n" +
|
|
@@ -5936,7 +5936,6 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
5936
5936
|
"</div>\n" +
|
|
5937
5937
|
"</div>\n" +
|
|
5938
5938
|
"</div>\n" +
|
|
5939
|
-
"<div ng-form=\"formDropdown\"></div>\n" +
|
|
5940
5939
|
"</div>"
|
|
5941
5940
|
);
|
|
5942
5941
|
|
|
@@ -6210,11 +6209,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
|
|
|
6210
6209
|
"<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
|
|
6211
6210
|
"<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
|
|
6212
6211
|
"<div class=\"input-group\">\n" +
|
|
6213
|
-
"<button class=\"btn btn-default btn-left\" ng-click=\"sub()\" type=\"button\" ng-disabled=\"isDisabled\" tabindex=\"-1\">\n" +
|
|
6212
|
+
"<button class=\"btn btn-default btn-left\" ng-click=\"sub()\" type=\"button\" ng-disabled=\"model <= min || isDisabled\" tabindex=\"-1\">\n" +
|
|
6214
6213
|
"<nice-icon icon=\"icon-minus\"></nice-icon>\n" +
|
|
6215
6214
|
"</button>\n" +
|
|
6216
|
-
"<input class=\"value form-control\" ng-model=\"model\" type=\"number\" ng-change=\"handleChange()\" ng-disabled=\"isDisabled\">\n" +
|
|
6217
|
-
"<button class=\"btn btn-default btn-right\" ng-click=\"add()\" type=\"button\" ng-disabled=\"isDisabled\" tabindex=\"-1\">\n" +
|
|
6215
|
+
"<input class=\"value form-control\" ng-model=\"model\" type=\"number\" min=\"{{ min }}\" max=\"{{ max }}\" ng-change=\"handleChange()\" ng-disabled=\"isDisabled\">\n" +
|
|
6216
|
+
"<button class=\"btn btn-default btn-right\" ng-click=\"add()\" type=\"button\" ng-disabled=\"model >= max || isDisabled\" tabindex=\"-1\">\n" +
|
|
6218
6217
|
"<nice-icon icon=\"icon-plus\"></nice-icon>\n" +
|
|
6219
6218
|
"</button>\n" +
|
|
6220
6219
|
"</div>\n" +
|