cronapp-framework-js 3.1.0 → 3.2.0-SP.10
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/css/app.css +6 -1
- package/css/themes/custom/dsgov/calendar-dsgov.css +28 -0
- package/css/themes/custom/krypton/custom-krypton.css +51 -29
- package/css/themes/custom/krypton/navbar-krypton.css +20 -3
- package/css/themes/custom/nature/custom-nature.css +109 -28
- package/css/themes/custom/nature/grid-nature.css +8 -4
- package/dist/css/app.css +1 -1
- package/dist/css/themes/custom/dsgov/calendar-dsgov.css +1 -1
- package/dist/css/themes/custom/krypton/custom-krypton.css +1 -1
- package/dist/css/themes/custom/krypton/navbar-krypton.css +1 -1
- package/dist/css/themes/custom/nature/custom-nature.css +1 -1
- package/dist/css/themes/custom/nature/grid-nature.css +1 -1
- package/dist/js/controllers.js +1 -1
- package/dist/js/directives.js +12 -12
- package/js/controllers.js +5 -7
- package/js/directives.js +235 -213
- package/package.json +1 -1
package/js/controllers.js
CHANGED
|
@@ -50,17 +50,15 @@ if (!window.hostApp) {
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
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:
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
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,50 @@
|
|
|
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
|
-
|
|
4333
|
-
options.
|
|
4334
|
-
|
|
4335
|
-
|
|
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
|
+
options.filtering = attrs.ngFiltering ? function () {
|
|
4283
|
+
scope.$eval(attrs.ngFiltering);
|
|
4284
|
+
} : undefined;
|
|
4285
|
+
|
|
4286
|
+
options.open = function (e) {
|
|
4287
|
+
if (!combobox._originalClose) {
|
|
4288
|
+
combobox._originalClose = combobox.close;
|
|
4289
|
+
}
|
|
4290
|
+
combobox.close = () => {};
|
|
4291
|
+
setTimeout(() => {
|
|
4292
|
+
combobox.close = combobox._originalClose;
|
|
4293
|
+
}, 500);
|
|
4294
|
+
|
|
4336
4295
|
if (!dataSourceScreen.fetched || (dataSourceScreen.lastLoadedTime !== combobox.dataSource.lastLoadedTime)) {
|
|
4337
4296
|
combobox.options.firstLazyRead = true;
|
|
4338
4297
|
combobox.dataSource.read();
|
|
4339
4298
|
combobox.dataSource.lastLoadedTime = dataSourceScreen.lastLoadedTime;
|
|
4340
4299
|
}
|
|
4300
|
+
|
|
4301
|
+
let emptyOption = { [combobox.options.dataValueField]: "", [combobox.options.dataTextField]: "" };
|
|
4302
|
+
if (!combobox.dataSource.data().some(item => item[combobox.options.dataValueField] === "")) {
|
|
4303
|
+
combobox.dataSource.add(emptyOption);
|
|
4304
|
+
}
|
|
4305
|
+
forceEmptyLineSelected();
|
|
4341
4306
|
};
|
|
4342
|
-
|
|
4307
|
+
|
|
4343
4308
|
options.select = attrs.ngSelect ? function (e) {
|
|
4344
4309
|
scope.safeApply(() => {
|
|
4345
4310
|
var contextVars = {
|
|
@@ -4370,6 +4335,51 @@
|
|
|
4370
4335
|
dataSourceScreen.__ignoreFirstFetch = true;
|
|
4371
4336
|
}
|
|
4372
4337
|
var combobox = $element.kendoDropDownList(options).data('kendoDropDownList');
|
|
4338
|
+
combobox.isEvaluating = false;
|
|
4339
|
+
|
|
4340
|
+
function forceEmptyLineSelected() {
|
|
4341
|
+
var optionLabel = combobox.list.find('.k-list-optionlabel');
|
|
4342
|
+
|
|
4343
|
+
if (optionLabel && optionLabel.length) {
|
|
4344
|
+
optionLabel.addClass("k-state-selected k-state-focused");
|
|
4345
|
+
}
|
|
4346
|
+
$log.debug("Linha vazia marcada como ativa:", optionLabel);
|
|
4347
|
+
}
|
|
4348
|
+
|
|
4349
|
+
var scrolling = false;
|
|
4350
|
+
|
|
4351
|
+
combobox.bind("open", function () {
|
|
4352
|
+
if (scrolling) return;
|
|
4353
|
+
scrolling = true;
|
|
4354
|
+
|
|
4355
|
+
setTimeout(() => {
|
|
4356
|
+
scrolling = false;
|
|
4357
|
+
}, 300);
|
|
4358
|
+
|
|
4359
|
+
forceEmptyLineSelected();
|
|
4360
|
+
});
|
|
4361
|
+
|
|
4362
|
+
combobox.bind("change", function () {
|
|
4363
|
+
if (combobox.isEvaluating) return;
|
|
4364
|
+
combobox.isEvaluating = true;
|
|
4365
|
+
|
|
4366
|
+
try {
|
|
4367
|
+
let selectedItem = combobox.dataItem();
|
|
4368
|
+
|
|
4369
|
+
if (selectedItem && selectedItem[options.dataValueField] === "") {
|
|
4370
|
+
modelSetter(scope, "");
|
|
4371
|
+
modelTextFieldSetter(scope, "");
|
|
4372
|
+
} else {
|
|
4373
|
+
modelSetter(scope, selectedItem[options.dataValueField]);
|
|
4374
|
+
modelTextFieldSetter(scope, selectedItem[options.dataTextField]);
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4377
|
+
forceEmptyLineSelected();
|
|
4378
|
+
} finally {
|
|
4379
|
+
combobox.isEvaluating = false;
|
|
4380
|
+
}
|
|
4381
|
+
});
|
|
4382
|
+
|
|
4373
4383
|
options.combobox = combobox;
|
|
4374
4384
|
$(combobox.element[0]).attr('tabindex','-1');
|
|
4375
4385
|
if (dataSourceScreen != null && dataSourceScreen != undefined) {
|
|
@@ -4434,63 +4444,22 @@
|
|
|
4434
4444
|
/**
|
|
4435
4445
|
* Observa o read do datasource para setar o primeiro valor ou valor inicial.
|
|
4436
4446
|
*/
|
|
4437
|
-
var defineInitialValue = function() {
|
|
4447
|
+
var defineInitialValue = function () {
|
|
4438
4448
|
if (combobox.definingInitialValue) {
|
|
4439
4449
|
return;
|
|
4440
4450
|
}
|
|
4441
4451
|
if (!combobox.isEvaluating) {
|
|
4442
|
-
var currentValue =
|
|
4452
|
+
var currentValue = combobox.value();
|
|
4443
4453
|
var nextValue = null;
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
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
|
-
}
|
|
4454
|
+
|
|
4455
|
+
if (!currentValue || currentValue === "") {
|
|
4456
|
+
nextValue = "";
|
|
4457
|
+
modelSetter(scope, nextValue);
|
|
4458
|
+
forceEmptyLineSelected();
|
|
4487
4459
|
}
|
|
4488
4460
|
}
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
}
|
|
4492
|
-
}
|
|
4493
|
-
|
|
4461
|
+
};
|
|
4462
|
+
|
|
4494
4463
|
var _ngModelCtrl = ngModelCtrl;
|
|
4495
4464
|
if (dataSourceScreen != null && dataSourceScreen != undefined) {
|
|
4496
4465
|
dataSourceScreen.addDataSourceEvents({
|
|
@@ -4513,50 +4482,48 @@
|
|
|
4513
4482
|
return;
|
|
4514
4483
|
}
|
|
4515
4484
|
_scope.$apply(function() {
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
if(select.
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
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
|
-
}
|
|
4485
|
+
let selectedItem = combobox.dataItem();
|
|
4486
|
+
|
|
4487
|
+
if (!selectedItem || selectedItem[select.dataValueField] === "") {
|
|
4488
|
+
combobox.value("");
|
|
4489
|
+
modelSetter(_scope, "");
|
|
4490
|
+
modelTextFieldSetter(_scope, "");
|
|
4491
|
+
} else {
|
|
4492
|
+
modelSetter(_scope, selectedItem[select.dataValueField]);
|
|
4493
|
+
modelTextFieldSetter(_scope, selectedItem[select.dataTextField]);
|
|
4530
4494
|
}
|
|
4531
|
-
|
|
4495
|
+
|
|
4532
4496
|
_compileAngular(scope, options.combobox.element[0]);
|
|
4533
4497
|
if (options?.combobox?.span) {
|
|
4534
4498
|
_compileAngular(scope, options.combobox.span);
|
|
4535
4499
|
}
|
|
4536
4500
|
});
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4501
|
+
};
|
|
4502
|
+
|
|
4540
4503
|
applyChange();
|
|
4541
|
-
|
|
4542
4504
|
});
|
|
4543
|
-
|
|
4505
|
+
|
|
4544
4506
|
/**
|
|
4545
4507
|
* Observando model do DropdownList.
|
|
4546
4508
|
*/
|
|
4547
4509
|
if (ngModelCtrl) {
|
|
4548
4510
|
ngModelCtrl.$formatters.push(function (value) {
|
|
4549
4511
|
$log.debug("$formatters | " + attrs['id'] + " | " + value);
|
|
4550
|
-
var x = combobox.value();
|
|
4551
4512
|
if (value === undefined || (value === "" && select.optionLabelValue === undefined)) {
|
|
4552
|
-
value =
|
|
4553
|
-
modelSetter(
|
|
4513
|
+
value = "";
|
|
4514
|
+
modelSetter(scope, value);
|
|
4515
|
+
}
|
|
4516
|
+
forceChangeModel(value);
|
|
4517
|
+
return value;
|
|
4518
|
+
});
|
|
4519
|
+
|
|
4520
|
+
ngModelCtrl.$parsers.push(function (value) {
|
|
4521
|
+
if (!value || value === "") {
|
|
4522
|
+
return "";
|
|
4554
4523
|
}
|
|
4555
|
-
forceChangeModel(value);
|
|
4556
|
-
|
|
4557
4524
|
return value;
|
|
4558
4525
|
});
|
|
4559
|
-
|
|
4526
|
+
|
|
4560
4527
|
ngModelCtrl.$parsers.push(function (value) {
|
|
4561
4528
|
$log.debug("$parsers | " + attrs['id'] + " | " + value);
|
|
4562
4529
|
if ((typeof value === 'boolean') || value) {
|
|
@@ -4591,10 +4558,6 @@
|
|
|
4591
4558
|
select.initValue = null;
|
|
4592
4559
|
}
|
|
4593
4560
|
|
|
4594
|
-
if (select.initValue == '') {
|
|
4595
|
-
select.initValue = null;
|
|
4596
|
-
}
|
|
4597
|
-
|
|
4598
4561
|
if (combobox.dataSource.transport && combobox.dataSource.transport.options) {
|
|
4599
4562
|
combobox.dataSource.transport.options.combobox = combobox;
|
|
4600
4563
|
combobox.dataSource.transport.options.$compile = $compile;
|
|
@@ -4641,7 +4604,7 @@
|
|
|
4641
4604
|
}
|
|
4642
4605
|
};
|
|
4643
4606
|
})
|
|
4644
|
-
|
|
4607
|
+
|
|
4645
4608
|
.directive('cronMultiSelect', function ($compile, $parse) {
|
|
4646
4609
|
return {
|
|
4647
4610
|
restrict: 'E',
|
|
@@ -4651,6 +4614,15 @@
|
|
|
4651
4614
|
var modelSetter = modelGetter.assign;
|
|
4652
4615
|
var model = attrs['ngModel'];
|
|
4653
4616
|
|
|
4617
|
+
let jumpThread = () => {
|
|
4618
|
+
return new Promise((resolve) => {
|
|
4619
|
+
let jumpWait = setInterval(() => {
|
|
4620
|
+
clearInterval(jumpWait);
|
|
4621
|
+
resolve();
|
|
4622
|
+
});
|
|
4623
|
+
});
|
|
4624
|
+
};
|
|
4625
|
+
|
|
4654
4626
|
var _self = this;
|
|
4655
4627
|
var select = {};
|
|
4656
4628
|
try {
|
|
@@ -4662,12 +4634,29 @@
|
|
|
4662
4634
|
var _scope = scope;
|
|
4663
4635
|
var _ngModelCtrl = ngModelCtrl;
|
|
4664
4636
|
|
|
4637
|
+
if (select.relationDataSource != null) {
|
|
4638
|
+
try {
|
|
4639
|
+
eval(select.relationDataSource.name);
|
|
4640
|
+
}
|
|
4641
|
+
catch (e) {
|
|
4642
|
+
await jumpThread();
|
|
4643
|
+
}
|
|
4644
|
+
}
|
|
4665
4645
|
var relactionDS = {
|
|
4666
4646
|
relationDataSource: (select.relationDataSource != null ? eval(select.relationDataSource.name) : null),
|
|
4667
4647
|
relationField: (select.relationField != null ? select.relationField : '')
|
|
4668
4648
|
}
|
|
4669
4649
|
|
|
4670
|
-
var options =
|
|
4650
|
+
var options = undefined;
|
|
4651
|
+
try {
|
|
4652
|
+
eval(select.dataSourceScreen.name);
|
|
4653
|
+
options = await app.kendoHelper.getConfigCombobox(select, scope);
|
|
4654
|
+
}
|
|
4655
|
+
catch (e) {
|
|
4656
|
+
await jumpThread();
|
|
4657
|
+
options = await app.kendoHelper.getConfigCombobox(select, scope);
|
|
4658
|
+
}
|
|
4659
|
+
|
|
4671
4660
|
|
|
4672
4661
|
try {
|
|
4673
4662
|
delete options.dataSource.schema.model.id;
|
|
@@ -6008,46 +5997,79 @@
|
|
|
6008
5997
|
}
|
|
6009
5998
|
})
|
|
6010
5999
|
|
|
6011
|
-
.directive('crnInfiniteScroll', ['$compile', function($compile){
|
|
6000
|
+
.directive('crnInfiniteScroll', ['$compile', function($compile) {
|
|
6012
6001
|
'use strict';
|
|
6013
6002
|
return {
|
|
6014
6003
|
restrict: 'EA',
|
|
6015
6004
|
link: function(scope, element, attrs) {
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6005
|
+
let infiniteScrollController = {
|
|
6006
|
+
isFirstTime: true,
|
|
6007
|
+
isRunning: false,
|
|
6008
|
+
datasource: undefined,
|
|
6009
|
+
isVisible: function() { // verifica se o fim do componente esta aparecendo
|
|
6010
|
+
var topElem = element.offset().top;
|
|
6011
|
+
var botElem = element.offset().top + element.outerHeight();
|
|
6012
|
+
var botScrn = $(window).scrollTop() + $(window).innerHeight();
|
|
6013
|
+
var topScrn = $(window).scrollTop();
|
|
6014
|
+
return (botScrn > topElem) && (topScrn < botElem);
|
|
6015
|
+
},
|
|
6016
|
+
loadNextPage: function() {
|
|
6017
|
+
if (infiniteScrollController.datasource === undefined) {
|
|
6018
|
+
infiniteScrollController.datasource = attrs.crnInfiniteScroll ? scope.$eval(attrs.crnInfiniteScroll) : attrs.crnDatasource ? scope.$eval(attrs.crnDatasource): undefined;
|
|
6019
|
+
}
|
|
6020
|
+
if (infiniteScrollController.datasource && infiniteScrollController.datasource.loaded && infiniteScrollController.datasource.loadedFinish) {
|
|
6021
|
+
infiniteScrollController.datasource.nextPage();
|
|
6022
|
+
return true;
|
|
6023
|
+
}
|
|
6024
|
+
return false;
|
|
6025
|
+
},
|
|
6026
|
+
setStopped: function() {
|
|
6027
|
+
infiniteScrollController.isRunning = false;
|
|
6028
|
+
if (infiniteScrollController.isFirstTime) { // Foi executado pelo load, agora inclui evento do scroll
|
|
6029
|
+
infiniteScrollController.isFirstTime = false;
|
|
6030
|
+
$(window).scroll(infiniteScrollController.executeInfinityScroll);
|
|
6031
|
+
}
|
|
6032
|
+
},
|
|
6033
|
+
executeInfinityScroll: function() {
|
|
6034
|
+
if (!infiniteScrollController.isRunning) { // semaforo para evitar execuções simultaneas causada pelo scrolling
|
|
6035
|
+
infiniteScrollController.isRunning = true;
|
|
6036
|
+
let retries = 0;
|
|
6037
|
+
let intervalNextPage = setInterval(function() {
|
|
6038
|
+
if (infiniteScrollController.isVisible()) {
|
|
6039
|
+
// Fim do area esta visivel, carregar pagina.
|
|
6040
|
+
if (!infiniteScrollController.loadNextPage()) {
|
|
6041
|
+
// Não conseguiu carregar a pagina
|
|
6042
|
+
if (retries < 5 && infiniteScrollController.isVisible()) {
|
|
6043
|
+
// tenta de novo enquanto o componente esta visivel (maximo 5 vezes)
|
|
6044
|
+
retries = retries + 1;
|
|
6045
|
+
} else {
|
|
6046
|
+
// para de verificar, ultrapasou 5 tentativas ou o componente não esta mais visivel
|
|
6047
|
+
infiniteScrollController.setStopped();
|
|
6048
|
+
clearInterval(intervalNextPage);
|
|
6049
|
+
}
|
|
6050
|
+
} else if (!infiniteScrollController.isVisible()) {
|
|
6051
|
+
// Carregou pagina
|
|
6052
|
+
// para de verificar pois o componente não esta mais visivel
|
|
6053
|
+
infiniteScrollController.setStopped();
|
|
6054
|
+
clearInterval(intervalNextPage);
|
|
6026
6055
|
} else {
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
}
|
|
6032
|
-
}, 250);
|
|
6056
|
+
// Carregou pagina
|
|
6057
|
+
// zera tentativas pois o componente esta visivel e a pagina foi carregada,
|
|
6058
|
+
// tentará nova pagina (ocorre se o numero de registros carregados for menor que o tamanho da tela
|
|
6059
|
+
retries = 0;
|
|
6033
6060
|
}
|
|
6061
|
+
} else {
|
|
6062
|
+
// Fim do area nao esta visivel, para de verificar.
|
|
6063
|
+
infiniteScrollController.setStopped();
|
|
6034
6064
|
}
|
|
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));
|
|
6065
|
+
}, 250);
|
|
6043
6066
|
}
|
|
6044
|
-
}
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
}
|
|
6067
|
+
}
|
|
6068
|
+
};
|
|
6069
|
+
$(window).ready(infiniteScrollController.executeInfinityScroll);
|
|
6048
6070
|
}
|
|
6049
|
-
}
|
|
6050
|
-
}])
|
|
6071
|
+
};
|
|
6072
|
+
}]);
|
|
6051
6073
|
|
|
6052
6074
|
}(app));
|
|
6053
6075
|
|