nice-elements 1.7.12 → 1.8.0

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,16 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.8.0 (16.3.2023)
4
+
5
+ - created nice-wrapper component,
6
+ - created nice loader example page,
7
+ - worked on nice-loader,
8
+ - worked on nice-search and nice-dropdown loading,
9
+ - worked on nice-button,
10
+ - worked on example pages,
11
+ - fixed nice-search and nice-search2 border color,
12
+ - deprecated addClass from nice button and nice loader
13
+
3
14
  ## v1.7.12 (13.3.2023)
4
15
 
5
16
  - fixed build for services
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.7.12
3
+ # Nice elements v1.8.0
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
 
@@ -8,6 +8,7 @@ Nice elements is an AngularJS v1.5.8 module that contains nice form elements lik
8
8
 
9
9
  ## Components
10
10
 
11
+ - nice-wrapper
11
12
  - nice-button
12
13
  - nice-button-toggle
13
14
  - nice-calendar
package/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nice-elements",
3
- "version": "1.7.12",
3
+ "version": "1.8.0",
4
4
  "authors": [
5
5
  "Klemen Kastelic <klemen@olaii.com>"
6
6
  ],
package/dist/nice.js CHANGED
@@ -38,27 +38,28 @@ angular.module('niceElements')
38
38
  templateUrl: 'src/components/nice-button/nice-button.html',
39
39
  restrict: 'E',
40
40
  transclude: true,
41
+ replace: true,
41
42
  scope: {
42
- niceDisabled: '=',
43
43
  title: '@',
44
+ icon: '@?',
44
45
  noMargin: '=',
45
- fieldWidth: '@',
46
- labelWidth: '@',
47
46
  niceClick: '&',
47
+ niceDisabled: '=',
48
48
  addClass: '@',
49
- isInline: '=',
50
- type: '@'
49
+ type: '@?'
51
50
  },
