nice-elements 1.8.5 → 1.8.6

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.8.6 (8.6.2023)
4
+
5
+ - worked on nice-dropdown filter function,
6
+ - created nice-pill component
7
+
3
8
  ## v1.8.5 (7.6.2023)
4
9
 
5
10
  - added filter again when dropdown is open in nice-dropdown,
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![Nice elements](https://github.com/Klemen1337/angularjs-nice-elements/raw/master/demo/assets/logo.png)
2
2
 
3
- # Nice elements v1.8.5
3
+ # Nice elements v1.8.6
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
 
@@ -45,6 +45,7 @@ Nice elements is an AngularJS v1.5.8 module that contains nice form elements lik
45
45
  - nice-tooltip
46
46
  - nice-upload
47
47
  - nice-yesno
48
+ - nice-pill
48
49
  - ~~nice-datetime-picker~~ (DEPREACATED)
49
50
  - ~~nice-datetimerange-picker~~ (DEPREACATED)
50
51
  - ~~nice-dtp~~ (DEPREACATED)
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -2377,6 +2377,10 @@ angular.module('niceElements')
2377
2377
  search: ""
2378
2378
  };
2379
2379
 
2380
+ if ($scope.list) {
2381
+ $scope.originalList = angular.copy($scope.list);
2382
+ }
2383
+
2380
2384
  // Setup popper
2381
2385
  // https://popper.js.org/docs/v2/constructors/
2382
2386
  $scope.setupPopper = function () {
@@ -2431,9 +2435,9 @@ angular.module('niceElements')
2431
2435
 
2432
2436
  $scope.open = function () {
2433
2437
  $scope.popper.update();
2438
+ if ($scope.filterFunction) $scope.internalList = $scope.filterFunction($scope.originalList);
2434
2439
  $timeout(function () {
2435
2440
  $scope.isOpen = true;
2436
- $scope.handleSearch();
2437
2441
  $timeout(function () {
2438
2442
  $scope.popper.update();
2439
2443
  });
@@ -2507,6 +2511,13 @@ angular.module('niceElements')
2507
2511
  };
2508
2512
 
2509
2513
 
2514
+ $scope.handleNewInternalList = function (items) {
2515
+ $scope.originalList = angular.copy(items);
2516
+ if ($scope.filterFunction) $scope.internalList = $scope.filterFunction($scope.originalList);
2517
+ else $scope.internalList = items;
2518
+ }
2519
+
2520
+
2510
2521
  // ----------------------------------- Scroll to hover -----------------------------------
2511
2522
  $scope.scrollToHover = function (notSmooth) {
2512
2523
  var dropdownMenu = $element[0].getElementsByClassName("nice-dropdown-menu")[0];
@@ -2528,8 +2539,7 @@ angular.module('niceElements')
2528
2539
  if (!$scope.searchFunction) return;
2529
2540
  $scope.loading = true;
2530
2541
  $scope.searchFunction($scope.internal.search).then(function (response) {
2531
- if ($scope.filterFunction) $scope.internalList = $scope.filterFunction(response);
2532
- else $scope.internalList = response;
2542
+ $scope.handleNewInternalList(response);
2533
2543
  $scope.loading = false;
2534
2544
  $scope.handleDefault();
2535
2545
  }, function (error) {
@@ -2636,8 +2646,7 @@ angular.module('niceElements')
2636
2646
 
2637
2647
  // ----------------------------------- Watch for list change -----------------------------------
2638
2648
  $scope.$watchCollection('list', function (value_new, value_old) {
2639
- if ($scope.filterFunction) $scope.internalList = $scope.filterFunction(angular.copy($scope.list));
2640
- else $scope.internalList = angular.copy($scope.list);
2649
+ $scope.handleNewInternalList(angular.copy($scope.list));
2641
2650
  $scope.handleDefault();
2642
2651
  });
2643
2652
 
@@ -4272,6 +4281,36 @@ angular.module('niceElements')
4272
4281
 
4273
4282
  'use strict';
4274
4283
 
4284
+ /**
4285
+ * @ngdoc directive
4286
+ * @name niceElements.directive:nicePill
4287
+ * @description
4288
+ * # nicePill
4289
+ */
4290
+ angular.module('niceElements')
4291
+ .directive('nicePill', function () {
4292
+ return {
4293
+ templateUrl: 'src/components/nice-pill/nice-pill.html',
4294
+ restrict: 'E',
4295
+ transclude: true,
4296
+ scope: {
4297
+ model: '=',
4298
+ valueKey: '@',
4299
+ canDelete: '@',
4300
+ onDelete: '=?',
4301
+ },
4302
+ controller: function ($scope) {
4303
+ if (!$scope.valueKey) $scope.valueKey = "value";
4304
+
4305
+ $scope.handleDelete = function () {
4306
+ $scope.onDelete($scope.model)
4307
+ }
4308
+ }
4309
+ };
4310
+ });
4311
+
4312
+ 'use strict';
4313
+
4275
4314
  /**
4276
4315
  * @ngdoc directive
4277
4316
  * @name niceElements.directive:nicePopup
@@ -5593,7 +5632,7 @@ angular.module('niceElements')
5593
5632
  .service('NiceService', function () {
5594
5633
  var service = {
5595
5634
  name: "Nice elements",
5596
- version: "1.8.5",
5635
+ version: "1.8.6",
5597
5636
  getHeader: function () {
5598
5637
  return {};
5599
5638
  }
@@ -6321,6 +6360,14 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
6321
6360
  );
6322
6361
 
6323
6362
 
6363
+ $templateCache.put('src/components/nice-pill/nice-pill.html',
6364
+ "<div class=\"nice-pill\">\n" +
6365
+ "<div class=\"nice-pill-inner\" ng-transclude></div>\n" +
6366
+ "<nice-button class=\"nice-pill-remove btn-primary-naked\" icon=\"icon-x\" nice-click=\"handleDelete()\" ng-if=\"onDelete\"></nice-button>\n" +
6367
+ "</div>"
6368
+ );
6369
+
6370
+
6324
6371
  $templateCache.put('src/components/nice-popup/nice-popup.html',
6325
6372
  "<div class=\"nice-popup\" click-outside=\"close()\">\n" +
6326
6373
  "<div class=\"nice-popup-target\" ng-transclude=\"target\" ng-click=\"toggle()\"></div>\n" +