nice-elements 1.7.12 → 1.8.1

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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.8.1 (16.3.2023)
4
+
5
+ - worked on nice-search and nice-search2
6
+
7
+ ## v1.8.0 (16.3.2023)
8
+
9
+ - created nice-wrapper component,
10
+ - created nice loader example page,
11
+ - worked on nice-loader,
12
+ - worked on nice-search and nice-dropdown loading,
13
+ - worked on nice-button,
14
+ - worked on example pages,
15
+ - fixed nice-search and nice-search2 border color,
16
+ - deprecated addClass from nice button and nice loader
17
+
3
18
  ## v1.7.12 (13.3.2023)
4
19
 
5
20
  - fixed build for services
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright (c) 2022 Klemen Kastelic
3
+ Copyright (c) 2023 Klemen Kastelic
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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.1
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.1",
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
  });
@@ -4741,6 +4747,7 @@ angular.module('niceElements')
4741
4747
  onChange: '&?',
4742
4748
  noMargin: '@',
4743
4749
  tabIndex: '@',
4750
+ keyForInputLabel: '@',
4744
4751
  debounceTime: '@',
4745
4752
  isInline: '=',
4746
4753
  help: '@'
@@ -5362,6 +5369,48 @@ angular.module('niceElements')
5362
5369
 
5363
5370
  'use strict';
5364
5371
 
