nice-elements 1.10.12 → 1.10.13

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.
@@ -2,9 +2,11 @@
2
2
  "editor.formatOnSave": true,
3
3
  "html.format.wrapLineLength": 0,
4
4
  "prettier.printWidth": 150,
5
- "editor.rulers": [150],
5
+ "editor.rulers": [
6
+ 150
7
+ ],
6
8
  "[scss]": {
7
- "editor.defaultFormatter": "vscode.css-language-features"
9
+ "editor.defaultFormatter": "sibiraj-s.vscode-scss-formatter"
8
10
  },
9
11
  "[css]": {
10
12
  "editor.defaultFormatter": "vscode.css-language-features"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.10.13 (24.10.2024)
4
+
5
+ - worked on nice tooltip,
6
+ - create nice tooltip example page,
7
+ - changed nice-choice inline margin
8
+
3
9
  ## v1.10.12 (20.10.2024)
4
10
 
5
11
  - fixed nice-svgs deploy flag
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.10.12
3
+ # Nice elements v1.10.13
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.10.12",
3
+ "version": "1.10.13",
4
4
  "authors": ["Klemen Kastelic <klemen@olaii.com>"],
5
5
  "description": "Nice elements",
6
6
  "keywords": [],
package/dist/nice.js CHANGED
@@ -18,7 +18,7 @@ angular.module('niceElements')
18
18
  label: '@'
19
19
  },
20
20
  link: function postLink(scope, element, attrs) {
21
- if (angular.isDefined(scope.model)) {
21
+ if (angular.isDefined(scope.model)){
22
22
  scope.model = false;
23
23
  }
24
24
  }
@@ -661,14 +661,14 @@ angular.module('niceElements')
661
661
  * # clickOutside
662
662
  */
663
663
  angular.module('niceElements')
664
- .directive('clickOutside', function ($document, $parse, $timeout) {
664
+ .directive('clickOutside', function($document, $parse, $timeout){
665
665
  return {
666
666
  restrict: 'A',
667
667
  link: function ($scope, elem, attr) {
668
668
  $scope.isOpen = false;
669
669
 
670
670
  // watch for is open
671
- attr.$observe('isOpen', function (value) {
671
+ attr.$observe('isOpen', function(value){
672
672
  $scope.isOpen = value == 'true';
673
673
  });
674
674
 
@@ -723,7 +723,7 @@ angular.module('niceElements')
723
723
  // if we have got this far, then we are good to go with processing the command passed in via the click-outside attribute
724
724
  $timeout(function () {
725
725
  fn = $parse(attr['clickOutside']);
726
- fn($scope, { event: e });
726
+ fn($scope, {event: e});
727
727
  });
728
728
  }
729
729
  }
@@ -757,7 +757,7 @@ angular.module('niceElements')
757
757
  });
758
758
  }
759
759
  };
760
- });
760
+ });
761
761
  'use strict';
762
762
 
