cronapp-framework-js 2.8.23 → 2.8.24

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.
Files changed (56) hide show
  1. package/components/crn-button.components.json +12 -2
  2. package/components/crn-enterprise-checkbox.components.json +5 -0
  3. package/components/crn-enterprise-combobox-multiple.components.json +5 -0
  4. package/components/crn-enterprise-dynamic-combobox.components.json +1 -1
  5. package/components/crn-icon.components.json +20 -12
  6. package/components/crn-image.components.json +4 -4
  7. package/components/crn-rating.components.json +31 -29
  8. package/components/crn-upload-file.components.json +2 -3
  9. package/components/crn-upload.components.json +2 -2
  10. package/components/css/checkbox-color.css +16 -0
  11. package/components/css/color-default.css +2 -0
  12. package/components/css/font-size.css +15 -0
  13. package/components/css/image.css +15 -0
  14. package/components/templates/button.template.html +2 -2
  15. package/components/templates/cron-checkbox.template.html +1 -2
  16. package/components/templates/cron-combobox-multiple.template.html +1 -1
  17. package/components/templates/cron-crud.template.html +43 -7
  18. package/components/templates/cron-dynamic-combobox.template.html +2 -3
  19. package/components/templates/fileupload-button.template.html +1 -1
  20. package/components/templates/fileupload.template.html +1 -1
  21. package/components/templates/form.template.html +44 -21
  22. package/components/templates/icon.template.html +1 -1
  23. package/components/templates/image.default.template.html +1 -2
  24. package/components/templates/rating.template.html +6 -6
  25. package/components/templates/social-button-bar.template.html +11 -12
  26. package/components/templates/sub-form.template.html +44 -11
  27. package/components/templates/textinputbutton.template.html +3 -1
  28. package/css/app.css +27 -0
  29. package/dist/components/css/checkbox-color.css +1 -1
  30. package/dist/components/css/color-default.css +1 -1
  31. package/dist/components/css/font-size.css +1 -0
  32. package/dist/components/css/image.css +1 -0
  33. package/dist/components/templates/button.template.html +1 -1
  34. package/dist/components/templates/cron-checkbox.template.html +1 -1
  35. package/dist/components/templates/cron-combobox-multiple.template.html +1 -1
  36. package/dist/components/templates/cron-crud.template.html +1 -1
  37. package/dist/components/templates/cron-dynamic-combobox.template.html +1 -1
  38. package/dist/components/templates/fileupload-button.template.html +1 -1
  39. package/dist/components/templates/fileupload.template.html +1 -1
  40. package/dist/components/templates/form.template.html +1 -1
  41. package/dist/components/templates/icon.template.html +1 -1
  42. package/dist/components/templates/image.default.template.html +1 -1
  43. package/dist/components/templates/rating.template.html +1 -1
  44. package/dist/components/templates/social-button-bar.template.html +1 -1
  45. package/dist/components/templates/sub-form.template.html +1 -1
  46. package/dist/components/templates/textinputbutton.template.html +1 -1
  47. package/dist/css/app.css +1 -1
  48. package/dist/js/app.js +1 -1
  49. package/dist/js/controllers.js +1 -1
  50. package/dist/js/directives.js +1 -1
  51. package/dist/js/upload.service.js +1 -1
  52. package/js/app.js +39 -21
  53. package/js/controllers.js +18 -11
  54. package/js/directives.js +15 -7
  55. package/js/upload.service.js +7 -3
  56. package/package.json +11 -11
