cronapp-framework-js 3.1.0 → 3.2.0-SP.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/js/controllers.js CHANGED
@@ -50,17 +50,15 @@ if (!window.hostApp) {
50
50
  return;
51
51
  }
52
52
 
53
- let headerValues = window.isUsingCookie() ? {
54
- 'Content-Type': 'application/x-www-form-urlencoded'
55
- } : {
56
- 'Content-Type': 'application/x-www-form-urlencoded',
57
- 'X-AUTH-TOKEN' : $location.search().token
58
- };
53
+ // O token vem como parametro do link de redefinição de senha, não pode usar cookie nesta requisição
59
54
  $http({
60
55
  method: 'POST',
61
56
  url: window.hostApp + 'auth/confirm-reset-password',
62
57
  data: $.param({password: passwordNew.value}),
63
- headers: headerValues
58
+ headers: {
59
+ 'Content-Type': 'application/x-www-form-urlencoded',
60
+ 'X-AUTH-TOKEN' : $location.search().token
61
+ }
64
62
  }).then(() => {
65
63
  Notification.info($translate.instant('ResetPasswordSuccess'));
66
64
  passwordNew.value = "";
package/js/directives.js CHANGED
@@ -2484,7 +2484,8 @@
2484
2484
  };
2485
2485
 
2486
2486
  var column = this.getColumnByField(options, opt.field);
2487
- if (column.visibleCrud != undefined && !column.visibleCrud) {
2487
+ var visibleCrud = (column.visibleCrud == undefined || column.visibleCrud);
2488
+ if (!visibleCrud && !column.visible) {
2488
2489
  container.parent().find('.k-edit-label [for='+ column.field +']').parent().remove();
2489
2490
  container.remove();
2490
2491
  }
@@ -2495,8 +2496,13 @@
2495
2496
  var $input = $(`<input ${required} name="${opt.field}" id="${buttonId}" from-grid=true ng-model="${ngModel}" />`); //
2496
2497
  $input.data('change-grid-model', changeGridModel);
2497
2498
  $input.data('column-type', column.type);
2498
-
2499
- if (column.inputType == 'dynamicComboBox' || column.inputType == 'comboBox') {
2499
+
2500
+ if (!visibleCrud) {
2501
+ var valueModel = scope.$eval(`${ngModel}`);
2502
+ if (valueModel) {
2503
+ container.text(valueModel);
2504
+ }
2505
+ } else if (column.inputType == 'dynamicComboBox' || column.inputType == 'comboBox') {
2500
2506
  var kendoConfig = app.kendoHelper.getConfigComboboxSync(column.comboboxOptions, scope);
2501
2507
  kendoConfig.autoBind = true;
2502
2508
  kendoConfig.optionLabel = undefined;
@@ -4032,7 +4038,7 @@
4032
4038
  }
4033
4039
  };
4034
4040
  })
4035
-
4041
+
4036
4042
  .directive('cronDynamicSelect', function ($compile, $timeout, $parse, $translate, $log) {
4037
4043
  return {
4038
4044
  restrict: 'E',
@@ -4220,99 +4226,32 @@
4220
4226
  });
4221
4227
  }
4222
4228
 
