nice-elements 1.8.3 → 1.8.5
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 +14 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +74 -61
- package/dist/nice.min.js +1 -1
- package/dist/style.css +30 -1
- package/dist/style.css.map +1 -1
- package/dist/style.min.css +1 -1
- package/package.json +1 -1
- package/src/components/nice-datetimerange-picker-2/nice-datetimerange-picker-2.scss +22 -0
- package/src/components/nice-dropdown/nice-dropdown.html +10 -9
- package/src/components/nice-dropdown/nice-dropdown.js +64 -49
- package/src/components/nice-dropdown/nice-dropdown.scss +12 -2
- package/src/components/nice-icon/nice-icon.html +1 -1
- package/src/components/nice-icon/nice-icon.js +2 -1
- package/src/services/nice-service.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.8.5 (7.6.2023)
|
|
4
|
+
|
|
5
|
+
- added filter again when dropdown is open in nice-dropdown,
|
|
6
|
+
- added clear search button to nice-dropdown,
|
|
7
|
+
- removed keydown and keypress event bind in nice-dropdown,
|
|
8
|
+
- added aria support for nice-dropdown
|
|
9
|
+
|
|
10
|
+
## v1.8.4 (2.6.2023)
|
|
11
|
+
|
|
12
|
+
- added filterFunction to nice dropdown,
|
|
13
|
+
- worked on nice-datetimerange-picker-2 mobile style,
|
|
14
|
+
- added size param to nice-icon,
|
|
15
|
+
- worked on nice-icon demo view
|
|
16
|
+
|
|
3
17
|
## v1.8.3 (30.5.2023)
|
|
4
18
|
|
|
5
19
|
- added clickDisabled prop to nice-checkbox component
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
# Nice elements v1.8.
|
|
3
|
+
# Nice elements v1.8.5
|
|
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
|
@@ -2347,11 +2347,13 @@ angular.module('niceElements')
|
|
|
2347
2347
|
selectedText: '@',
|
|
2348
2348
|
dropdownDistance: '@',
|
|
2349
2349
|
searchFunction: '=?',
|
|
2350
|
+
filterFunction: '=?',
|
|
2350
2351
|
isInline: '=',
|
|
2351
2352
|
clearOnSelect: '@',
|
|
2352
2353
|
enableLoadMore: '@' // Enable load more
|
|
2353
2354
|
},
|
|
2354
2355
|
controller: function ($scope, $http, $element, $timeout, gettextCatalog, NiceService) {
|
|
2356
|
+
$scope.id = Math.random().toString(36).substring(7);
|
|
2355
2357
|
if (!$scope.dropdownDistance) { $scope.dropdownDistance = 5; }
|
|
2356
2358
|
if (!$scope.objValue) { $scope.objValue = 'value'; }
|
|
2357
2359
|
if (!$scope.objKey) { $scope.objKey = 'id'; }
|
|
@@ -2368,7 +2370,7 @@ angular.module('niceElements')
|
|
|
2368
2370
|
$scope.clearOnSelect = $scope.clearOnSelect === 'true' || $scope.clearOnSelect === true;
|
|
2369
2371
|
$scope.isOpen = false;
|
|
2370
2372
|
$scope.selected = null;
|
|
2371
|
-
$scope.selectedIndex = 0;
|
|
2373
|
+
// $scope.selectedIndex = 0;
|
|
2372
2374
|
$scope.popper = null;
|
|
2373
2375
|
|
|
2374
2376
|
$scope.internal = {
|
|
@@ -2431,6 +2433,7 @@ angular.module('niceElements')
|
|
|
2431
2433
|
$scope.popper.update();
|
|
2432
2434
|
$timeout(function () {
|
|
2433
2435
|
$scope.isOpen = true;
|
|
2436
|
+
$scope.handleSearch();
|
|
2434
2437
|
$timeout(function () {
|
|
2435
2438
|
$scope.popper.update();
|
|
2436
2439
|
});
|
|
@@ -2522,9 +2525,11 @@ angular.module('niceElements')
|
|
|
2522
2525
|
|
|
2523
2526
|
// ----------------------------------- Search -----------------------------------
|
|
2524
2527
|
$scope.handleSearch = function () {
|
|
2528
|
+
if (!$scope.searchFunction) return;
|
|
2525
2529
|
$scope.loading = true;
|
|
2526
2530
|
$scope.searchFunction($scope.internal.search).then(function (response) {
|
|
2527
|
-
$scope.internalList = response;
|
|
2531
|
+
if ($scope.filterFunction) $scope.internalList = $scope.filterFunction(response);
|
|
2532
|
+
else $scope.internalList = response;
|
|
2528
2533
|
$scope.loading = false;
|
|
2529
2534
|
$scope.handleDefault();
|
|
2530
2535
|
}, function (error) {
|
|
@@ -2533,6 +2538,11 @@ angular.module('niceElements')
|
|
|
2533
2538
|
});
|
|
2534
2539
|
};
|
|
2535
2540
|
|
|
2541
|
+
$scope.clearSearch = function () {
|
|
2542
|
+
$scope.internal.search = "";
|
|
2543
|
+
$scope.handleSearch();
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2536
2546
|
|
|
2537
2547
|
// ----------------------------------- Item clicked -----------------------------------
|
|
2538
2548
|
$scope.handleSelected = function (item, index) {
|
|
@@ -2626,7 +2636,8 @@ angular.module('niceElements')
|
|
|
2626
2636
|
|
|
2627
2637
|
// ----------------------------------- Watch for list change -----------------------------------
|
|
2628
2638
|
$scope.$watchCollection('list', function (value_new, value_old) {
|
|
2629
|
-
$scope.internalList = angular.copy($scope.list);
|
|
2639
|
+
if ($scope.filterFunction) $scope.internalList = $scope.filterFunction(angular.copy($scope.list));
|
|
2640
|
+
else $scope.internalList = angular.copy($scope.list);
|
|
2630
2641
|
$scope.handleDefault();
|
|
2631
2642
|
});
|
|
2632
2643
|
|
|
@@ -2649,7 +2660,7 @@ angular.module('niceElements')
|
|
|
2649
2660
|
if (i[$scope.objKey] == s) {
|
|
2650
2661
|
i._selected = true;
|
|
2651
2662
|
// $scope.selected.push(i);
|
|
2652
|
-
$scope.selectedIndex = index;
|
|
2663
|
+
// $scope.selectedIndex = index;
|
|
2653
2664
|
}
|
|
2654
2665
|
});
|
|
2655
2666
|
} else {
|
|
@@ -2657,7 +2668,7 @@ angular.module('niceElements')
|
|
|
2657
2668
|
if ($scope.selected != null && i[$scope.objKey] == $scope.selected) {
|
|
2658
2669
|
i._selected = true;
|
|
2659
2670
|
$scope.selected = i;
|
|
2660
|
-
$scope.selectedIndex = index;
|
|
2671
|
+
// $scope.selectedIndex = index;
|
|
2661
2672
|
$scope.scrollToHover();
|
|
2662
2673
|
}
|
|
2663
2674
|
}
|
|
@@ -2669,7 +2680,7 @@ angular.module('niceElements')
|
|
|
2669
2680
|
if (i[$scope.objKey] == s[$scope.objKey]) {
|
|
2670
2681
|
i._selected = true;
|
|
2671
2682
|
// $scope.selected.push(i);
|
|
2672
|
-
$scope.selectedIndex = index;
|
|
2683
|
+
// $scope.selectedIndex = index;
|
|
2673
2684
|
}
|
|
2674
2685
|
});
|
|
2675
2686
|
} else {
|
|
@@ -2677,7 +2688,7 @@ angular.module('niceElements')
|
|
|
2677
2688
|
if ($scope.selected != null && i[$scope.objKey] == $scope.selected[$scope.objKey]) {
|
|
2678
2689
|
i._selected = true;
|
|
2679
2690
|
$scope.selected = i;
|
|
2680
|
-
$scope.selectedIndex = index;
|
|
2691
|
+
// $scope.selectedIndex = index;
|
|
2681
2692
|
$scope.scrollToHover();
|
|
2682
2693
|
}
|
|
2683
2694
|
}
|
|
@@ -2691,48 +2702,48 @@ angular.module('niceElements')
|
|
|
2691
2702
|
}
|
|
2692
2703
|
|
|
2693
2704
|
// ----------------------------------- Watch for keydown and keypress -----------------------------------
|
|
2694
|
-
$element.bind("keydown keypress", function (event) {
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
});
|
|
2705
|
+
// $element.bind("keydown keypress", function (event) {
|
|
2706
|
+
// // Arrow Up
|
|
2707
|
+
// if (event.keyCode == 38) {
|
|
2708
|
+
// event.preventDefault();
|
|
2709
|
+
// $timeout(function () {
|
|
2710
|
+
// if ($scope.selectedIndex > 0) {
|
|
2711
|
+
// $scope.selectedIndex -= 1;
|
|
2712
|
+
// $timeout(function () {
|
|
2713
|
+
// $scope.scrollToHover();
|
|
2714
|
+
// });
|
|
2715
|
+
// }
|
|
2716
|
+
// });
|
|
2717
|
+
// }
|
|
2718
|
+
|
|
2719
|
+
// // Arrow Down
|
|
2720
|
+
// if (event.keyCode == 40) {
|
|
2721
|
+
// event.preventDefault();
|
|
2722
|
+
// $timeout(function () {
|
|
2723
|
+
// if ($scope.internalList && $scope.selectedIndex < $scope.internalList.length - 1) {
|
|
2724
|
+
// $scope.selectedIndex += 1;
|
|
2725
|
+
// $timeout(function () {
|
|
2726
|
+
// $scope.scrollToHover();
|
|
2727
|
+
// });
|
|
2728
|
+
// }
|
|
2729
|
+
// });
|
|
2730
|
+
// }
|
|
2731
|
+
|
|
2732
|
+
// // Enter
|
|
2733
|
+
// if (event.keyCode == 13) {
|
|
2734
|
+
// event.preventDefault();
|
|
2735
|
+
// $timeout(function () {
|
|
2736
|
+
// $scope.handleSelected($scope.internalList[$scope.selectedIndex], $scope.selectedIndex);
|
|
2737
|
+
// });
|
|
2738
|
+
// }
|
|
2739
|
+
|
|
2740
|
+
// // Escape
|
|
2741
|
+
// if (event.keyCode == 27) {
|
|
2742
|
+
// $timeout(function () {
|
|
2743
|
+
// $scope.close();
|
|
2744
|
+
// });
|
|
2745
|
+
// }
|
|
2746
|
+
// });
|
|
2736
2747
|
|
|
2737
2748
|
$scope.handleDefault();
|
|
2738
2749
|
|
|
@@ -3648,7 +3659,8 @@ angular.module('niceElements')
|
|
|
3648
3659
|
restrict: 'E',
|
|
3649
3660
|
replace: true,
|
|
3650
3661
|
scope: {
|
|
3651
|
-
icon: '@'
|
|
3662
|
+
icon: '@',
|
|
3663
|
+
size: '=',
|
|
3652
3664
|
},
|
|
3653
3665
|
};
|
|
3654
3666
|
});
|
|
@@ -5581,7 +5593,7 @@ angular.module('niceElements')
|
|
|
5581
5593
|
.service('NiceService', function () {
|
|
5582
5594
|
var service = {
|
|
5583
5595
|
name: "Nice elements",
|
|
5584
|
-
version: "1.8.
|
|
5596
|
+
version: "1.8.5",
|
|
5585
5597
|
getHeader: function () {
|
|
5586
5598
|
return {};
|
|
5587
5599
|
}
|
|
@@ -6031,7 +6043,7 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
|
|
|
6031
6043
|
"<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
|
|
6032
6044
|
"<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" +
|
|
6033
6045
|
"<div class=\"nice-field-wrapper\">\n" +
|
|
6034
|
-
"<button class=\"btn btn-dropdown\" type=\"button\" ng-ref=\"dropdown-button\" ng-click=\"toggle()\" ng-disabled=\"isDisabled || emptyList\">\n" +
|
|
6046
|
+
"<button class=\"btn btn-dropdown\" type=\"button\" ng-ref=\"dropdown-button\" ng-click=\"toggle()\" ng-disabled=\"isDisabled || emptyList\" aria-expanded=\"{{ isOpen }}\" aria-haspopup=\"true\" aria-controls=\"menu\" id=\"nice-dropdown-{{ id }}\">\n" +
|
|
6035
6047
|
"<div class=\"btn-dropdown-inside\" ng-transclude=\"button\" ng-if=\"selected != null\">\n" +
|
|
6036
6048
|
"<span ng-if=\"!multiple\">{{ selected[objValue] }}</span>\n" +
|
|
6037
6049
|
"<span ng-if=\"multiple\">\n" +
|
|
@@ -6049,17 +6061,18 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
|
|
|
6049
6061
|
"<div class=\"search-bar\" ng-if=\"searchFunction\">\n" +
|
|
6050
6062
|
"<input ng-model=\"internal.search\" ng-model-options=\"{ debounce: 500 }\" ng-change=\"handleSearch()\" placeholder=\"{{ searchText }}\">\n" +
|
|
6051
6063
|
"<div class=\"count\" ng-if=\"internalList && internalList._metadata && enableLoadMore\">{{ internalList.length }}/{{ internalList._metadata.count }}</div>\n" +
|
|
6052
|
-
"<nice-icon class=\"icon\" icon=\"icon-search\"></nice-icon>\n" +
|
|
6064
|
+
"<nice-icon ng-if=\"!internal.search\" class=\"icon\" icon=\"icon-search\"></nice-icon>\n" +
|
|
6065
|
+
"<nice-icon ng-if=\"internal.search\" class=\"icon icon-trash\" icon=\"icon-trash\" ng-click=\"clearSearch()\"></nice-icon>\n" +
|
|
6053
6066
|
"</div>\n" +
|
|
6054
|
-
"<div class=\"nice-dropdown-items\">\n" +
|
|
6055
|
-
"<div class=\"nice-no-data\" ng-if=\"internalList && internalList.length == 0\">{{ noDataText }}</div>\n" +
|
|
6056
|
-
"<
|
|
6067
|
+
"<div class=\"nice-dropdown-items\" aria-labelledby=\"nice-dropdown-{{ id }}\" role=\"listbox\">\n" +
|
|
6068
|
+
"<div role=\"none\" class=\"nice-no-data\" ng-if=\"internalList && internalList.length == 0\">{{ noDataText }}</div>\n" +
|
|
6069
|
+
"<button role=\"option\" class=\"nice-dropdown-item null-item\" ng-if=\"nullable && internalList.length != 0\" ng-click=\"handleSelected(null, -1)\">\n" +
|
|
6057
6070
|
"{{ nullableText }}\n" +
|
|
6058
|
-
"</
|
|
6059
|
-
"<
|
|
6060
|
-
"<div class=\"choice-checkbox\" ng-if=\"multiple\"><i class=\"fa fa-check\"></i></div>\n" +
|
|
6071
|
+
"</button>\n" +
|
|
6072
|
+
"<button role=\"option\" class=\"nice-dropdown-item\" ng-repeat=\"item in internalList\" ng-click=\"handleSelected(item, $index)\" ng-class=\"{ 'selected': item._selected }\">\n" +
|
|
6073
|
+
"<div class=\"choice-checkbox\" ng-if=\"multiple\" role=\"menuitemcheckbox\"><i class=\"fa fa-check\"></i></div>\n" +
|
|
6061
6074
|
"<div class=\"choice-option\" ng-transclude=\"option\" ng-class=\"{ 'multiple-item': multiple }\">{{ item[objValue] }}</div>\n" +
|
|
6062
|
-
"</
|
|
6075
|
+
"</button>\n" +
|
|
6063
6076
|
"</div>\n" +
|
|
6064
6077
|
"</div>\n" +
|
|
6065
6078
|
"</div>\n" +
|
|
@@ -6174,7 +6187,7 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
|
|
|
6174
6187
|
|
|
6175
6188
|
|
|
6176
6189
|
$templateCache.put('src/components/nice-icon/nice-icon.html',
|
|
6177
|
-
"<svg class=\"nice-icon\">\n" +
|
|
6190
|
+
"<svg class=\"nice-icon\" ng-style=\"{ 'width': size + 'px', 'height': size + 'px' }\">\n" +
|
|
6178
6191
|
"<use ng-attr-xlink:href=\"{{ '#' + icon }}\" xlink:href=\"\"></use>\n" +
|
|
6179
6192
|
"</svg>"
|
|
6180
6193
|
);
|