nice-elements 1.8.5 → 1.8.7

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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.8.7 (26.6.2023)
4
+
5
+ - changed trash can with x - OLA-639
6
+
7
+ ## v1.8.6 (8.6.2023)
8
+
9
+ - worked on nice-dropdown filter function,
10
+ - created nice-pill component
11
+
3
12
  ## v1.8.5 (7.6.2023)
4
13
 
5
14
  - 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.7
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.7",
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.7",
5597
5636
  getHeader: function () {
5598
5637
  return {};
5599
5638
  }
@@ -6062,7 +6101,7 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
6062
6101
  "<input ng-model=\"internal.search\" ng-model-options=\"{ debounce: 500 }\" ng-change=\"handleSearch()\" placeholder=\"{{ searchText }}\">\n" +
6063
6102
  "<div class=\"count\" ng-if=\"internalList && internalList._metadata && enableLoadMore\">{{ internalList.length }}/{{ internalList._metadata.count }}</div>\n" +
6064
6103
  "<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" +
6104
+ "<nice-icon ng-if=\"internal.search\" class=\"icon\" icon=\"icon-x\" ng-click=\"clearSearch()\"></nice-icon>\n" +
6066
6105
  "</div>\n" +
6067
6106
  "<div class=\"nice-dropdown-items\" aria-labelledby=\"nice-dropdown-{{ id }}\" role=\"listbox\">\n" +
6068
6107
  "<div role=\"none\" class=\"nice-no-data\" ng-if=\"internalList && internalList.length == 0\">{{ noDataText }}</div>\n" +
@@ -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" +
@@ -6410,8 +6457,9 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
6410
6457
  "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\" click-outside=\"close()\">\n" +
6411
6458
  "<div class=\"nice-search-button input-group\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
6412
6459
  "<input class=\"form-control\" type=\"text\" id=\"{{ id }}\" ng-model=\"model\" placeholder=\"{{ placeholder }}\" ng-disabled=\"isDisabled\" ng-change=\"updateSearch()\" ng-focus=\"onFocus()\" tabindex=\"{{ tabIndex }}\">\n" +
6413
- "<span class=\"input-group-addon clickable\" ng-click=\"onFocus()\">\n" +
6414
- "<nice-icon ng-show=\"!loading\" icon=\"icon-search\"></nice-icon>\n" +
6460
+ "<span class=\"input-group-addon\">\n" +
6461
+ "<nice-icon class=\"clickable\" ng-show=\"!loading && model != ''\" icon=\"icon-x\" ng-click=\"clear()\"></nice-icon>\n" +
6462
+ "<nice-icon class=\"clickable\" ng-show=\"!loading && model == ''\" icon=\"icon-search\" ng-click=\"onFocus()\"></nice-icon>\n" +
6415
6463
  "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
6416
6464
  "</span>\n" +
6417
6465
  "</div>\n" +