4223
- options.virtual.valueMapper = async function(options) {
4229
+ options.virtual.valueMapper = async function (options) {
4224
4230
  await waitRender();
4225
-
4226
- $log.debug("valueMapper | " + attrs['id'] + " | " + options.value);
4227
-
4228
- if (lastValueMapper && !lastValueMapper.completed) {
4229
- $log.debug("valueMapper Canceling | " + lastValueMapper.value);
4230
- lastValueMapper.canceled = true;
4231
- }
4232
-
4231
+ $log.debug(`valueMapper | ${attrs['id']} | ${options.value}`);
4232
+
4233
+ if (lastValueMapper && lastValueMapper.completed === false) lastValueMapper.canceled = true;
4233
4234
  lastValueMapper = options;
4234
-
4235
- var _combobox = _options.combobox;
4236
- if (options.canceled) {
4237
- $log.debug("valueMapper CANCELED | " + options.value);
4238
- return;
4239
- }
4240
-
4241
- if (options.value || options.value === "") {
4242
- if(_combobox.options.optionLabel[_combobox.options.dataValueField] !== null && options.value === ""){
4243
- options.completed = true;
4244
- $log.debug("valueMapper.success | " + attrs['id'] + " | NULL");
4245
- options.success(null);
4246
- }
4247
- else{
4248
- _combobox.isEvaluating = true;
4249
- var _dataSource = _options.dataSource.transport.options.cronappDatasource;
4250
- if (options.value === undefined || options.value === null || options.value === "") {
4251
- options.completed = true;
4252
- $log.debug("valueMapper.success | " + attrs['id'] + " | NULL");
4253
- options.success(null);
4254
- _combobox.isEvaluating = false;
4255
- } else {
4256
- $log.debug("valueMapper.findObj | " + attrs['id'] + " | " + options.value);
4257
- _dataSource.findObj([options.value], false, function(data) {
4258
- options.completed = true;
4259
-
4260
- if (options.canceled) {
4261
- $log.debug("valueMapper CANCELED | " + options.value);
4262
- _combobox.isEvaluating = false;
4263
- return;
4264
- }
4265
- if (Array.isArray(data)) {
4266
- data = data[0];
4267
- }
4268
- $log.debug("valueMapper.success | " + attrs['id'] + " | " + data);
4269
- options.success(data);
4270
- _combobox.isEvaluating = false;
4271
-
4272
- if (select.changeCursor) {
4273
- scope.safeApply(function() {
4274
- if (options.canceled) {
4275
- $log.debug("valueMapper CANCELED | " + options.value);
4276
- return;
4277
- }
4278
- if (data != null) {
4279
- var found = _goTo(_scope, _combobox, data);
4280
- if (!found) {
4281
- _dataSource.data.push(data);
4282
- found = _goTo(_scope, _combobox, data);
4283
- }
4284
- if (found) {
4285
- modelSetter(_scope, found[select.dataValueField]);
4286
- }
4287
- } else {
4288
- modelSetter(_scope, null);
4289
- }
4290
- });
4291
- } else {
4292
- if (data == null) {
4293
- modelSetter(_scope, null);
4294
- }
4295
- }
4296
- }, function() {
4297
- options.completed = true;
4298
- if (options.canceled) {
4299
- $log.debug("valueMapper CANCELED | " + options.value);
4300
- _combobox.isEvaluating = false;
4301
- return;
4302
- }
4303
- $log.debug("valueMapper.success | " + attrs['id'] + " | NULL");
4304
- options.success(null);
4305
- _combobox.isEvaluating = false;
4306
- }, [combobox.options.dataValueField]);
4307
- }
4308
- }
4309
- } else {
4310
- $log.debug("valueMapper.success | " + attrs['id'] + " | NULL");
4311
- options.success(null);
4235
+
4236
+ const { optionLabel, dataValueField } = _options.combobox.options;
4237
+ const dataSource = _options.dataSource.transport.options.cronappDatasource;
4238
+
4239
+ if (options.canceled || !options.value || (optionLabel[dataValueField] && options.value === "")) {
4240
+ return options.success(null);
4312
4241
  }
4242
+
4243
+ _options.combobox.isEvaluating = true;
4244
+
4245
+ dataSource.findObj([options.value], false, (data) => {
4246
+ if (options.canceled) return;
4247
+ options.success(Array.isArray(data) ? data[0] : data);
4248
+ $log.debug(`valueMapper.success | ${attrs['id']} | ${data}`);
4249
+ }, () => options.success(null), [dataValueField]);
4250
+
4251
+ options.completed = _options.combobox.isEvaluating = false;
4313
4252
  };
4314
4253
  }
4315
-
4254
+
4316
4255
  options.messages = {
4317
4256
  noData: attrs.noResultsMessage ? attrs.noResultsMessage : "NO DATA FOUND"
4318
4257
  };
@@ -4322,24 +4261,42 @@
4322
4261
  scope.safeApply(() => {
4323
4262
  var contextVars = {
4324
4263
  'selected' : dataItem,
4325
- 'selectedKey' : dataItem[options.dataValueField],
4326
- 'selectedValue' : dataItem[options.dataTextField]
4264
+ 'selectedKey' : dataItem ? dataItem[options.dataValueField] : "",
4265
+ 'selectedValue' : dataItem ? dataItem[options.dataTextField] : ""
4327
4266
  };
4328
- scope.$eval(attrs.ngChange, contextVars);
4267
+ scope.$eval(attrs.ngChange, contextVars);
4329
4268
  });
4330
4269
  } : undefined;
4331
4270
 