52
- link: function postLink(scope, element, attrs) {
53
- scope.loading = false;
54
- if (!scope.type) scope.type = "button";
51
+ controller: function ($q, $scope, $transclude) {
52
+ if ($scope.addClass != undefined) console.warn("[NICE ELEMENTS] Nice button: add-class attribute is deprecated")
53
+ if (!$scope.type) $scope.type = "button";
54
+ $scope.showSlot = $transclude().length > 0;
55
+ $scope.loading = false;
55
56
 
56
- scope.click = function(){
57
- if (scope.loading===false && scope.niceDisabled!==true){
58
- scope.loading = true;
57
+ $scope.click = function () {
58
+ if ($scope.loading === false && $scope.niceDisabled !== true) {
59
+ $scope.loading = true;
59
60
 
60
- $q.when(scope.niceClick()).finally(function(){
61
- scope.loading = false;
61
+ $q.when($scope.niceClick()).finally(function () {
62
+ $scope.loading = false;
62
63
  });
63
64
  }
64
65
  };
@@ -1010,7 +1011,6 @@ angular.module('niceElements')
1010
1011
  * # niceDate
1011
1012
  */
1012
1013
  angular.module('niceElements')
1013
-
1014
1014
  .directive('niceDate', function () {
1015
1015
  return {
1016
1016
  restrict: 'E',
@@ -1136,7 +1136,7 @@ angular.module('niceElements')
1136
1136
  selectedDate.hours($scope.innerDate.hour);
1137
1137
  selectedDate.minutes($scope.innerDate.minute);
1138
1138
 
1139
- $scope.model = selectedDate;
1139
+ $scope.model = angular.copy(selectedDate);
1140
1140
  if ($scope.onChange) $scope.onChange({ model: $scope.model });
1141
1141
  $scope.forma.$setDirty();
1142
1142
  }
@@ -3847,12 +3847,18 @@ angular.module('niceElements')
3847
3847
  templateUrl: 'src/components/nice-loader/nice-loader.html',
3848
3848
  restrict: 'E',
3849
3849
  transclude: true,
3850
+ replace: true,
3850
3851
  scope: {
3851
3852
  visibleWhen: '=',
3852
3853
  message: '@',
3853
3854
  fullscreen: '@',
3854
3855
  fulldiv: '@',
3855
3856
  addClass: '@'
3857
+ },
3858
+ controller: function ($scope, $transclude) {
3859
+ $scope.showSlot = $transclude().length > 0;
3860
+ if ($scope.visibleWhen != undefined) console.warn("[NICE ELEMENTS] Nice loader: visible-when attribute is deprecated")
3861
+ if ($scope.addClass != undefined) console.warn("[NICE ELEMENTS] Nice loader: add-class attribute is deprecated")
3856
3862
  }
3857
3863
  };
3858
3864
  });
@@ -5362,6 +5368,48 @@ angular.module('niceElements')
5362
5368
 
5363
5369
  'use strict';
5364
5370
 
5371
+ /**
5372
+ * @ngdoc directive
5373
+ * @name niceElements.directive:niceWrapper
5374
+ * @description
5375
+ * # niceWrapper
5376
+ */
5377
+ angular.module('niceElements')
5378
+ .directive('niceWrapper', function () {
5379
+ return {
5380
+ templateUrl: 'src/components/nice-wrapper/nice-wrapper.html',
5381
+ restrict: 'E',
5382
+ replace: true,
5383
+ transclude: {
5384
+ 'title': '?niceWrapperTitle',
5385
+ 'subtitle': '?niceWrapperSubtitle',
5386
+ 'footer': '?niceWrapperFooter'
5387
+ },
5388
+ scope: {
5389
+ title: '@',
5390
+ subtitle: '@',
5391
+ collapsable: '=',
5392
+ collapsed: '@',
5393
+ },
5394
+ controller: function ($scope, $transclude) {
5395
+ $scope.isOpen = true;
5396
+ if ($scope.collapsed) $scope.isOpen = false;
5397
+
5398
+ $scope.hasTitle = $transclude.isSlotFilled('title');
5399
+ $scope.hasSubtitle = $transclude.isSlotFilled('subtitle');
5400
+ $scope.hasFooter = $transclude.isSlotFilled('footer');
5401
+ $scope.hasHeader = $scope.hasTitle || $scope.hasSubtitle || $scope.title || $scope.subtitle || $scope.collapsable;
5402
+
5403
+ $scope.toggle = function () {
5404
+ if (!$scope.collapsable) return;
5405
+ $scope.isOpen = !$scope.isOpen;
5406
+ }
5407
+ }
5408
+ };
5409
+ });
5410
+
5411
+ 'use strict';
5412
+
5365
5413
  /**
5366
5414
  * @ngdoc directive
5367
5415
  * @name niceElements.directive:niceYesno
@@ -5517,7 +5565,7 @@ angular.module('niceElements')
5517
5565
  .service('NiceService', function () {
5518
5566
  var service = {
5519
5567
  name: "Nice elements",
5520
- version: "1.7.11",
5568
+ version: "1.7.12",
5521
5569
  getHeader: function () {
5522
5570
  return {};
5523
5571
  }
@@ -5542,12 +5590,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5542
5590
 
5543
5591
 
5544
5592
  $templateCache.put('src/components/nice-button/nice-button.html',
5545
- "<div class=\"nice-component nice-button\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\">\n" +
5546
- "<button type=\"{{ type }}\" class=\"btn btn-primary\" ng-class=\"addClass\" ng-click=\"click()\" ng-disabled=\"niceDisabled===true\">\n" +
5547
- "<div ng-class=\"{opacity0: loading==true, opacity1: loading==false}\"><ng-transclude></ng-transclude></div>\n" +
5548
- "<div ng-class=\"{display0: loading==false, opacity1: loading==true}\" class=\"nice-button-loader-wrapper\"><nice-loader add-class=\"nice-button-loader\"></nice-loader></div>\n" +
5549
- "</button>\n" +
5550
- "</div>\n"
5593
+ "<button type=\"{{ type }}\" class=\"nice-component nice-button btn btn-primary\" ng-class=\"{ 'margin-bottom-0' : noMargin }\" ng-click=\"click()\" ng-disabled=\"niceDisabled == true\">\n" +
5594
+ "<nice-icon icon=\"{{ icon }}\" ng-if=\"icon\" ng-class=\"{ 'opacity-0': loading }\"></nice-icon>\n" +
5595
+ "<span ng-if=\"showSlot\" ng-transclude ng-class=\"{ 'opacity-0': loading }\"></span>\n" +
5596
+ "<nice-loader ng-if=\"loading\" fulldiv=\"true\" class=\"nice-button-loader\"></nice-loader>\n" +
5597
+ "</button>"
5551
5598
  );
5552
5599
 
5553
5600
 
@@ -5979,7 +6026,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5979
6026
  "</div>\n" +
5980
6027
  "<div class=\"not-selected\" ng-if=\"selected == null\">{{ selectText }}</div>\n" +
5981
6028
  "<span class=\"caret\" ng-show=\"!loading\"></span>\n" +
5982
- "<nice-loader visible-when=\"!loading\"></nice-loader>\n" +
6029
+ "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
5983
6030
  "</button>\n" +
5984
6031
  "<div class=\"nice-dropdown-menu-wrapper\">\n" +
5985
6032
  "<div class=\"nice-dropdown-menu\" ng-if=\"isOpen\">\n" +
@@ -6165,12 +6212,12 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6165
6212
 
6166
6213
 
6167
6214
  $templateCache.put('src/components/nice-loader/nice-loader.html',
6168
- "<div class=\"nice-loader\" ng-if=\"!visibleWhen\" ng-class=\"[addClass, { 'nice-loader-fullscreen': fullscreen, 'nice-loader-fulldiv': fulldiv }]\">\n" +
6169
- "<svg version=\"1.1\" id=\"loader\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"40px\" height=\"40px\" viewBox=\"0 0 50 50\" style=\"enable-background:new 0 0 50 50;\" xml:space=\"preserve\">\n" +
6170
- "<path fill=\"#000\" d=\"M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z\"></path>\n" +
6215
+ "<div class=\"nice-loader\" ng-class=\"{ 'nice-loader-fullscreen': fullscreen, 'nice-loader-fulldiv': fulldiv }\">\n" +
6216
+ "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"40px\" height=\"40px\" viewBox=\"0 0 50 50\" style=\"enable-background:new 0 0 50 50;\" xml:space=\"preserve\">\n" +
6217
+ "<path d=\"M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z\"></path>\n" +
6171
6218
  "</svg>\n" +
6172
6219
  "<div class=\"nice-loader-message\" ng-if=\"message\">{{ message }}</div>\n" +
6173
- "<ng-transclude></ng-transclude>\n" +
6220
+ "<ng-transclude ng-if=\"showSlot\"></ng-transclude>\n" +
6174
6221
  "</div>"
6175
6222
  );
6176
6223
 
@@ -6298,15 +6345,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6298
6345
  "<div class=\"row\">\n" +
6299
6346
  "<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6300
6347
  "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\">\n" +
6301
- "<div class=\"input-group\" ng-class=\"{\n" +
6302
- " 'disabled': isDisabled,\n" +
6303
- " 'has-warning': !isDisabled && form.$invalid && form.$dirty,\n" +
6304
- " 'has-success': !isDisabled && form.$valid && form.$dirty}\n" +
6305
- " \">\n" +
6348
+ "<div class=\"input-group\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
6306
6349
  "<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" +
6307
6350
  "<span class=\"input-group-addon clickable\" ng-click=\"search()\" ng-if=\"!model\">\n" +
6308
6351
  "<nice-icon ng-show=\"!loading\" icon=\"icon-search\"></nice-icon>\n" +
6309
- "<nice-icon ng-show=\"loading\" icon=\"icon-loader\" class=\"d-block nice-animation-spin\"></nice-icon>\n" +
6352
+ "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
6310
6353
  "</span>\n" +
6311
6354
  "<span class=\"input-group-addon clickable\" ng-click=\"remove()\" ng-if=\"model\">\n" +
6312
6355
  "<nice-icon ng-show=\"!loading\" icon=\"icon-x\"></nice-icon>\n" +
@@ -6336,17 +6379,17 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6336
6379
  "<div class=\"row\">\n" +
6337
6380
  "<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6338
6381
  "<div class=\"nice-field col-xs-12\" ng-class=\"[fieldWidth ? fieldWidth : 'col-sm-8', { 'nice-disabled': isDisabled }]\" click-outside=\"close()\">\n" +
6339
- "<div class=\"nice-search-button input-group\" ng-class=\"{ 'disabled': isDisabled, 'has-warning': !isDisabled && form.$invalid && form.$dirty, 'has-success': !isDisabled && form.$valid && form.$dirty}\">\n" +
6382
+ "<div class=\"nice-search-button input-group\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
6340
6383
  "<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" +
6341
6384
  "<span class=\"input-group-addon clickable\" ng-click=\"onFocus()\">\n" +
6342
6385
  "<nice-icon ng-show=\"!loading\" icon=\"icon-search\"></nice-icon>\n" +
6343
- "<nice-icon ng-show=\"loading\" icon=\"icon-loader\" class=\"d-block nice-animation-spin\"></nice-icon>\n" +
6386
+ "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
6344
6387
  "</span>\n" +
6345
6388
  "</div>\n" +
6346
6389
  "<div class=\"nice-search-dropdown-wrapper\">\n" +
6347
6390
  "<div class=\"nice-search-dropdown\" ng-if=\"showDropdown && isOpen\">\n" +
6348
6391
  "<div class=\"nice-search-row nice-search-row-loading\" ng-if=\"loading && results.length == 0\">\n" +
6349
- "<nice-loader visible-when=\"!loading\"></nice-loader>\n" +
6392
+ "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
6350
6393
  "</div>\n" +
6351
6394
  "<div class=\"nice-search-row nice-search-row-empty\" ng-if=\"!loading && results.length == 0\" translate translate-context=\"Nice\">No results found.</div>\n" +
6352
6395
  "<div ng-repeat=\"result in results\" class=\"nice-search-row\" ng-class=\"{'active': selectedIndex == $index}\" ng-click=\"selectItem(result)\">\n" +
@@ -7324,6 +7367,23 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
7324
7367
  );
7325
7368
 
7326
7369
 
7370
+ $templateCache.put('src/components/nice-wrapper/nice-wrapper.html',
7371
+ "<div class=\"nice-wrapper\" ng-class=\"{ 'collapsable': collapsable, 'has-header': hasHeader, 'has-footer': hasFooter }\">\n" +
7372
+ "<div class=\"nice-wrapper-header\" ng-if=\"hasHeader\" ng-click=\"toggle()\">\n" +
7373
+ "<div class=\"nice-wrapper-info\">\n" +
7374
+ "<div class=\"nice-wrapper-title\" ng-transclude=\"title\">{{ title }}</div>\n" +
7375
+ "<div class=\"nice-wrapper-subtitle\" ng-transclude=\"subtitle\">{{ subtitle }}</div>\n" +
7376
+ "</div>\n" +
7377
+ "<button class=\"nice-wrapper-toggle btn btn-icon btn-default-naked\" ng-if=\"collapsable\" ng-class=\"{ 'is-open': isOpen }\">\n" +
7378
+ "<nice-icon icon=\"icon-chevron-down\"></nice-icon>\n" +
7379
+ "</button>\n" +
7380
+ "</div>\n" +
7381
+ "<div class=\"nice-wrapper-body\" ng-transclude ng-if=\"isOpen\"></div>\n" +
7382
+ "<div class=\"nice-wrapper-footer\" ng-if=\"isOpen && hasFooter\" ng-transclude=\"footer\"></div>\n" +
7383
+ "</div>"
7384
+ );
7385
+
7386
+
7327
7387
  $templateCache.put('src/components/nice-yesno/nice-yesno.html',
7328
7388
  "<div class=\"nice-component nice-yesno\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\" ng-form=\"formYesno\">\n" +
7329
7389
  "<div class=\"row\">\n" +