nice-elements 1.16.0 → 1.16.2

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.16.2 (30.11.2026)
4
+
5
+ - fixed nice datetime picker and nice datetimerange picker (1 and 2) closing when a date is selected
6
+
7
+ ## v1.16.1 (30.11.2026)
8
+
9
+ - fixed nice search dropdown position (sits under the input),
10
+ - nice search dropdown closes on click outside,
11
+ - nice search updates results also when refresh-function returns a native promise,
12
+ - fixed nice search2 on-select (accepts an expression like on-select="fn(model)" or a function reference),
13
+ - fixed nice search2 model binding inside nice popup,
14
+ - nice notification classes are prefixed with nice-,
15
+ - added max-width to nice notification, cards align left
16
+
3
17
  ## v1.16.0 (27.11.2026)
4
18
 
5
19
  - removed font awesome, all icons are now nice icon (added icon-dot, bolder icon-plus),
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.16.0
3
+ # Nice elements v1.16.2
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -5567,19 +5567,12 @@ angular.module('niceElements')
5567
5567
  //scope.$apply();
5568
5568
  };
5569
5569
 
5570
- // Close the dropdown if clicked outside
5571
- const onClick = function (event) {
5572
- const isClickedElementChildOfPopup = element.find(event.target).length > 0;
5573
-
5574
- if (isClickedElementChildOfPopup) return;
5575
-
5570
+ // Close the dropdown (called by click-outside in the template)
5571
+ scope.closeDropdown = function () {
5576
5572
  scope.results = [];
5577
5573
  scope.noResults = false;
5578
- scope.$apply();
5579
5574
  };
5580
5575
 
5581
- angular.element(element).on('click', onClick);
5582
-
5583
5576
  // Keyboard up/down on search results
5584
5577
  const onKeyDown = function (event) {
5585
5578
  if ((event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13 || event.keyCode == 27) && scope.results && scope.results.length > 0) {
@@ -5611,7 +5604,6 @@ angular.module('niceElements')
5611
5604
  angular.element(element).on('keydown', onKeyDown);
5612
5605
 
5613
5606
  scope.$on('$destroy', function () {
5614
- angular.element(element).off('click', onClick);
5615
5607
  angular.element(element).off('keydown', onKeyDown);
5616
5608
  });
5617
5609
 
@@ -5664,10 +5656,15 @@ angular.module('niceElements')
5664
5656
  }
5665
5657
  $scope.requests = $scope.requests + 1;
5666
5658
  const requestNumber = angular.copy($scope.requests);
5659
+ // $timeout so the view updates also when refreshFunction returns a native Promise
5667
5660
  $scope.refreshFunction($scope.modelString).then(function (response) {
5668
- updateList(response, requestNumber);
5661
+ $timeout(function () {
5662
+ updateList(response, requestNumber);
5663
+ });
5669
5664
  }, function (error) {
5670
- $scope.loading = false;
5665
+ $timeout(function () {
5666
+ $scope.loading = false;
5667
+ });
5671
5668
  });
5672
5669
  // Why was this here?
5673
5670
  // $scope.model = $scope.modelString;
@@ -5737,7 +5734,7 @@ angular.module('niceElements')
5737
5734
  labelWidth: '@',
5738
5735
  refreshFunction: '=',
5739
5736
  refreshSelectedCallback: '=',
5740
- onSelect: '=',
5737
+ onSelect: '&?',
5741
5738
  onChange: '&?',
5742
5739
  noMargin: '@',
5743
5740
  tabIndex: '@',
@@ -5761,6 +5758,14 @@ angular.module('niceElements')
5761
5758
  if (!$scope.model) $scope.model = "";
5762
5759
  if (!$scope.placement) { $scope.placement = "bottom-start"; }
5763
5760
 
5761
+ // ------------------- Model accessor -------------------
5762
+ // Input lives inside nice-popup's transcluded (child) scope, so a plain ng-model="model"
5763
+ // would write to the child scope only. Bind through a getter/setter instead.
5764
+ $scope.modelAccessor = function (value) {
5765
+ if (arguments.length) $scope.model = value;
5766
+ return $scope.model;
5767
+ };
5768
+
5764
5769
  // ------------------- On focus -------------------
5765
5770
  $scope.onFocus = function () {
5766
5771
  if ($scope.showDropdown && $scope.results.length == 0) {
@@ -5864,7 +5869,10 @@ angular.module('niceElements')
5864
5869
  // ------------------------ Select item ------------------------
5865
5870
  $scope.selectItem = function (item) {
5866
5871
  if ($scope.onSelect) {
5867
- $scope.onSelect(item);
5872
+ // Supports on-select="fn(model)" (expression) and on-select="fn" (function reference):
5873
+ // the expression form is evaluated directly, the reference form returns the function to call.
5874
+ const result = $scope.onSelect({ model: item });
5875
+ if (angular.isFunction(result)) result(item);
5868
5876
  $scope.clear();
5869
5877
  $scope.close();
5870
5878
  }
@@ -6860,6 +6868,12 @@ angular.module('niceElements')
6860
6868
  return;
6861
6869
  }
6862
6870
 
6871
+ // the click removed its own target (e.g. a re-rendered ng-repeat calendar day),
6872
+ // so we can't tell where it was - treat it as an inside click
6873
+ if (!document.documentElement.contains(e.target)) {
6874
+ return;
6875
+ }
6876
+
6863
6877
  // loop through the available elements, looking for classes in the class list that might match and so will eat
6864
6878
  for (element = e.target; element; element = element.parentNode) {
6865
6879
  // check if the element is the same element the directive is attached to and exit if so (props @CosticaPuntaru)
@@ -7199,7 +7213,7 @@ angular.module('niceElements')
7199
7213
 
7200
7214
  const service = {
7201
7215
  name: "Nice elements",
7202
- version: "1.16.0",
7216
+ version: "1.16.2",
7203
7217
  getHeader: function () {
7204
7218
  return {};
7205
7219
  },
@@ -8341,12 +8355,12 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
8341
8355
 
8342
8356
 
8343
8357
  $templateCache.put('src/components/nice-notification/nice-notification.html',
8344
- "<div class=\"notification\" ng-class=\"{ 'has-icon': icon }\">\n" +
8345
- " <div class=\"notification-inner\">\n" +
8346
- " <nice-icon ng-if=\"icon\" class=\"notification-icon\" icon=\"{{ icon }}\"></nice-icon>\n" +
8347
- " <div class=\"notification-content\">\n" +
8348
- " <div class=\"notification-title\" ng-show=\"title\" ng-bind-html=\"title\"></div>\n" +
8349
- " <div class=\"notification-message\" ng-bind-html=\"message\"></div>\n" +
8358
+ "<div class=\"nice-notification\" ng-class=\"{ 'has-icon': icon }\">\n" +
8359
+ " <div class=\"nice-notification-inner\">\n" +
8360
+ " <nice-icon ng-if=\"icon\" class=\"nice-notification-icon\" icon=\"{{ icon }}\"></nice-icon>\n" +
8361
+ " <div class=\"nice-notification-content\">\n" +
8362
+ " <div class=\"nice-notification-title\" ng-show=\"title\" ng-bind-html=\"title\"></div>\n" +
8363
+ " <div class=\"nice-notification-message\" ng-bind-html=\"message\"></div>\n" +
8350
8364
  " </div>\n" +
8351
8365
  " </div>\n" +
8352
8366
  "</div>\n"
@@ -8531,33 +8545,31 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
8531
8545
  "\n" +
8532
8546
  " \n" +
8533
8547
  " <div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
8534
- " <div class=\"input-group\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
8535
- " <input class=\"form-control\" type=\"text\" id=\"{{ id }}\" ng-model=\"modelString\" ng-keypress=\"keypress($event)\" placeholder=\"{{ placeholder }}\" ng-disabled=\"isDisabled\" ng-change=\"updateSearch()\" ng-required=\"required\" tabindex=\"{{ tabIndex }}\">\n" +
8548
+ " <div class=\"nice-search-field\" click-outside=\"closeDropdown()\" is-open=\"{{ results.length > 0 || noResults }}\">\n" +
8549
+ " <div class=\"input-group\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
8550
+ " <input class=\"form-control\" type=\"text\" id=\"{{ id }}\" ng-model=\"modelString\" ng-keypress=\"keypress($event)\" placeholder=\"{{ placeholder }}\" ng-disabled=\"isDisabled\" ng-change=\"updateSearch()\" ng-required=\"required\" tabindex=\"{{ tabIndex }}\">\n" +
8536
8551
  "\n" +
8537
- " <button type=\"button\" class=\"btn input-group-addon\" ng-click=\"search()\" ng-if=\"!model\" ng-disabled=\"isDisabled\">\n" +
8538
- " \n" +
8539
- " <nice-icon ng-show=\"!loading\" icon=\"icon-search\"></nice-icon>\n" +
8540
- " <nice-loader ng-if=\"loading\"></nice-loader>\n" +
8541
- " </button>\n" +
8552
+ " <button type=\"button\" class=\"btn input-group-addon\" ng-click=\"search()\" ng-if=\"!model\" ng-disabled=\"isDisabled\">\n" +
8553
+ " \n" +
8554
+ " <nice-icon ng-show=\"!loading\" icon=\"icon-search\"></nice-icon>\n" +
8555
+ " <nice-loader ng-if=\"loading\"></nice-loader>\n" +
8556
+ " </button>\n" +
8542
8557
  "\n" +
8543
- " <button type=\"button\" class=\"btn input-group-addon\" ng-click=\"remove()\" ng-if=\"model\" ng-disabled=\"isDisabled\">\n" +
8544
- " <nice-icon ng-show=\"!loading\" icon=\"icon-x\"></nice-icon>\n" +
8545
- " </button>\n" +
8546
- " </div>\n" +
8547
- " </div>\n" +
8548
- " </div>\n" +
8558
+ " <button type=\"button\" class=\"btn input-group-addon\" ng-click=\"remove()\" ng-if=\"model\" ng-disabled=\"isDisabled\">\n" +
8559
+ " <nice-icon ng-show=\"!loading\" icon=\"icon-x\"></nice-icon>\n" +
8560
+ " </button>\n" +
8561
+ " </div>\n" +
8549
8562
  "\n" +
8550
- " <div class=\"row\" ng-if=\"noResults || results.length\">\n" +
8551
- " <div ng-class=\"labelWidth ? labelWidth : 'col-sm-4'\" ng-if=\"title\"></div>\n" +
8552
- " <div class=\"nice-field col-xs-12\" ng-class=\"fieldWidth ? fieldWidth : 'col-sm-8'\">\n" +
8553
- " <div class=\"nice-dropdown-empty\" ng-if=\"noResults\">\n" +
8554
- " <div class=\"nice-search-row\" translate translate-context=\"Nice\">No results found.</div>\n" +
8555
- " </div>\n" +
8563
+ " \n" +
8564
+ " <div class=\"nice-dropdown-empty\" ng-if=\"noResults\">\n" +
8565
+ " <div class=\"nice-search-row\" translate translate-context=\"Nice\">No results found.</div>\n" +
8566
+ " </div>\n" +
8556
8567
  "\n" +
8557
- " <div class=\"nice-dropdown\" ng-if=\"results.length\">\n" +
8558
- " <div ng-repeat=\"result in results\" class=\"nice-search-row\" ng-class=\"{'active': selectedIndex == $index}\" ng-click=\"selectRow(result)\">\n" +
8559
- " <span class=\"text-bold\" ng-if=\"!hasRowTemplate\">{{ result[keyForInputLabel] }}</span>\n" +
8560
- " <div ng-if=\"hasRowTemplate\" nice-search-row-transclude></div>\n" +
8568
+ " <div class=\"nice-dropdown\" ng-if=\"results.length\">\n" +
8569
+ " <div ng-repeat=\"result in results\" class=\"nice-search-row\" ng-class=\"{'active': selectedIndex == $index}\" ng-click=\"selectRow(result)\">\n" +
8570
+ " <span class=\"text-bold\" ng-if=\"!hasRowTemplate\">{{ result[keyForInputLabel] }}</span>\n" +
8571
+ " <div ng-if=\"hasRowTemplate\" nice-search-row-transclude></div>\n" +
8572
+ " </div>\n" +
8561
8573
  " </div>\n" +
8562
8574
  " </div>\n" +
8563
8575
  " </div>\n" +
@@ -8578,7 +8590,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
8578
8590
  " <nice-popup trigger=\"manual\" is-open=\"isOpen\" placement=\"{{ placement }}\" same-width=\"true\">\n" +
8579
8591
  " <nice-popup-target>\n" +
8580
8592
  " <div class=\"nice-search-button input-group\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
8581
- " <input class=\"form-control\" type=\"text\" id=\"{{ id }}\" ng-model=\"model\" placeholder=\"{{ placeholder }}\" ng-disabled=\"isDisabled\" ng-change=\"updateSearch()\" ng-focus=\"onFocus()\" ng-required=\"required\" tabindex=\"{{ tabIndex }}\">\n" +
8593
+ " <input class=\"form-control\" type=\"text\" id=\"{{ id }}\" ng-model=\"modelAccessor\" ng-model-options=\"{ getterSetter: true }\" placeholder=\"{{ placeholder }}\" ng-disabled=\"isDisabled\" ng-change=\"updateSearch()\" ng-focus=\"onFocus()\" ng-required=\"required\" tabindex=\"{{ tabIndex }}\">\n" +
8582
8594
  "\n" +
8583
8595
  " <button type=\"button\" class=\"btn input-group-addon\" ng-disabled=\"isDisabled\" ng-click=\"buttonClicked()\">\n" +
8584
8596
  " <nice-icon ng-show=\"!loading && model != ''\" icon=\"icon-x\"></nice-icon>\n" +