4332
- options.close = attrs.ngClose ? function (){scope.$eval(attrs.ngClose)}: undefined;
4333
- options.dataBound = attrs.ngDataBound ? function (){scope.$eval(attrs.ngDataBound)}: undefined;
4334
- options.filtering = attrs.ngFiltering ? function (){scope.$eval(attrs.ngFiltering)}: undefined;
4335
- options.open = function(e) {
4271
+
4272
+ options.close = attrs.ngClose ? function () {
4273
+ scope.$eval(attrs.ngClose);
4274
+ } : undefined;
4275
+
4276
+ options.dataBound = function () {
4277
+ if (!scope.$$phase && !scope.$root.$$phase) {
4278
+ _compileAngular(scope, combobox.element[0]);
4279
+ }
4280
+ };
4281
+
4282
+
4283
+ options.filtering = attrs.ngFiltering ? function () {
4284
+ scope.$eval(attrs.ngFiltering);
4285
+ } : undefined;
4286
+
4287
+ options.open = function (e) {
4336
4288
  if (!dataSourceScreen.fetched || (dataSourceScreen.lastLoadedTime !== combobox.dataSource.lastLoadedTime)) {
4337
4289
  combobox.options.firstLazyRead = true;
4338
4290
  combobox.dataSource.read();
4339
4291
  combobox.dataSource.lastLoadedTime = dataSourceScreen.lastLoadedTime;
4340
4292
  }
4293
+
4294
+ let emptyOption = { [combobox.options.dataValueField]: "", [combobox.options.dataTextField]: "" };
4295
+ if (!combobox.dataSource.data().some(item => item[combobox.options.dataValueField] === "")) {
4296
+ combobox.dataSource.add(emptyOption);
4297
+ }
4341
4298
  };
4342
-
4299
+
4343
4300
  options.select = attrs.ngSelect ? function (e) {
4344
4301
  scope.safeApply(() => {
4345
4302
  var contextVars = {
@@ -4370,6 +4327,49 @@
4370
4327
  dataSourceScreen.__ignoreFirstFetch = true;
4371
4328
  }
4372
4329
  var combobox = $element.kendoDropDownList(options).data('kendoDropDownList');
4330
+ combobox.isEvaluating = false;
4331
+
4332
+ function forceEmptyLineSelected() {
4333
+ var optionLabel = combobox.list.find('.k-list-optionlabel');
4334
+
4335
+ if (optionLabel && optionLabel.length) {
4336
+ optionLabel.addClass("k-state-selected k-state-focused");
4337
+ }
4338
+ $log.debug("Linha vazia marcada como ativa:", optionLabel);
4339
+ }
4340
+
4341
+ var scrolling = false;
4342
+
4343
+ combobox.bind("open", function () {
4344
+ if (scrolling) return;
4345
+ scrolling = true;
4346
+
4347
+ setTimeout(() => {
4348
+ scrolling = false;
4349
+ }, 300);
4350
+ });
4351
+
4352
+ combobox.bind("change", function () {
4353
+ if (combobox.isEvaluating) return;
4354
+ combobox.isEvaluating = true;
4355
+
4356
+ try {
4357
+ let selectedItem = combobox.dataItem();
4358
+
4359
+ if (selectedItem && selectedItem[options.dataValueField] === "") {
4360
+ modelSetter(scope, "");
4361
+ modelTextFieldSetter(scope, "");
4362
+ } else {
4363
+ modelSetter(scope, selectedItem[options.dataValueField]);
4364
+ modelTextFieldSetter(scope, selectedItem[options.dataTextField]);
4365
+ }
4366
+
4367
+ forceEmptyLineSelected();
4368
+ } finally {
4369
+ combobox.isEvaluating = false;
4370
+ }
4371
+ });
4372
+
4373
4373
  options.combobox = combobox;
4374
4374
  $(combobox.element[0]).attr('tabindex','-1');
4375
4375
  if (dataSourceScreen != null && dataSourceScreen != undefined) {
@@ -4434,63 +4434,22 @@
4434
4434
  /**
4435
4435
  * Observa o read do datasource para setar o primeiro valor ou valor inicial.
4436
4436
  */
4437
- var defineInitialValue = function() {
4437
+ var defineInitialValue = function () {
4438
4438
  if (combobox.definingInitialValue) {
4439
4439
  return;
4440
4440
  }
4441
4441
  if (!combobox.isEvaluating) {
4442
- var currentValue = returnTypedValue(combobox.value());
4442
+ var currentValue = combobox.value();
4443
4443
  var nextValue = null;
4444
-
4445
- var found = dataSourceScreen.goTo(currentValue);
4446
-
4447
- if (!found) {
4448
- if ((combobox.options.lazyFirstInitialValue || !dataSourceScreen.lazy) && select.initValue != undefined && select.initValue != null) {
4449
- combobox.options.lazyFirstInitialValue = false;
4450
- found = dataSourceScreen.goTo(select.initValue);
4451
- if (found) {
4452
- nextValue = select.initValue;
4453
- }
4454
- }
4455
-
4456
-
4457
- if (nextValue == null && select.firstValue) {
4458
- if (dataSourceScreen) {
4459
- combobox.definingInitialValue = true;
4460
- dataSourceScreen.fetch({
4461
- params: {
4462
- $top: 1
4463
- }
4464
- }, {
4465
- success: function(data) {
4466
- if (data.length) {
4467
- dataSourceScreen.data.push(data[0]);
4468
- nextValue = data[0][select.dataValueField];
4469
- }
4470
- modelSetter(_scope, nextValue);
4471
- forceChangeModel(nextValue);
4472
- combobox.definingInitialValue = false;
4473
- },
4474
- error: function() {
4475
- combobox.definingInitialValue = false;
4476
- },
4477
- canceled: function() {
4478
- combobox.definingInitialValue = false;
4479
- }
4480
- }, undefined, {lookup : true});
4481
- }
4482
- } else {
4483
- modelSetter(_scope, nextValue);
4484
- forceChangeModel(nextValue);
4485
- combobox.definingInitialValue = false;
4486
- }
4444
+
4445
+ if (!currentValue || currentValue === "") {
4446
+ nextValue = "";
4447
+ modelSetter(scope, nextValue);
4448
+ forceEmptyLineSelected();
4487
4449
  }
4488
4450
  }
4489
- else {
4490
- setTimeout(()=>defineInitialValue(),300);
4491
- }
4492
- }
4493
-
4451
+ };
4452
+
4494
4453
  var _ngModelCtrl = ngModelCtrl;
4495
4454
  if (dataSourceScreen != null && dataSourceScreen != undefined) {
4496
4455
  dataSourceScreen.addDataSourceEvents({
@@ -4513,50 +4472,48 @@
4513
4472
  return;
4514
4473
  }
4515
4474
  _scope.$apply(function() {
4516
- modelSetter(_scope, combobox.dataItem()[select.dataValueField]);
4517
- modelTextFieldSetter(_scope, combobox.dataItem()[select.dataTextField]);
4518
- if(select.changeValueBasedOnLabel){
4519
- let comboLabelValue = combobox.dataItem()[select.dataTextField];
4520
- // Try to eval it first in pure vanilla and then if it was not possible in angular context.
4521
- try {
4522
- eval(select.changeValueBasedOnLabel + '=' + '"' + comboLabelValue + '"');
4523
- }catch (e) {
4524
- try {
4525
- _scope.$eval(select.changeValueBasedOnLabel + '=' + '"' + comboLabelValue + '"')
4526
- }catch (e) {
4527
- console.error("Não foi possível atribuir o texto do combobox ", comboLabelValue, " no compo informado ", select.changeValueBasedOnLabel);
4528
- }
4529
- }
4475
+ let selectedItem = combobox.dataItem();
4476
+
4477
+ if (!selectedItem || selectedItem[select.dataValueField] === "") {
4478
+ combobox.value("");
4479
+ modelSetter(_scope, "");
4480
+ modelTextFieldSetter(_scope, "");
4481
+ } else {
4482
+ modelSetter(_scope, selectedItem[select.dataValueField]);
4483
+ modelTextFieldSetter(_scope, selectedItem[select.dataTextField]);
4530
4484
  }
4531
-
4485
+
4532
4486
  _compileAngular(scope, options.combobox.element[0]);
4533
4487
  if (options?.combobox?.span) {
4534
4488
  _compileAngular(scope, options.combobox.span);
4535
4489
  }
4536
4490
  });
4537
-
4538
- }
4539
-
4491
+ };
4492
+
4540
4493
  applyChange();
4541
-
4542
4494
  });
4543
-
4495
+
4544
4496
  /**
4545
4497
  * Observando model do DropdownList.
4546
4498
  */
4547
4499
  if (ngModelCtrl) {
4548
4500
  ngModelCtrl.$formatters.push(function (value) {
4549
4501
  $log.debug("$formatters | " + attrs['id'] + " | " + value);
4550
- var x = combobox.value();
4551
4502
  if (value === undefined || (value === "" && select.optionLabelValue === undefined)) {
4552
- value = null;
4553
- modelSetter(_scope, value);
4503
+ value = "";
4504
+ modelSetter(scope, value);
4505
+ }
4506
+ forceChangeModel(value);
4507
+ return value;
4508
+ });
4509
+
4510
+ ngModelCtrl.$parsers.push(function (value) {
4511
+ if (!value || value === "") {
4512
+ return "";
4554
4513
  }
4555
- forceChangeModel(value);
4556
-
4557
4514
  return value;
4558
4515
  });
4559
-
4516
+
4560
4517
  ngModelCtrl.$parsers.push(function (value) {
4561
4518
  $log.debug("$parsers | " + attrs['id'] + " | " + value);
4562
4519
  if ((typeof value === 'boolean') || value) {
@@ -4591,9 +4548,11 @@
4591
4548
  select.initValue = null;
4592
4549
  }
4593
4550
 
4594
- if (select.initValue == '') {
4595
- select.initValue = null;
4551
+ if (select.initValue === null || select.initValue === "" || !select.initValue) {
4552
+ combobox.value("");
4553
+ modelSetter(_scope, "");
4596
4554
  }
4555
+
4597
4556
 
4598
4557
  if (combobox.dataSource.transport && combobox.dataSource.transport.options) {
4599
4558
  combobox.dataSource.transport.options.combobox = combobox;
@@ -4641,7 +4600,7 @@
4641
4600
  }
4642
4601
  };
4643
4602
  })
4644
-
4603
+
4645
4604
  .directive('cronMultiSelect', function ($compile, $parse) {
4646
4605
  return {
4647
4606
  restrict: 'E',
@@ -4651,6 +4610,15 @@
4651
4610
  var modelSetter = modelGetter.assign;
4652
4611
  var model = attrs['ngModel'];
4653
4612
 
4613
+ let jumpThread = () => {
4614
+ return new Promise((resolve) => {
4615
+ let jumpWait = setInterval(() => {
4616
+ clearInterval(jumpWait);
4617
+ resolve();
4618
+ });
4619
+ });
4620
+ };
4621
+
4654
4622
  var _self = this;
4655
4623
  var select = {};
4656
4624
  try {
@@ -4662,12 +4630,29 @@
4662
4630
  var _scope = scope;
4663
4631
  var _ngModelCtrl = ngModelCtrl;
4664
4632
 
4633
+ if (select.relationDataSource != null) {
4634
+ try {
4635
+ eval(select.relationDataSource.name);
4636
+ }
4637
+ catch (e) {
4638
+ await jumpThread();
4639
+ }
4640
+ }
4665
4641
  var relactionDS = {
4666
4642
  relationDataSource: (select.relationDataSource != null ? eval(select.relationDataSource.name) : null),
4667
4643
  relationField: (select.relationField != null ? select.relationField : '')
4668
4644
  }
4669
4645
 
4670
- var options = await app.kendoHelper.getConfigCombobox(select, scope);
4646
+ var options = undefined;
4647
+ try {
4648
+ eval(select.dataSourceScreen.name);
4649
+ options = await app.kendoHelper.getConfigCombobox(select, scope);
4650
+ }
4651
+ catch (e) {
4652
+ await jumpThread();
4653
+ options = await app.kendoHelper.getConfigCombobox(select, scope);
4654
+ }
4655
+
4671
4656
 
4672
4657
  try {
4673
4658
  delete options.dataSource.schema.model.id;
@@ -6008,46 +5993,79 @@
6008
5993
  }
6009
5994
  })
6010
5995
 
6011
- .directive('crnInfiniteScroll', ['$compile', function($compile){
5996
+ .directive('crnInfiniteScroll', ['$compile', function($compile) {
6012
5997
  'use strict';
6013
5998
  return {
6014
5999
  restrict: 'EA',
6015
6000
  link: function(scope, element, attrs) {
6016
- var dataSource = attrs.crnInfiniteScroll ? eval(attrs.crnInfiniteScroll) : attrs.crnDatasource ? eval(attrs.crnDatasource): undefined;
6017
- if (dataSource) {
6018
- let nextPageInfinite = {
6019
- isVisible: false,
6020
- checkVisibility: function(visible) {
6021
- if (nextPageInfinite.isVisible !== visible) {
6022
- nextPageInfinite.isVisible = visible;
6023
- if (nextPageInfinite.isVisible) {
6024
- if (dataSource.loaded && dataSource.loadedFinish) {
6025
- dataSource.nextPage();
6001
+ let infiniteScrollController = {
6002
+ isFirstTime: true,
6003
+ isRunning: false,
6004
+ datasource: undefined,
6005
+ isVisible: function() { // verifica se o fim do componente esta aparecendo
6006
+ var topElem = element.offset().top;
6007
+ var botElem = element.offset().top + element.outerHeight();
6008
+ var botScrn = $(window).scrollTop() + $(window).innerHeight();
6009
+ var topScrn = $(window).scrollTop();
6010
+ return (botScrn > topElem) && (topScrn < botElem);
6011
+ },
6012
+ loadNextPage: function() {
6013
+ if (infiniteScrollController.datasource === undefined) {
6014
+ infiniteScrollController.datasource = attrs.crnInfiniteScroll ? scope.$eval(attrs.crnInfiniteScroll) : attrs.crnDatasource ? scope.$eval(attrs.crnDatasource): undefined;
6015
+ }
6016
+ if (infiniteScrollController.datasource && infiniteScrollController.datasource.loaded && infiniteScrollController.datasource.loadedFinish) {
6017
+ infiniteScrollController.datasource.nextPage();
6018
+ return true;
6019
+ }
6020
+ return false;
6021
+ },
6022
+ setStopped: function() {
6023
+ infiniteScrollController.isRunning = false;
6024
+ if (infiniteScrollController.isFirstTime) { // Foi executado pelo load, agora inclui evento do scroll
6025
+ infiniteScrollController.isFirstTime = false;
6026
+ $(window).scroll(infiniteScrollController.executeInfinityScroll);
6027
+ }
6028
+ },
6029
+ executeInfinityScroll: function() {
6030
+ if (!infiniteScrollController.isRunning) { // semaforo para evitar execuções simultaneas causada pelo scrolling
6031
+ infiniteScrollController.isRunning = true;
6032
+ let retries = 0;
6033
+ let intervalNextPage = setInterval(function() {
6034
+ if (infiniteScrollController.isVisible()) {
6035
+ // Fim do area esta visivel, carregar pagina.
6036
+ if (!infiniteScrollController.loadNextPage()) {
6037
+ // Não conseguiu carregar a pagina
6038
+ if (retries < 5 && infiniteScrollController.isVisible()) {
6039
+ // tenta de novo enquanto o componente esta visivel (maximo 5 vezes)
6040
+ retries = retries + 1;
6041
+ } else {
6042
+ // para de verificar, ultrapasou 5 tentativas ou o componente não esta mais visivel
6043
+ infiniteScrollController.setStopped();
6044
+ clearInterval(intervalNextPage);
6045
+ }
6046
+ } else if (!infiniteScrollController.isVisible()) {
6047
+ // Carregou pagina
6048
+ // para de verificar pois o componente não esta mais visivel
6049
+ infiniteScrollController.setStopped();
6050
+ clearInterval(intervalNextPage);
6026
6051
  } else {
6027
- let intervalNextPage = setInterval(function() {
6028
- if (dataSource.loaded && dataSource.loadedFinish) {
6029
- dataSource.nextPage();
6030
- clearInterval(intervalNextPage);
6031
- }
6032
- }, 250);
6052
+ // Carregou pagina
6053
+ // zera tentativas pois o componente esta visivel e a pagina foi carregada,
6054
+ // tentará nova pagina (ocorre se o numero de registros carregados for menor que o tamanho da tela
6055
+ retries = 0;
6033
6056
  }
6057
+ } else {
6058
+ // Fim do area nao esta visivel, para de verificar.
6059
+ infiniteScrollController.setStopped();
6034
6060
  }
6035
- }
6036
- },
6037
- eventScroll: function() {
6038
- var topElem = element.offset().top;
6039
- var botElem = element.offset().top + element.outerHeight();
6040
- var botScrn = $(window).scrollTop() + $(window).innerHeight();
6041
- var topScrn = $(window).scrollTop();
6042
- nextPageInfinite.checkVisibility((botScrn > topElem) && (topScrn < botElem));
6061
+ }, 250);
6043
6062
  }
6044
- };
6045
- $(window).scroll(nextPageInfinite.eventScroll);
6046
- $(window).ready(nextPageInfinite.eventScroll);
6047
- }
6063
+ }
6064
+ };
6065
+ $(window).ready(infiniteScrollController.executeInfinityScroll);
6048
6066
  }
6049
- }
6050
- }])
6067
+ };
6068
+ }]);
6051
6069
 
6052
6070
  }(app));
6053
6071
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "3.1.0",
3
+ "version": "3.2.0-SP.1",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {