nice-elements 1.13.2 → 1.13.3

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.13.3 (3.4.2026)
4
+
5
+ - changed hideClear to showClear prop in nice upload component,
6
+ - worked on niceHighlight,
7
+ - fixed call nice upload uploadFunction on clear
8
+
3
9
  ## v1.13.2 (3.4.2026)
4
10
 
5
11
  - added clear button to nice upload,
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.13.2
3
+ # Nice elements v1.13.3
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.13.2",
3
+ "version": "1.13.3",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -5846,7 +5846,7 @@ angular.module('niceElements')
5846
5846
  callbackUrl: '=',
5847
5847
  isDisabled: '=',
5848
5848
  isInline: '=',
5849
- hideClear: '=',
5849
+ showClear: '=',
5850
5850
  help: '@',
5851
5851
  maxFileSize: '@',
5852
5852
  required: '=',
@@ -5864,6 +5864,7 @@ angular.module('niceElements')
5864
5864
  scope.endDragging = function () { $timeout(function () { scope.dragging = false; }); };
5865
5865
  scope.startDraggingGlobal = function () { $timeout(function () { scope.draggingGlobal = true; }); };
5866
5866
  scope.endDraggingGlobal = function () { $timeout(function () { scope.dragging = false; scope.draggingGlobal = false; }); };
5867
+ scope.file = null;
5867
5868
 
5868
5869
  scope.dragging = false;
5869
5870
  scope.draggingGlobal = false;
@@ -5967,8 +5968,8 @@ angular.module('niceElements')
5967
5968
  });
5968
5969
  },
5969
5970
 
5970
- controller: function ($scope) {
5971
- $scope.$watch("model", function (value) {
5971
+ controller: function ($scope, $element) {
5972
+ $scope.$watch("model", function () {
5972
5973
  $scope.imageSource = angular.copy($scope.model);
5973
5974
  });
5974
5975
 
@@ -5976,10 +5977,14 @@ angular.module('niceElements')
5976
5977
  $scope.model = null;
5977
5978
  $scope.imageSource = null;
5978
5979
  $scope.form.$setDirty();
5980
+ const inputElement = $element[0].querySelector(".input-file");
5981
+ if (inputElement) inputElement.value = null;
5982
+
5979
5983
  $scope.text = gettextCatalog.getString('Click to upload file', null, 'Nice');
5980
- if ($scope.callbackFunction) $scope.callbackFunction(null);
5981
- if ($scope.callbackFile) $scope.callbackFile(null);
5982
- if ($scope.callbackUrl) $scope.callbackUrl(null);
5984
+ if ($scope.callbackFunction) $scope.callbackFunction();
5985
+ if ($scope.callbackFile) $scope.callbackFile();
5986
+ if ($scope.callbackUrl) $scope.callbackUrl();
5987
+ if ($scope.uploadFunction) $scope.uploadFunction();
5983
5988
  };
5984
5989
  }
5985
5990
 
@@ -6270,12 +6275,21 @@ angular.module('niceElements').filter('niceDate', function () {
6270
6275
  * # niceHighlight
6271
6276
  * Filter in the niceElements.
6272
6277
  */
6273
- angular.module('niceElements').filter('niceHighlight', function () {
6274
- return function (value, highlightedText) {
6275
- if (!value || !highlightedText) return "";
6276
- const regex = new RegExp(highlightedText, 'gmi');
6277
- const newValue = String(value).replace(regex, "<span class='nice-highlight'>$&</span>");
6278
- return newValue;
6278
+ angular.module('niceElements').filter('niceHighlight', function ($sanitize, $sce) {
6279
+ return function (text, phrase) {
6280
+ if (!phrase || !text) return text;
6281
+
6282
+ // 1. Sanitize the original text to prevent XSS
6283
+ let cleanText = $sanitize(text);
6284
+
6285
+ // 2. Create the case-insensitive global Regex
6286
+ const regex = new RegExp('(' + phrase + ')', 'gi');
6287
+
6288
+ // 3. Replace matches with the h element
6289
+ const highlighted = cleanText.replace(regex, '<h>$1</h>');
6290
+
6291
+ // 4. Trust the result so ng-bind-html renders it
6292
+ return $sce.trustAsHtml(highlighted);
6279
6293
  };
6280
6294
  });
6281
6295
 
@@ -6534,7 +6548,7 @@ angular.module('niceElements')
6534
6548
  .service('NiceService', function ($rootScope) {
6535
6549
  const service = {
6536
6550
  name: "Nice elements",
6537
- version: "1.13.2",
6551
+ version: "1.13.3",
6538
6552
  getHeader: function () {
6539
6553
  return {};
6540
6554
  },
@@ -9213,6 +9227,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
9213
9227
  " \n" +
9214
9228
  " <div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
9215
9229
  " <div class=\"nice-upload-area\">\n" +
9230
+ " \n" +
9216
9231
  " <div class=\"input-area\" ng-class=\"{ 'dragging': dragging || draggingGlobal }\">\n" +
9217
9232
  " <div class=\"middle-text\" ng-if=\"!imageSource && !loading\">\n" +
9218
9233
  " <nice-icon icon=\"icon-upload\"></nice-icon>\n" +
@@ -9224,10 +9239,16 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
9224
9239
  " <img data-ng-src=\"{{ imageSource }}\">\n" +
9225
9240
  " </div>\n" +
9226
9241
  " </div>\n" +
9227
- " <button type=\"button\" ng-click=\"clear()\" ng-if=\"imageSource && !loading && !hideClear\" class=\"btn btn-primary nice-upload-clear-button\">\n" +
9242
+ "\n" +
9243
+ " \n" +
9244
+ " <button type=\"button\" ng-click=\"clear()\" ng-if=\"imageSource && !loading && showClear\" class=\"btn btn-primary nice-upload-clear-button\">\n" +
9228
9245
  " <nice-icon icon=\"icon-x\"></nice-icon>\n" +
9229
9246
  " </button>\n" +
9247
+ "\n" +
9248
+ " \n" +
9230
9249
  " <input class=\"input-file\" type=\"file\" accept=\"{{ accept }}\" ng-model=\"file\" ng-required=\"required\" ng-disabled=\"isDisabled || loading\">\n" +
9250
+ "\n" +
9251
+ " \n" +
9231
9252
  " <nice-loader fulldiv=\"true\" ng-if=\"loading\"></nice-loader>\n" +
9232
9253
  " </div>\n" +
9233
9254
  " </div>\n" +