@@ -1 +1 @@
1
- (function(){function a(a){var b=[].slice.call(arguments,1),c=0;return a.replace(/%s/g,function(){return b[c++]})}angular.module("upload.services",[]).service("UploadService",["$http","$compile","$modal","Upload",function(a,b,c){var d=$("body"),e=angular.element(d.get(0)).scope();this.ensureProps=a=>(a.filter&&(a.filter=a.filter.replace(/\s/g,"")),a),this.upload=function(a){let b=this.ensureProps(a);c.open({templateUrl:"node_modules/cronapp-framework-js/components/upload/upload.html",controller:"UploadController",resolve:{data:function(){return b}}})}.bind(this)}]),angular.module("custom.controllers").controller("UploadController",["$scope","$http","$translate","$stateParams","$location","$http","$modalInstance","data",function(b,c,d,e,f,c,g,h){app.registerEventsCronapi(b,d),b.params=e,b.$http=c;var i=f.search();for(var j in i)i.hasOwnProperty(j)&&(b.params[j]=i[j]);b.files=[],b.uploading=!1,b.uploaded=!0,b.progress=0,b.data=h,b.message=d.instant("Upload.oneFile"),"true"==h.multiple&&(b.message=d.instant("Upload.multipleFile")),h.description&&(b.message=h.description),b.safeApply=safeApply,b.uploadFile=function(e){var f=b.data.scope,g="api/cronapi/upload/"+h.id,j=new FormData;if(0==e.length)this.Notification.error(a(d.instant("Upload.errorValidation"),h.maxSize,h.filter));else{for(var k=0;k<e.length;k++)j.append("file",e[k]),console.log(e[k].$valid);var l=JSON.parse(localStorage.getItem("_u"));this.$promise=c({method:"POST",url:(window.hostApp||"")+g,data:j,headers:{"Content-Type":void 0,"X-AUTH-TOKEN":l?l.token:""},onProgress:function(a){this.safeApply(function(){if(a.lengthComputable){var c=0|100*(a.loaded/a.total);b.progress=c}b.uploading=!0,console.log(c)})}.bind(this)}).success(function(a){f.cronapi.evalInContext(JSON.stringify(a)).then(()=>{b.uploaded=!0,b.uploading=!1,b.close()})}.bind(this)).error(function(a){this.Notification.error(a.error),b.uploading=!1,b.close()}.bind(this))}}.bind(b),b.close=function(){g.dismiss("cancel")}}])})(app);
1
+ (function(){function a(a){var b=[].slice.call(arguments,1),c=0;return a.replace(/%s/g,function(){return b[c++]})}angular.module("upload.services",[]).service("UploadService",["$http","$compile","$modal","Upload",function(a,b,c){var d=$("body"),e=angular.element(d.get(0)).scope();this.ensureProps=a=>(a.filter&&(a.filter=a.filter.replace(/\s/g,"")),a),this.upload=function(a){let b=this.ensureProps(a);c.open({templateUrl:"node_modules/cronapp-framework-js/components/upload/upload.html",controller:"UploadController",resolve:{data:function(){return b}}})}.bind(this)}]),angular.module("custom.controllers").controller("UploadController",["$scope","$http","$translate","$stateParams","$location","$http","$modalInstance","data",function(b,c,d,e,f,c,g,h){app.registerEventsCronapi(b,d),b.params=e,b.$http=c;var i=f.search();for(var j in i)i.hasOwnProperty(j)&&(b.params[j]=i[j]);b.files=[],b.uploading=!1,b.uploaded=!0,b.progress=0,b.data=h,b.message=d.instant("Upload.oneFile"),"true"==h.multiple&&(b.message=d.instant("Upload.multipleFile")),h.description&&(b.message=h.description),b.safeApply=safeApply,b.uploadFile=function(e){var f=b.data.scope,g="api/cronapi/upload/"+h.id,j=new FormData;if(0==e.length)this.Notification.error(a(d.instant("Upload.errorValidation"),h.maxSize,h.filter));else{for(var k=0;k<e.length;k++)j.append("file",e[k]),console.log(e[k].$valid);var l=JSON.parse(localStorage.getItem("_u"));this.$promise=c({method:"POST",url:(window.hostApp||"")+g,data:j,headers:{"Content-Type":void 0,"X-AUTH-TOKEN":l?l.token:""},onProgress:function(a){this.safeApply(function(){if(a.lengthComputable){var c=0|100*(a.loaded/a.total);b.progress=c}b.uploading=!0,console.log(c)})}.bind(this)}).then(function(a){f.cronapi.evalInContext(JSON.stringify(a)).then(()=>{b.uploaded=!0,b.uploading=!1,b.close()})}.bind(this)).catch(function(a){let c=a.error;a&&a.data&&(c=a.data.error),this.Notification.error(c),b.uploading=!1,b.close()}.bind(this))}}.bind(b),b.close=function(){g.dismiss("cancel")}}])})(app);
package/js/app.js CHANGED
@@ -30,6 +30,14 @@ var onloadCallback = function() {
30
30
  window.grecaptcha.reset();
31
31
  };