5372
+ /**
5373
+ * @ngdoc directive
5374
+ * @name niceElements.directive:niceWrapper
5375
+ * @description
5376
+ * # niceWrapper
5377
+ */
5378
+ angular.module('niceElements')
5379
+ .directive('niceWrapper', function () {
5380
+ return {
5381
+ templateUrl: 'src/components/nice-wrapper/nice-wrapper.html',
5382
+ restrict: 'E',
5383
+ replace: true,
5384
+ transclude: {
5385
+ 'title': '?niceWrapperTitle',
5386
+ 'subtitle': '?niceWrapperSubtitle',
5387
+ 'footer': '?niceWrapperFooter'
5388
+ },
5389
+ scope: {
5390
+ title: '@',
5391
+ subtitle: '@',
5392
+ collapsable: '=',
5393
+ collapsed: '@',
5394
+ },
5395
+ controller: function ($scope, $transclude) {
5396
+ $scope.isOpen = true;
5397
+ if ($scope.collapsed) $scope.isOpen = false;
5398
+
5399
+ $scope.hasTitle = $transclude.isSlotFilled('title');
5400
+ $scope.hasSubtitle = $transclude.isSlotFilled('subtitle');
5401
+ $scope.hasFooter = $transclude.isSlotFilled('footer');
5402
+ $scope.hasHeader = $scope.hasTitle || $scope.hasSubtitle || $scope.title || $scope.subtitle || $scope.collapsable;
5403
+
5404
+ $scope.toggle = function () {
5405
+ if (!$scope.collapsable) return;
5406
+ $scope.isOpen = !$scope.isOpen;
5407
+ }
5408
+ }
5409
+ };
5410
+ });
5411
+
5412
+ 'use strict';
5413
+
5365
5414
  /**
5366
5415
  * @ngdoc directive
5367
5416
  * @name niceElements.directive:niceYesno
@@ -5517,7 +5566,7 @@ angular.module('niceElements')
5517
5566
  .service('NiceService', function () {
5518
5567
  var service = {
5519
5568
  name: "Nice elements",
5520
- version: "1.7.11",
5569
+ version: "1.8.0",
5521
5570
  getHeader: function () {
5522
5571
  return {};
5523
5572
  }
@@ -5542,12 +5591,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5542
5591
 
5543
5592
 
5544
5593
  $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"
5594
+ "<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" +
5595
+ "<nice-icon icon=\"{{ icon }}\" ng-if=\"icon\" ng-class=\"{ 'opacity-0': loading }\"></nice-icon>\n" +
5596
+ "<span ng-if=\"showSlot\" ng-transclude ng-class=\"{ 'opacity-0': loading }\"></span>\n" +
5597
+ "<nice-loader ng-if=\"loading\" fulldiv=\"true\" class=\"nice-button-loader\"></nice-loader>\n" +
5598
+ "</button>"
5551
5599
  );
5552
5600
 
5553
5601
 
@@ -5979,7 +6027,7 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
5979
6027
  "</div>\n" +
5980
6028
  "<div class=\"not-selected\" ng-if=\"selected == null\">{{ selectText }}</div>\n" +
5981
6029
  "<span class=\"caret\" ng-show=\"!loading\"></span>\n" +
5982
- "<nice-loader visible-when=\"!loading\"></nice-loader>\n" +
6030
+ "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
5983
6031
  "</button>\n" +
5984
6032
  "<div class=\"nice-dropdown-menu-wrapper\">\n" +
5985
6033
  "<div class=\"nice-dropdown-menu\" ng-if=\"isOpen\">\n" +
@@ -6165,12 +6213,12 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6165
6213
 
6166
6214
 
6167
6215
  $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" +
6216
+ "<div class=\"nice-loader\" ng-class=\"{ 'nice-loader-fullscreen': fullscreen, 'nice-loader-fulldiv': fulldiv }\">\n" +
6217
+ "<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" +
6218
+ "<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
6219
  "</svg>\n" +
6172
6220
  "<div class=\"nice-loader-message\" ng-if=\"message\">{{ message }}</div>\n" +
6173
- "<ng-transclude></ng-transclude>\n" +
6221
+ "<ng-transclude ng-if=\"showSlot\"></ng-transclude>\n" +
6174
6222
  "</div>"
6175
6223
  );
6176
6224
 
@@ -6298,15 +6346,11 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6298
6346
  "<div class=\"row\">\n" +
6299
6347
  "<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6300
6348
  "<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" +
6349
+ "<div class=\"input-group\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
6306
6350
  "<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
6351
  "<span class=\"input-group-addon clickable\" ng-click=\"search()\" ng-if=\"!model\">\n" +
6308
6352
  "<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" +
6353
+ "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
6310
6354
  "</span>\n" +
6311
6355
  "<span class=\"input-group-addon clickable\" ng-click=\"remove()\" ng-if=\"model\">\n" +
6312
6356
  "<nice-icon ng-show=\"!loading\" icon=\"icon-x\"></nice-icon>\n" +
@@ -6314,9 +6358,9 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6314
6358
  "</div>\n" +
6315
6359
  "</div>\n" +
6316
6360
  "</div>\n" +
6317
- "<div class=\"row\">\n" +
6361
+ "<div class=\"row\" ng-if=\"noResults || results.length\">\n" +
6318
6362
  "<div ng-class=\"labelWidth ? labelWidth : 'col-sm-4'\" ng-if=\"title\"></div>\n" +
6319
- "<div ng-class=\"fieldWidth ? fieldWidth : 'col-sm-8'\">\n" +
6363
+ "<div class=\"nice-field col-xs-12\" ng-class=\"fieldWidth ? fieldWidth : 'col-sm-8'\">\n" +
6320
6364
  "<div class=\"nice-dropdown-empty\" ng-if=\"noResults\">\n" +
6321
6365
  "<div class=\"nice-search-row\" translate translate-context=\"Nice\">No results found.</div>\n" +
6322
6366
  "</div>\n" +
@@ -6336,17 +6380,17 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
6336
6380
  "<div class=\"row\">\n" +
6337
6381
  "<nice-title title=\"title\" help=\"help\" required=\"required\" label-width=\"labelWidth\"></nice-title>\n" +
6338
6382
  "<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" +
6383
+ "<div class=\"nice-search-button input-group\" ng-class=\"{ 'disabled': isDisabled }\">\n" +
6340
6384
  "<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
6385
  "<span class=\"input-group-addon clickable\" ng-click=\"onFocus()\">\n" +
6342
6386
  "<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" +
6387
+ "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
6344
6388
  "</span>\n" +
6345
6389
  "</div>\n" +
6346
6390
  "<div class=\"nice-search-dropdown-wrapper\">\n" +
6347
6391
  "<div class=\"nice-search-dropdown\" ng-if=\"showDropdown && isOpen\">\n" +
6348
6392
  "<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" +
6393
+ "<nice-loader ng-if=\"loading\"></nice-loader>\n" +
6350
6394
  "</div>\n" +
6351
6395
  "<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
6396
  "<div ng-repeat=\"result in results\" class=\"nice-search-row\" ng-class=\"{'active': selectedIndex == $index}\" ng-click=\"selectItem(result)\">\n" +
@@ -7324,6 +7368,23 @@ angular.module('niceElements').run(['$templateCache', function($templateCache) {
7324
7368
  );
7325
7369
 
7326
7370
 
7371
+ $templateCache.put('src/components/nice-wrapper/nice-wrapper.html',
7372
+ "<div class=\"nice-wrapper\" ng-class=\"{ 'collapsable': collapsable, 'has-header': hasHeader, 'has-footer': hasFooter }\">\n" +
7373
+ "<div class=\"nice-wrapper-header\" ng-if=\"hasHeader\" ng-click=\"toggle()\">\n" +
7374
+ "<div class=\"nice-wrapper-info\">\n" +
7375
+ "<div class=\"nice-wrapper-title\" ng-transclude=\"title\">{{ title }}</div>\n" +
7376
+ "<div class=\"nice-wrapper-subtitle\" ng-transclude=\"subtitle\">{{ subtitle }}</div>\n" +
7377
+ "</div>\n" +
7378
+ "<button class=\"nice-wrapper-toggle btn btn-icon btn-default-naked\" ng-if=\"collapsable\" ng-class=\"{ 'is-open': isOpen }\">\n" +
7379
+ "<nice-icon icon=\"icon-chevron-down\"></nice-icon>\n" +
7380
+ "</button>\n" +
7381
+ "</div>\n" +
7382
+ "<div class=\"nice-wrapper-body\" ng-transclude ng-if=\"isOpen\"></div>\n" +
7383
+ "<div class=\"nice-wrapper-footer\" ng-if=\"isOpen && hasFooter\" ng-transclude=\"footer\"></div>\n" +
7384
+ "</div>"
7385
+ );
7386
+
7387
+
7327
7388
  $templateCache.put('src/components/nice-yesno/nice-yesno.html',
7328
7389
  "<div class=\"nice-component nice-yesno\" ng-class=\"{ 'margin-bottom-0' : noMargin, 'nice-component-inline': isInline }\" ng-form=\"formYesno\">\n" +
7329
7390
  "<div class=\"row\">\n" +