763
763
  /**
@@ -2822,10 +2822,10 @@ angular.module('niceElements')
2822
2822
  if ($scope.searchFunction) {
2823
2823
  $scope.handleSearch();
2824
2824
  }
2825
-
2826
-
2825
+
2826
+
2827
2827
  // ----------------------------------- Handle add button function -----------------------------------
2828
- $scope.handleAddButton = function ($event) {
2828
+ $scope.handleAddButton = function($event) {
2829
2829
  let element = $event.target;
2830
2830
  while (true) {
2831
2831
  if (element.nodeName == 'BUTTON') {
@@ -3880,7 +3880,7 @@ angular.module('niceElements')
3880
3880
  }
3881
3881
 
3882
3882
  $scope.$watch('model', function (value_new, value_old) {
3883
- if ($scope.type == "number" && value_old && value_old[value_old.length - 1] == ".") {
3883
+ if ($scope.type == "number" && value_old && value_old[value_old.length-1] == ".") {
3884
3884
 
3885
3885
  } else {
3886
3886
  $scope.internalModel = angular.copy($scope.model);
@@ -3908,9 +3908,9 @@ angular.module('niceElements')
3908
3908
  }
3909
3909
  });
3910
3910
 
3911
- $scope.handleChange = function () {
3911
+ $scope.handleChange = function() {
3912
3912
  if ($scope.onChange) {
3913
- $timeout(function () {
3913
+ $timeout(function() {
3914
3914
  $scope.onChange({ model: $scope.model });
3915
3915
  })
3916
3916
  }
@@ -4106,42 +4106,42 @@ angular.module('niceElements')
4106
4106
 
4107
4107
  var messageElements = [];
4108
4108
 
4109
- var notify = function (args, t) {
4109
+ var notify = function(args, t){
4110
4110
 
4111
- if (typeof args !== 'object') {
4112
- args = { message: args };
4111
+ if (typeof args !== 'object'){
4112
+ args = {message:args};
4113
4113
  }
4114
4114
 
4115
4115
  args.template = args.template ? args.template : 'src/components/nice-notification/nice-notification.html';
4116
4116
  args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
4117
4117
  args.type = t ? t : '';
4118
4118
 
4119
- $http.get(args.template, { cache: $templateCache }).success(function (template) {
4119
+ $http.get(args.template,{cache: $templateCache}).success(function(template) {
4120
4120
 
4121
4121
  var scope = $rootScope.$new();
4122
4122
  scope.message = $sce.trustAsHtml(args.message);
4123
4123
  scope.title = $sce.trustAsHtml(args.title);
4124
- scope.t = args.type.substr(0, 1);
4124
+ scope.t = args.type.substr(0,1);
4125
4125
  scope.delay = args.delay;
4126
4126
 
4127
- if (typeof args.scope === 'object') {
4128
- for (var key in args.scope) {
4127
+ if (typeof args.scope === 'object'){
4128
+ for (var key in args.scope){
4129
4129
  scope[key] = args.scope[key];
4130
4130
  }
4131
4131
  }
4132
4132
 
4133
- var reposite = function () {
4133
+ var reposite = function() {
4134
4134
  var j = 0;
4135
4135
  var k = 0;
4136
4136
  var lastTop = startTop;
4137
4137
  var lastRight = startRight;
4138
- for (var i = messageElements.length - 1; i >= 0; i--) {
4138
+ for(var i = messageElements.length - 1; i >= 0; i --) {
4139
4139
  var element = messageElements[i];
4140
4140
  var elHeight = parseInt(element[0].offsetHeight);
4141
4141
  var elWidth = parseInt(element[0].offsetWidth);
4142
4142
  if ((top + elHeight) > window.innerHeight) {
4143
4143
  lastTop = startTop;
4144
- k++;
4144
+ k ++;
4145
4145
  j = 0;
4146
4146
  }
4147
4147
  var top = lastTop + (j === 0 ? 0 : verticalSpacing);
@@ -4151,22 +4151,22 @@ angular.module('niceElements')
4151
4151
  element.css('right', right + 'px');
4152
4152
 
4153
4153
  lastTop = top + elHeight;
4154
- j++;
4154
+ j ++;
4155
4155
  }
4156
4156
  };
4157
4157
 
4158
4158
  var templateElement = $compile(template)(scope);
4159
4159
  templateElement.addClass(args.type);
4160
- templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function (e) {
4160
+ templateElement.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd click', function(e){
4161
4161
  e = e.originalEvent || e;
4162
- if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)) {
4162
+ if (e.type === 'click' || (e.propertyName === 'opacity' && e.elapsedTime >= 0.4)){
4163
4163
  templateElement.remove();
4164
4164
  messageElements.splice(messageElements.indexOf(templateElement), 1);
4165
4165
  reposite();
4166
4166
  }
4167
4167
  });
4168
4168
 
4169
- $timeout(function () {
4169
+ $timeout(function() {
4170
4170
  templateElement.addClass('killed');
4171
4171
  templateElement.remove();
4172
4172
  messageElements.splice(messageElements.indexOf(templateElement), 1);
@@ -4178,34 +4178,34 @@ angular.module('niceElements')
4178
4178
 
4179
4179
  $timeout(reposite);
4180
4180
 
4181
- }).error(function (data) {
4182
- throw new Error('Template (' + args.template + ') could not be loaded. ' + data);
4181
+ }).error(function(data){
4182
+ throw new Error('Template ('+args.template+') could not be loaded. ' + data);
4183
4183
  });
4184
4184
 
4185
4185
  };
4186
4186
 
4187
- notify.config = function (args) {
4188
- startTop = args.top ? args.top : startTop;
4189
- verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
4187
+ notify.config = function(args){
4188
+ startTop = args.top ? args.top : startTop;
4189
+ verticalSpacing = args.verticalSpacing ? args.verticalSpacing : verticalSpacing;
4190
4190
  };
4191
4191
 
4192
- notify.primary = function () {
4192
+ notify.primary = function() {
4193
4193
  this(args, '');
4194
4194
  };
4195
4195
 
4196
- notify.error = function (args) {
4196
+ notify.error = function(args) {
4197
4197
  this(args, 'error');
4198
4198
  };
4199
4199
 
4200
- notify.success = function (args) {
4200
+ notify.success = function(args) {
4201
4201
  this(args, 'success');
4202
4202
  };
4203
4203
 
4204
- notify.info = function (args) {
4204
+ notify.info = function(args) {
4205
4205
  this(args, 'info');
4206
4206
  };
4207
4207
 
4208
- notify.warning = function (args) {
4208
+ notify.warning = function(args) {
4209
4209
  this(args, 'warning');
4210
4210
  };
4211
4211
 
@@ -4347,7 +4347,7 @@ angular.module('niceElements')
4347
4347
  $scope.$watch("model", function (oldModel, newModel) {
4348
4348
  $scope.check();
4349
4349
  if ($scope.onChange && oldModel != newModel) {
4350
- $timeout(function () {
4350
+ $timeout(function() {
4351
4351
  $scope.onChange({ model: $scope.model });
4352
4352
  })
4353
4353
  }
@@ -4641,7 +4641,7 @@ angular.module('niceElements')
4641
4641
  * # niceProgressBar
4642
4642
  */
4643
4643
  angular.module('niceElements')
4644
- .directive('niceProgressBar', function () {
4644
+ .directive('niceProgressBar', function() {
4645
4645
  return {
4646
4646
  restrict: 'E',
4647
4647
  replace: true,
@@ -4657,29 +4657,29 @@ angular.module('niceElements')
4657
4657
  help: '@'
4658
4658
  },
4659
4659
 
4660
- controller: function ($scope, $element, $timeout) {
4660
+ controller: function($scope, $element, $timeout) {
4661
4661
  $scope.width = 0;
4662
- $scope.resize = function () {
4663
- $timeout(function () {
4662
+ $scope.resize = function(){
4663
+ $timeout(function() {
4664
4664
  $scope.width = $element[0].getElementsByClassName("progress")[0].offsetWidth;
4665
- }, 100);
4665
+ },100);
4666
4666
  };
4667
- window.onresize = function () {
4667
+ window.onresize = function() {
4668
4668
  $scope.resize();
4669
4669
  };
4670
4670
  $scope.resize();
4671
4671
 
4672
+
4672
4673
 
4673
-
4674
- $scope.$watch("value", function (valueNew, valueOld) {
4674
+ $scope.$watch("value", function(valueNew, valueOld){
4675
4675
  $scope.calculate();
4676
4676
  });
4677
4677
 
4678
- $scope.$watch("max", function (valueNew, valueOld) {
4678
+ $scope.$watch("max", function(valueNew, valueOld){
4679
4679
  $scope.calculate();
4680
4680
  });
4681
4681
 
4682
- $scope.calculate = function () {
4682
+ $scope.calculate = function(){
4683
4683
  $scope.percentage = ($scope.value / $scope.max) * 100;
4684
4684
  };
4685
4685
 
@@ -5335,7 +5335,7 @@ angular.module('niceElements')
5335
5335
  controller: function ($scope, $transclude) {
5336
5336
  $scope.hasActions = $transclude().length > 0;
5337
5337
 
5338
- $scope.setOrder = function (key) {
5338
+ $scope.setOrder = function(key) {
5339
5339
  if (!$scope.canOrder) return;
5340
5340
  if ($scope.order == "!" + key) {
5341
5341
  $scope.order = null;
@@ -5347,18 +5347,18 @@ angular.module('niceElements')
5347
5347
  if ($scope.orderChanged) $scope.orderChanged($scope.order);
5348
5348
  }
5349
5349
 
5350
- $scope.rowStyle = function (column, row) {
5350
+ $scope.rowStyle = function(column, row) {
5351
5351
  if (!column.valueStyle) return;
5352
5352
  return column.valueStyle(row[column.key], row);
5353
- }
5354
-
5355
- $scope.rowClass = function (column, row) {
5353
+ }
5354
+
5355
+ $scope.rowClass = function(column, row) {
5356
5356
  if (!column.valueClass) return;
5357
5357
  return column.valueClass(row[column.key], row);
5358
5358
  }
5359
-
5360
- $scope.handleFreeze = function (column, isFirst, isLast, index) {
5361
- return {
5359
+
5360
+ $scope.handleFreeze = function(column, isFirst, isLast, index) {
5361
+ return {
5362
5362
  'nice-table-freeze-left': ($scope.freezeFirst && isFirst) || column.freeze,
5363
5363
  'nice-table-freeze-right': $scope.freezeLast && isLast && !$scope.hasActions
5364
5364
  }
@@ -5598,15 +5598,76 @@ angular.module('niceElements')
5598
5598
  angular.module('niceElements')
5599
5599
  .directive('niceTooltip', function () {
5600
5600
  return {
5601
- restrict: 'EA',
5602
- link: function (scope, element, attrs) {
5603
- element.addClass("nice-tooltip");
5604
-
5605
- var tooltipWindow = document.createElement('span')
5601
+ restrict: 'A',
5602
+ controller: function ($scope, $element, $attrs) {
5603
+ const id = Math.random().toString(36).substring(7);
5604
+ const showEvents = ['mouseenter', 'focus'];
5605
+ const hideEvents = ['mouseleave', 'blur'];
5606
+ const placement = $attrs.niceTooltipPlacement || "top";
5607
+
5608
+ // Create popper window
5609
+ $element.addClass("nice-tooltip");
5610
+ const tooltipWindow = document.createElement('div');
5606
5611
  tooltipWindow.className = 'nice-tooltip-window';
5607
- tooltipWindow.innerHTML = attrs.niceTooltip;
5612
+ tooltipWindow.id = 'nice-tooltip-window-' + id;
5608
5613
 
5609
- element.append(tooltipWindow);
5614
+ // Popper body
5615
+ const tooltipWindowBody = document.createElement('div');
5616
+ tooltipWindowBody.innerHTML = $attrs.niceTooltip;
5617
+ tooltipWindow.append(tooltipWindowBody);
5618
+
5619
+ // Popper arrow
5620
+ const tooltipWindowArrow = document.createElement('div');
5621
+ tooltipWindowArrow.className = 'nice-tooltip-window-arrow';
5622
+ tooltipWindowArrow.setAttribute("data-popper-arrow", "");
5623
+ tooltipWindow.append(tooltipWindowArrow);
5624
+
5625
+ // Add to body
5626
+ document.body.append(tooltipWindow);
5627
+
5628
+ // Setup popper
5629
+ const popper = Popper.createPopper($element[0], tooltipWindow, {
5630
+ placement: placement,
5631
+ strategy: 'fixed',
5632
+ modifiers: [
5633
+ {
5634
+ name: 'offset',
5635
+ options: {
5636
+ offset: [0, 8],
5637
+ },
5638
+ },
5639
+ {
5640
+ name: 'arrow',
5641
+ options: {
5642
+ element: tooltipWindowArrow,
5643
+ padding: 3
5644
+ },
5645
+ },
5646
+ ],
5647
+ });
5648
+
5649
+ function show() {
5650
+ tooltipWindow.setAttribute('data-show', '');
5651
+ popper.update();
5652
+ }
5653
+
5654
+ function hide() {
5655
+ tooltipWindow.removeAttribute('data-show');
5656
+ }
5657
+
5658
+ showEvents.forEach((event) => {
5659
+ $element[0].addEventListener(event, show);
5660
+ });
5661
+
5662
+ hideEvents.forEach((event) => {
5663
+ $element[0].addEventListener(event, hide);
5664
+ });
5665
+
5666
+ // On destroy
5667
+ $scope.$on('$destroy', function () {
5668
+ tooltipWindow.remove();
5669
+ if (popper) popper.destroy();
5670
+ });
5610
5671
  }
5611
5672
  };
5612
5673
  });
@@ -6054,7 +6115,7 @@ angular.module('niceElements')
6054
6115
  };
6055
6116
  });
6056
6117
 
6057
- angular.module('niceElements').run(['$templateCache', function ($templateCache) {
6118
+ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6058
6119
  'use strict';
6059
6120
 
6060
6121
  $templateCache.put('src/components/nice-button-toggle/nice-button-toggle.html',
@@ -8162,5 +8223,5 @@ angular.module('niceElements').run(['$templateCache', function ($templateCache)
8162
8223
  "</div>\n" +
8163
8224
  "</div>"
8164
8225
  );
8165
-
8166
- }]);
8226
+
8227
+ }]);