32
32
 
33
+ var getRequestData = data => {
34
+ let result = data || {};
35
+ if (data.data && typeof data.data === 'object') {
36
+ result = data.data;
37
+ }
38
+ return result;
39
+ };
40
+
33
41
  var app = (function() {
34
42
 
35
43
  return angular.module('MyApp', cronappModules)
@@ -41,6 +49,9 @@ var app = (function() {
41
49
  'preferredLocale': 'pt_br',
42
50
  'urlPrefix': ''
43
51
  })
52
+ .config(['$locationProvider', function($locationProvider) {
53
+ $locationProvider.hashPrefix('');
54
+ }])
44
55
  .config([
45
56
  '$httpProvider',
46
57
  function($httpProvider) {
@@ -127,6 +138,8 @@ var app = (function() {
127
138
 
128
139
  var locale = (window.navigator.userLanguage || window.navigator.language).replace('-', '_').toLowerCase();
129
140
  $translateProvider.use(locale);
141
+ $translateProvider.preferredLanguage(locale);
142
+ $translateProvider.fallbackLanguage('en_us');
130
143
 
131
144
  $translateProvider.useSanitizeValueStrategy('escaped');
132
145
 
@@ -246,7 +259,7 @@ var app = (function() {
246
259
 
247
260
  })
248
261
 
249
- .run(function($rootScope, $state, $stateParams, $timeout) {
262
+ .run(function($rootScope, $state, $stateParams, $timeout, $transitions) {
250
263
  // It's very handy to add references to $state and $stateParams to the $rootScope
251
264
  // so that you can access them from any scope within your applications.For example,
252
265
  // <li ng-class="{ active: $state.includes('contacts.list') }"> will set the <li>
@@ -254,26 +267,27 @@ var app = (function() {
254
267
  $rootScope.$state = $state;
255
268
  $rootScope.$stateParams = $stateParams;
256
269
 
257
- $rootScope.$on('$stateChangeError', function() {
258
- if (arguments.length >= 6) {
259
- var requestObj = arguments[5];
260
- if (requestObj.status === 404 || requestObj.status === 403 || requestObj.status === 401) {
261
- if (requestObj.status === 404) {
262
- $state.go('404');
263
- }
264
- else if (requestObj.status === 403) {
265
- $state.go('403');
266
- }
267
- else {
268
- localStorage.removeItem('_u');
269
- $state.go('loginReturnUrl', { "returnUrl" : window.location.hash });
270
- }
270
+ const $stateChangeError = function(error) {
271
+ if (error) {
272
+ const errorMessage = error.toString();
273
+ if (errorMessage.includes('=404')) {
274
+ $state.go('404');
275
+ }
276
+ else if (errorMessage.includes('=403')) {
277
+ $state.go('403');
278
+ }
279
+ else if (errorMessage.includes('=401')) {
280
+ localStorage.removeItem('_u');
281
+ $state.go('loginReturnUrl', { "returnUrl" : window.location.hash });
282
+ } else {
283
+ $state.go('404');
271
284
  }
272
285
  } else {
273
286
  $state.go('404');
274
287
  }
275
- });
276
- $rootScope.$on('$stateChangeSuccess', function(event, currentRoute, previousRoute) {
288
+ };
289
+
290
+ const $stateChangeSuccess = function(currentRoute) {
277
291
  $timeout(() => {
278
292
  let systemName = $('#projectName').length ? $('#projectName').val() : $('h1:first').length && $('h1:first').text().trim().length ? $('h1:first').text().trim() : '';
279
293
 
@@ -320,7 +334,11 @@ var app = (function() {
320
334
 
321
335
  $rootScope.renderFinished = true;
322
336
  });
323
- });
337
+ };
338
+
339
+ $transitions.onSuccess({}, (transition) => $stateChangeSuccess(transition.to()));
340
+ $state.defaultErrorHandler(error => $stateChangeError(error));
341
+
324
342
  });
325
343
 
326
344
  }(window));
@@ -419,9 +437,9 @@ app.factory('customTranslateLoader', function ($http, $q) {
419
437
  ].join(''),
420
438
  method: 'GET',
421
439
  params: ''
422
- }, options.$http)).success(function (data) {
423
- deferred.resolve(data);
424
- }).error(function () {
440
+ }, options.$http)).then(function (data) {
441
+ deferred.resolve(getRequestData(data));
442
+ }).catch(function () {
425
443
  deferred.resolve({});
426
444
  });
427
445
 
package/js/controllers.js CHANGED
@@ -6,7 +6,8 @@
6
6
  $http({
7
7
  method: 'GET',
8
8
  url: 'auth/refresh'
9
- }).success(function (data, status, headers, config) {
9
+ }).then(function (data, status, headers, config) {
10
+ data = getRequestData(data);
10
11
  //Keeping the user information, the auth/refresh only has name and username info
11
12
  if (localStorage.getItem("_u")) {
12
13
  let currentSession = JSON.parse(localStorage.getItem("_u"));
@@ -21,7 +22,7 @@
21
22
  // refresh time
22
23
  }, (1800 * 1000));
23
24
  success();
24
- }).error(function () {
25
+ }).catch(function () {
25
26
  error();
26
27
  });
27
28
  };
@@ -51,12 +52,12 @@
51
52
  'Content-Type': 'application/x-www-form-urlencoded',
52
53
  'X-AUTH-TOKEN': $location.search().token
53
54
  }
54
- }).success(() => {
55
+ }).then(() => {
55
56
  Notification.info($translate.instant('ResetPasswordSuccess'));
56
57
  passwordNew.value = "";
57
58
  passwordConfirmation.value = "";
58
59
  $state.go('login');
59
- }).error(data => Notification.error(data));
60
+ }).catch(data => Notification.error(data));
60
61
  //
61
62
  }
62
63
  });
@@ -160,7 +161,7 @@
160
161
  url : 'auth',
161
162
  data : $.param(user),
162
163
  headers : headerValues
163
- }).success(handleSuccess).error(handleError);
164
+ }).then(handleSuccess).catch(handleError);
164
165
  };
165
166
 
166
167
  $scope.forgotPassword = function () {
@@ -181,14 +182,15 @@
181
182
  headers: {
182
183
  'Content-Type': 'application/x-www-form-urlencoded'
183
184
  }
184
- }).success(() => {
185
+ }).then(() => {
185
186
  Notification.info($translate.instant('ForgotPasswordSent'));
186
187
  forgotPasswordEmail.value = "";
187
188
  $("#forgotPasswordModal").modal("hide");
188
- }).error(data => Notification.error(data));
189
+ }).catch(data => Notification.error(data));
189
190
  };
190
191
 
191
192
  function handleSuccess(data, status, headers, config) {
193
+ data = getRequestData(data);
192
194
  // Store data response on session storage
193
195
  // The local storage will be cleaned when the browser window is closed
194
196
  if(typeof (Storage) !== "undefined") {
@@ -212,6 +214,8 @@
212
214
  }
213
215
 
214
216
  function handleError(data, status, headers, config) {
217
+ status = status || data.status;
218
+ data = getRequestData(data);
215
219
  let error;
216
220
  if (data !== null && data.message) {
217
221
  let message = JSON.parse(data.message);
@@ -311,9 +315,10 @@
311
315
  headers : {
312
316
  'Content-Type' : 'application/json'
313
317
  }
314
- }).success(clean).error(clean);
318
+ }).then(clean).catch(clean);
315
319
 
316
320
  function clean(result) {
321
+ result = getRequestData(result);
317
322
  $rootScope.session = {};
318
323
  if(typeof (Storage) !== "undefined") {
319
324
  localStorage.removeItem("_u");
@@ -343,7 +348,7 @@
343
348
  headers : {
344
349
  'Content-Type' : 'application/x-www-form-urlencoded'
345
350
  }
346
- }).success(changeSuccess).error(changeError);
351
+ }).then(changeSuccess).catch(changeError);
347
352
  }
348
353
 
349
354
  function changeSuccess(data, status, headers, config) {
@@ -352,6 +357,8 @@
352
357
  }
353
358
 
354
359
  function changeError(data, status, headers, config) {
360
+ status = status || data.status;
361
+ data = getRequestData(data);
355
362
  var error;
356
363
 
357
364
  if (status === 422) {
@@ -439,7 +446,7 @@
439
446
  headers : {
440
447
  'Content-Type' : 'application/x-www-form-urlencoded'
441
448
  }
442
- }).success(changeSuccess).error(changeError);
449
+ }).then(changeSuccess).catch(changeError);
443
450
 
444
451
  function changeSuccess(data, status, headers, config) {
445
452
  $rootScope.session.theme = theme;
@@ -448,7 +455,7 @@
448
455
  }
449
456
 
450
457
  function changeError(data, status, headers, config) {
451
- var error = data;
458
+ var error = getRequestData(data);
452
459
  Notification.error(error);
453
460
  }
454
461
  }
package/js/directives.js CHANGED
@@ -4466,12 +4466,16 @@
4466
4466
  require: 'ngModel',
4467
4467
  link: function(scope, elem, attrs, ngModelCtrl) {
4468
4468
 
4469
- attrs.theme = $(elem).find('i').attr('xattr-theme');
4470
- attrs.iconOn = $(elem).find('i').attr('class');
4471
-
4472
4469
  var $elem = $(elem);
4473
4470
  var starArray = [];
4474
4471
 
4472
+ var icon = $elem.find('i');
4473
+
4474
+ attrs.iconSize = icon[0].dataset.size;
4475
+ attrs.iconTheme = icon[0].dataset.theme;
4476
+ attrs.iconOn = icon[0].className;
4477
+ attrs.iconOn = attrs.iconOn.replace(attrs.iconSize).replace(attrs.iconTheme);
4478
+
4475
4479
  if (attrs.xattrDefaultValue) {
4476
4480
  ngModelCtrl.$viewValue = 0; //set new view value
4477
4481
  ngModelCtrl.$commitViewValue();
@@ -4479,6 +4483,7 @@
4479
4483
 
4480
4484
  for (var i=1;i<=5;i++) {
4481
4485
  starArray.push($(elem).find('i').get(i - 1));
4486
+ $(starArray[i-1]).removeClass(attrs.iconOn);
4482
4487
  $(starArray[i-1]).addClass(attrs.iconOff || "fa fa-star-o");
4483
4488
  }
4484
4489
 
@@ -4507,13 +4512,16 @@
4507
4512
  for (var i=1;i<=5;i++) {
4508
4513
  stars[i-1].removeClass(attrs.iconOff || 'fa fa-star-o');
4509
4514
  stars[i-1].removeClass(attrs.iconOn);
4510
- stars[i-1].removeClass(attrs.theme);
4515
+ stars[i-1].removeClass(attrs.iconSize);
4516
+ stars[i-1].removeClass(attrs.iconTheme);
4511
4517
  if (i <= value) {
4512
4518
  stars[i-1].addClass(attrs.iconOn);
4513
- stars[i-1].addClass(attrs.theme);
4519
+ stars[i-1].addClass(attrs.iconSize);
4520
+ stars[i-1].addClass(attrs.iconTheme);
4514
4521
  } else {
4515
4522
  stars[i-1].addClass(attrs.iconOff || 'fa fa-star-o');
4516
- stars[i-1].addClass(attrs.theme);
4523
+ stars[i-1].addClass(attrs.iconSize);
4524
+ stars[i-1].addClass(attrs.iconTheme);
4517
4525
  }
4518
4526
  }
4519
4527
  return value;
@@ -4640,7 +4648,7 @@
4640
4648
  //Somente fica na vertical se for o menu principal da IDE (E estiver configurado para isso)
4641
4649
  let isVertical = element.closest('.crn-navigator-vertical').length;
4642
4650
 
4643
- var TEMPLATE_MAIN = '<ul class="nav navbar-nav ' + (isVertical ? 'col-md-12 padding-0' : '') + ' " style="float:left"></ul>';
4651
+ var TEMPLATE_MAIN = '<ul class="nav navbar-nav ' + (isVertical ? 'col-md-12 padding-0' : '') + ' "></ul>';
4644
4652
  var options = {};
4645
4653
  try {
4646
4654
  options = JSON.parse(attrs.options);
@@ -98,14 +98,18 @@
98
98
  console.log(complete);
99
99
  });
100
100
  }.bind(this)
101
- }).success(function(data, status, headers, config) {
101
+ }).then(function(data, status, headers, config) {
102
102
  pageScope.cronapi.evalInContext(JSON.stringify(data)).then((result) => {
103
103
  $scope.uploaded = true;
104
104
  $scope.uploading = false;
105
105
  $scope.close();
106
106
  });
107
- }.bind(this)).error(function(data, status, errorThrown) {
108
- this.Notification.error(data.error);
107
+ }.bind(this)).catch(function(data, status, errorThrown) {
108
+ let error = data.error;
109
+ if (data && data.data) {
110
+ error = data.data.error;
111
+ }
112
+ this.Notification.error(error);
109
113
  $scope.uploading = false;
110
114
  $scope.close();
111
115
  }.bind(this));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "2.8.23",
3
+ "version": "2.8.24",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {
@@ -43,10 +43,10 @@
43
43
  "pace": "HubSpot/pace#v0.7.8",
44
44
  "raphael": "DmitryBaranovskiy/raphael#v2.1.4",
45
45
  "ui-select-infinity": "hyzhak/ui-select-infinity#v0.1.5",
46
- "angular-ui-router": "angular-ui/ui-router#0.2.15",
46
+ "angular-ui-router": "1.0.29",
47
47
  "eonasdan-bootstrap-datetimepicker": "^4.17.49",
48
48
  "natives": "1.1.6",
49
- "angular": "1.5.9",
49
+ "angular": "1.8.2",
50
50
  "angular-ui-bootstrap": "0.13.0",
51
51
  "angular-chart.js": "1.1.1",
52
52
  "angular-cookies": "1.5.8",
@@ -54,21 +54,21 @@
54
54
  "angular-i18n": "1.4.5",
55
55
  "angular-resource": "1.3.15",
56
56
  "angular-sanitize": "1.3.15",
57
- "angular-translate": "2.11.1",
58
- "angular-translate-handler-log": "2.11.1",
59
- "angular-translate-loader-static-files": "2.11.1",
60
- "angular-translate-storage-cookie": "2.11.1",
61
- "angular-translate-storage-local": "2.11.1",
57
+ "angular-translate": "2.19.0",
58
+ "angular-translate-handler-log": "2.19.0",
59
+ "angular-translate-loader-static-files": "2.19.0",
60
+ "angular-translate-storage-cookie": "2.19.0",
61
+ "angular-translate-storage-local": "2.19.0",
62
62
  "angular-ui-notification": "0.3.6",
63
63
  "ui-select": "0.18.1",
64
- "bootstrap": "3.3.4",
64
+ "bootstrap": "3.4.1",
65
65
  "chart.js": "2.7.0",
66
66
  "cpf_cnpj": "0.2.0",
67
67
  "font-awesome": "4.4.0",
68
68
  "jquery": "3.5.1",
69
69
  "justgage": "1.3.5",
70
- "moment": "2.9.0",
71
- "moment-timezone": "0.4.0",
70
+ "moment": "2.29.1",
71
+ "moment-timezone": "0.5.33",
72
72
  "ng-file-upload": "12.2.13"
73
73
  }
74
74
  }