cronapp-framework-js 2.9.6-SP.4 → 2.9.6-SP.41

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 (48) hide show
  1. package/components/crn-calendar.components.json +1 -0
  2. package/components/crn-dynamic-image.components.json +8 -0
  3. package/components/crn-enterprise-combobox-multiple.components.json +7 -0
  4. package/components/crn-navbar.components.json +2 -21
  5. package/components/templates/navbar.template.html +8 -7
  6. package/css/app.css +4 -0
  7. package/css/themes/custom/krypton/custom-krypton.css +738 -221
  8. package/css/themes/custom/krypton/grid-krypton.css +185 -52
  9. package/css/themes/custom/krypton/navbar-krypton.css +13 -10
  10. package/css/themes/custom/krypton/panel-krypton.css +16 -12
  11. package/css/themes/custom/material/navbar-material.css +2 -0
  12. package/css/themes/custom/material-round/custom-material-round.css +1059 -47
  13. package/css/themes/custom/material-round/grid-material-round.css +301 -9
  14. package/css/themes/custom/material-round/navbar-material-round.css +15 -5
  15. package/css/themes/custom/material-round/panel-material-round.css +4 -4
  16. package/css/themes/custom/navigator/custom-navigator.css +47 -20
  17. package/css/themes/custom/theme-general/menu-vertical-retratil.css +30 -21
  18. package/css/themes/custom/theme-general/theme-general.css +1 -1
  19. package/dist/components/templates/navbar.template.html +1 -1
  20. package/dist/css/app.css +1 -1
  21. package/dist/css/themes/custom/krypton/custom-krypton.css +1 -1
  22. package/dist/css/themes/custom/krypton/grid-krypton.css +1 -1
  23. package/dist/css/themes/custom/krypton/navbar-krypton.css +1 -1
  24. package/dist/css/themes/custom/krypton/panel-krypton.css +1 -1
  25. package/dist/css/themes/custom/material/navbar-material.css +1 -1
  26. package/dist/css/themes/custom/material-round/custom-material-round.css +1 -1
  27. package/dist/css/themes/custom/material-round/grid-material-round.css +1 -1
  28. package/dist/css/themes/custom/material-round/navbar-material-round.css +1 -1
  29. package/dist/css/themes/custom/material-round/panel-material-round.css +1 -1
  30. package/dist/css/themes/custom/navigator/custom-navigator.css +1 -1
  31. package/dist/css/themes/custom/theme-general/menu-vertical-retratil.css +1 -1
  32. package/dist/css/themes/custom/theme-general/theme-general.css +1 -1
  33. package/dist/i18n/locale_en_us.json +3 -1
  34. package/dist/i18n/locale_pt_br.json +3 -1
  35. package/dist/js/app.js +1 -1
  36. package/dist/js/controllers.js +1 -1
  37. package/dist/js/directives.js +10 -10
  38. package/dist/js/reports/reports.service.js +1 -1
  39. package/dist/js/upload.service.js +1 -1
  40. package/i18n/locale_en_us.json +3 -1
  41. package/i18n/locale_pt_br.json +3 -1
  42. package/js/app.js +10 -5
  43. package/js/controllers.js +42 -20
  44. package/js/directives.js +146 -170
  45. package/js/reports/reports.service.js +5 -5
  46. package/js/upload.service.js +7 -4
  47. package/package.json +9 -4
  48. package/postupdate.json +8 -0
package/js/directives.js CHANGED
@@ -102,11 +102,11 @@
102
102
  const expressionOnChange = options.expressionOnChange;
103
103
  const expressionOnNavigate = options.expressionOnNavigate;
104
104
 
105
- const initialDate = expressionInitialDate ? await scope.$eval(generateBlocklyCall(expressionInitialDate)) : new Date();
106
- const selectDates = (expressionSelectDates && options.isSelectableMultiple) ? await scope.$eval(generateBlocklyCall(expressionSelectDates)) : [];
107
- const disableDates = expressionDisableDates ? await scope.$eval(generateBlocklyCall(expressionDisableDates)) : null;
108
- const min = expressionMinDate ? await scope.$eval(generateBlocklyCall(expressionMinDate)) : new Date(1900, 0, 1);
109
- const max = expressionMaxDate ? await scope.$eval(generateBlocklyCall(expressionMaxDate)) : new Date(2099, 11, 31);
105
+ const initialDate = expressionInitialDate ? await scope.$eval(generateBlocklyCall(expressionInitialDate, true)) : new Date();
106
+ const selectDates = (expressionSelectDates && options.isSelectableMultiple) ? await scope.$eval(generateBlocklyCall(expressionSelectDates, true)) : [];
107
+ const disableDates = expressionDisableDates ? await scope.$eval(generateBlocklyCall(expressionDisableDates, true)) : null;
108
+ const min = expressionMinDate ? await scope.$eval(generateBlocklyCall(expressionMinDate, true)) : new Date(1900, 0, 1);
109
+ const max = expressionMaxDate ? await scope.$eval(generateBlocklyCall(expressionMaxDate), true) : new Date(2099, 11, 31);
110
110
 
111
111
  cronCalendarElement.kendoCalendar({
112
112
  culture: culture.startsWith('pt') ? 'pt-BR' : 'en-US',
@@ -221,7 +221,7 @@
221
221
 
222
222
  app.directive('textarea', transformText);
223
223
 
224
- var generateBlocklyCall = function(blocklyInfo) {
224
+ var generateBlocklyCall = function(blocklyInfo, hasToPromise) {
225
225
  var call = "";
226
226
  if (!blocklyInfo) return call;
227
227
 
@@ -238,7 +238,7 @@
238
238
  }
239
239
  else if (blocklyInfo.type == "server") {
240
240
  var blocklyName = blocklyInfo.blocklyClass + '.' + blocklyInfo.blocklyMethod;
241
- call = "cronapi.server('"+blocklyName+"')";
241
+ call = "cronapi.server('"+blocklyName+"')" + (hasToPromise ? '.toPromise()' : '');
242
242
 
243
243
  var params = "";
244
244
  blocklyInfo.blocklyParams.forEach(function(p) {
@@ -355,7 +355,7 @@
355
355
  var required = (attr.ngRequired && attr.ngRequired == "true"?"required":"");
356
356
  var content = element.html();
357
357
  const objectFit = attr.objectFit || 'unset';
358
- let templateDyn =`<div ngf-drop="" ngf-drag-over-class="dragover" style="display: flex; justify-content: center; width: 100%; height: 100%; ">
358
+ let templateDyn =`<div ngf-drop="" ngf-drag-over-class="dragover" style="display: flex; justify-content: center; width: 100%; height: 100%; position: relative; ">
359
359
  <img alt="$picture$" style="width: 100%; object-fit: ${objectFit}" ng-if="$ngModel$"
360
360
  data-ng-src="{{$ngModel$.startsWith(\'http\') || ($ngModel$.startsWith(\'/\') && $ngModel$.length < 1000)? $ngModel$ : \'data:image/png;base64,\' + $ngModel$}}">
361
361
  <input id="$id$" aria-label="$userHtml$" ng-if="!$ngModel$" autocomplete="off" tabindex="-1"
@@ -394,6 +394,12 @@
394
394
  .split('$picture$').join($translate.instant(imgAltText))
395
395
  );
396
396
 
397
+ var readOnly = attr.readOnly == 'true';
398
+ if (readOnly) {
399
+ templateDyn.find('.remove-image-button').remove();
400
+ templateDyn.find('.start-camera-button-attribute').remove();
401
+ }
402
+
397
403
  element.html(templateDyn);
398
404
  $compile(templateDyn)(element.scope());
399
405
  }
@@ -650,7 +656,12 @@
650
656
  $element.hide();
651
657
  }
652
658
  if (!enabled) {
653
- $element.find('*').addBack().attr('disabled', true).off('click').on('click', e => e.preventDefault());
659
+ $element.find('*')
660
+ .addBack()
661
+ .css('pointer-events', 'none')
662
+ .attr('disabled', true)
663
+ .off('click')
664
+ .on('click', e => e.preventDefault());
654
665
  }
655
666
  if (!render) {
656
667
  $element.remove();
@@ -1288,7 +1299,7 @@
1288
1299
  var tinyMCEOptions = {
1289
1300
  menubar: false,
1290
1301
  statusbar: false,
1291
- plugins: "bdesk_photo advlist anchor autolink autoresize autosave charmap code colorpicker contextmenu directionality emoticons fullpage fullscreen hr image imagetools importcss insertdatetime legacyoutput link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace tabfocus table template toc visualblocks visualchars wordcount tiny_mce_wiris",
1302
+ plugins: "bdesk_photo advlist anchor autolink autoresize autosave charmap code colorpicker contextmenu directionality emoticons fullpage fullscreen hr image imagetools importcss insertdatetime legacyoutput link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace tabfocus table template toc visualblocks visualchars wordcount tiny_mce_wiris colorpicker textcolor",
1292
1303
  toolbar: "",
1293
1304
  content_style: ""
1294
1305
  };
@@ -1299,6 +1310,8 @@
1299
1310
  tinyMCEOptions.toolbar += " " + toolbarGroup[key];
1300
1311
  }
1301
1312
  }
1313
+
1314
+ tinyMCEOptions.toolbar += " forecolor backcolor ";
1302
1315
  tinyMCEOptions.menubar = optionsSelected.showMenuBar;
1303
1316
  tinyMCEOptions.statusbar = optionsSelected.showStatusBar;
1304
1317
  tinyMCEOptions.content_style = optionsSelected.contentStyle;
@@ -1550,8 +1563,8 @@
1550
1563
  return datasource.active;
1551
1564
  }
1552
1565
  },
1553
- getSchedulerProperties: function(options, datasource, scope) {
1554
- let schedulerStartDate = (options.initialDateStrategy === 'Expression' ? scope.$eval(generateBlocklyCall(options.initialDateBlocklyInfo)) : options.initialDate);
1566
+ getSchedulerProperties: async function(options, datasource, scope) {
1567
+ let schedulerStartDate = (options.initialDateStrategy === 'Expression' ? await scope.$eval(generateBlocklyCall(options.initialDateBlocklyInfo, true)) : options.initialDate);
1555
1568
  let lastSearchedPeriod = {start: null, end: null};
1556
1569
 
1557
1570
  let needsToFetchData = function(searchablePeriod) {
@@ -1988,11 +2001,11 @@
1988
2001
 
1989
2002
  this.initCulture();
1990
2003
 
1991
- $.getScript(baseUrl, function() {
2004
+ $.getScript(baseUrl, async function() {
1992
2005
 
1993
2006
  let kendoDatasource = app.kendoHelper.getDataSource(options.dataSourceScreen.entityDataSource, scope, true, options.dataSourceScreen.rowsPerPage);
1994
2007
 
1995
- let schedulerProperties = this.getSchedulerProperties(options, datasource, scope);
2008
+ let schedulerProperties = await this.getSchedulerProperties(options, datasource, scope);
1996
2009
 
1997
2010
  schedulerElement.kendoScheduler(schedulerProperties);
1998
2011
 
@@ -2976,7 +2989,11 @@
2976
2989
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
2977
2990
  if (!(cronappDatasource.inserting || cronappDatasource.editing)) {
2978
2991
  if (this.selectable) {
2992
+ setToActiveInCronappDataSource.bind(this)(e.data);
2979
2993
  this.select(e.masterRow);
2994
+ if (options.columns.find(c => c.dataType == 'Selectable') !== undefined) {
2995
+ collapseAllExcecptCurrent(this, e.detailRow, e.masterRow);
2996
+ }
2980
2997
  }
2981
2998
  else {
2982
2999
  setToActiveInCronappDataSource.bind(this)(e.data);
@@ -3204,14 +3221,19 @@
3204
3221
  },
3205
3222
  change: function(e) {
3206
3223
  var item = this.dataItem(this.select());
3207
- setToActiveInCronappDataSource.bind(this)(item);
3208
3224
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
3209
3225
  if(options.fieldType && options.fieldType === 'key'){
3210
3226
  cronappDatasource.active = helperDirective.changeObjectField(cronappDatasource, cronappDatasource.active);
3211
3227
  }
3228
+
3229
+ let trDetails = this.select().next();
3230
+ let trMasters = this.select();
3231
+
3212
3232
  if (ngModelCtrl) {
3213
3233
  if ("multiple" === options.allowSelectionRowType) {
3214
3234
  let selecteds = [];
3235
+ trDetails = [];
3236
+ trMasters = [];
3215
3237
  this.select().each((i, row)=> {
3216
3238
  let item = this.dataItem(row);
3217
3239
  let objInDs = cronappDatasource.findObjInDs(item, false);
@@ -3221,6 +3243,10 @@
3221
3243
  if (objInDs !== null){
3222
3244
  selecteds.push(objInDs);
3223
3245
  }
3246
+ if (item["_objectKey"] === cronappDatasource.active["_objectKey"]) {
3247
+ trMasters.push(this.select()[i]);
3248
+ trDetails.push(this.select().next()[i]);
3249
+ }
3224
3250
  });
3225
3251
  ngModelCtrl.$setViewValue(selecteds);
3226
3252
  }
@@ -3233,7 +3259,7 @@
3233
3259
  }
3234
3260
  }
3235
3261
  }
3236
- collapseAllExcecptCurrent(this, this.select().next(), this.select());
3262
+ collapseAllExcecptCurrent(this, trDetails, trMasters);
3237
3263
 
3238
3264
  if (attrs && attrs.ngChange) {
3239
3265
  scope.$eval(attrs.ngChange);
@@ -3256,8 +3282,8 @@
3256
3282
  command = 'edit';
3257
3283
  }
3258
3284
 
3259
- let modelName = helperDirective.getModelName(attrs);
3260
- if (item && item["_objectKey"]) {
3285
+ let modelName = helperDirective.getModelName(attrs);
3286
+ if (item && item["_objectKey"]) {
3261
3287
  let key = item["_objectKey"];
3262
3288
  let id = `${modelName}-${command}-${key}`;
3263
3289
  $elem.attr('id', id);
@@ -3470,6 +3496,10 @@
3470
3496
  }
3471
3497
 
3472
3498
  $element = $(element);
3499
+ let $grid = $element.find('[data-role="grid"]');
3500
+ if ($grid.length) {
3501
+ $element = $grid;
3502
+ }
3473
3503
  let style = $element.attr("style")||"";
3474
3504
  if (style) {
3475
3505
  style += ", ";
@@ -3514,8 +3544,8 @@
3514
3544
  getAllParent(cronappDatasource, itemResult.d.results[0], ids, resolve, reject);
3515
3545
  },
3516
3546
  beforeSend: (xhr) => {
3517
- if (window.uToken) {
3518
- xhr.setRequestHeader ("X-AUTH-TOKEN", window.uToken);
3547
+ if (!window.isUsingCookie()) {
3548
+ xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
3519
3549
  }
3520
3550
  },
3521
3551
  error: () => reject(),
@@ -3656,8 +3686,8 @@
3656
3686
  resolve();
3657
3687
  },
3658
3688
  beforeSend: (xhr) => {
3659
- if (window.uToken) {
3660
- xhr.setRequestHeader ("X-AUTH-TOKEN", window.uToken);
3689
+ if (!window.isUsingCookie()) {
3690
+ xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
3661
3691
  }
3662
3692
  },
3663
3693
  error: () => reject(),
@@ -4216,7 +4246,13 @@
4216
4246
  value = null;
4217
4247
  }
4218
4248
 
4219
- await combobox.value(value);
4249
+ let comboValue = combobox.value();
4250
+ comboValue = comboValue !== undefined && comboValue !== null ? comboValue.trim() : comboValue;
4251
+ let valueToCheck = value !== undefined && value !== null ? ('' + value).trim() : value;
4252
+
4253
+ if (valueToCheck !== comboValue) {
4254
+ await combobox.value(value);
4255
+ }
4220
4256
 
4221
4257
  if (select.changeCursor) {
4222
4258
  scope.safeApply(() => {
@@ -4580,11 +4616,21 @@
4580
4616
 
4581
4617
  }.bind(relactionDS);
4582
4618
 
4619
+ var hideSelectedItem = attrs.crnHideSelectedItem == 'true';
4620
+ var onSelectedItem = () => {
4621
+ if (hideSelectedItem) {
4622
+ if (combobox.list && combobox.list.length > 0) {
4623
+ combobox.list.find('.k-item').show();
4624
+ combobox.list.find('.k-item.k-state-selected').hide();
4625
+ }
4626
+ }
4627
+ }
4628
+
4583
4629
  options['change'] = attrs.ngChange ? function (){_scope.$eval(attrs.ngChange)}: undefined;
4584
4630
  options['close'] = attrs.ngClose ? function (){_scope.$eval(attrs.ngClose)}: undefined;
4585
4631
  options['dataBound'] = attrs.ngDatabound ? function (){_scope.$eval(attrs.ngDatabound)}: undefined;
4586
4632
  options['filtering'] = attrs.ngFiltering ? function (){_scope.$eval(attrs.ngFiltering)}: undefined;
4587
- options['open'] = attrs.ngOpen ? function (){_scope.$eval(attrs.ngOpen)}: undefined;
4633
+ options['open'] = attrs.ngOpen ? function (){_scope.$eval(attrs.ngOpen); onSelectedItem();}: onSelectedItem;
4588
4634
  options['cascade'] = attrs.ngCascade ? function (){_scope.$eval(attrs.ngCascade)}: undefined;
4589
4635
  evtSelect = attrs.ngSelect ? function (){_scope.$eval(attrs.ngSelect)}: undefined;
4590
4636
  deselect = attrs.ngDeselect ? function (){_scope.$eval(attrs.ngDeselect)}: undefined;
@@ -5108,7 +5154,7 @@
5108
5154
  items.forEach(function (item) {
5109
5155
 
5110
5156
  var security = (item.security && item.security != null) ? ` cronapp-security="${item.security }" ` : '';
5111
- var action = (item.action && item.action != null) ? ` ng-click="${item.action}" ` : '';
5157
+ var action = (item.action && item.action != null) ? ` ng-click="cronapi.internal.lastCronappMenuClick('${item.id}');${item.action}" ` : '';
5112
5158
  var hide = (item.hide && item.hide != null) ? ` ng-hide="${item.hide}" ` : '';
5113
5159
  var iconClass = (item.iconClass && item.iconClass != null) ? `<i class="${item.iconClass}" id="menu-tag-i-${item.id}"></i>&nbsp;` : '';
5114
5160
  var title = `<span id="menu-tag-span-${item.id}"></span>`;
@@ -5235,168 +5281,98 @@
5235
5281
  };
5236
5282
  }])
5237
5283
 
5238
- .directive('cronBreadcrumbs', function () {
5284
+ .directive('cronBreadcrumbs', function ($rootScope) {
5239
5285
  'use strict';
5240
5286
  return {
5241
5287
  restrict: 'E',
5242
5288
  replace: true,
5243
5289
  link: function (scope, element, attrs) {
5244
5290
 
5245
- let crnDelimiterIcon = attrs.crnDelimiterIcon;
5246
- let crnTypeMenu = attrs.typeMenu;
5247
- let idMenu = attrs.idMenu ? attrs.idMenu : null;
5248
- let breadcrumb = [];
5249
- let actionBlockly = attrs.ngInit ? attrs.ngInit : null;
5250
- let idBreadcrumb = attrs.id;
5251
- let arrayPaiBreadcrumb = [];
5252
-
5253
- let iconRoot = attrs.breadcrumbIcon ? attrs.breadcrumbIcon : null;
5291
+ var bcAction = attrs.ngInit ? attrs.ngInit : null;
5292
+ const bcDelimiterIcon = attrs.crnDelimiterIcon;
5293
+ const bcTypeMenu = attrs.typeMenu;
5294
+ const bcMenuId = attrs.idMenu ? attrs.idMenu : null;
5295
+ const bcId = attrs.id;
5296
+ const bcIconRoot = attrs.breadcrumbIcon ? attrs.breadcrumbIcon : null;
5297
+ const bcList = [];
5254
5298
 
5255
- async function functionActionBlockly() {
5256
- let shortVersion = actionBlockly.replace("cronapi.client('js.", 'blockly.js.');
5257
- actionBlockly = shortVersion.replace("').run()", '');
5258
- actionBlockly = scope.$eval(actionBlockly);
5259
- breadcrumb = await actionBlockly();
5299
+ const fillAction = async () => {
5300
+ const shortVersion = bcAction.replace("cronapi.client('js.", 'blockly.js.');
5301
+ bcAction = shortVersion.replace("').run()", '');
5302
+ bcAction = scope.$eval(bcAction);
5303
+ bcList = await bcAction();
5260
5304
 
5261
- var onclick = async (e) => {
5262
- if (e.item.action) {
5263
- e.item.action();
5264
- }
5265
- };
5305
+ const onclick = async (e) => {
5306
+ if (e.item.action) {
5307
+ e.item.action();
5308
+ }
5309
+ };
5266
5310
 
5267
- $(`#${idBreadcrumb}`).kendoBreadcrumb({
5268
- items: breadcrumb,
5269
- delimiterIcon: crnDelimiterIcon,
5270
- navigational: true,
5271
- click : onclick
5272
- });
5311
+ $(`#${bcId}`).kendoBreadcrumb({
5312
+ items: bcList,
5313
+ delimiterIcon: bcDelimiterIcon,
5314
+ navigational: true,
5315
+ click : onclick
5316
+ });
5273
5317
  }
5274
5318
 
5319
+ const clearAction = (action) => {
5320
+ if (action) {
5321
+ return action.replace("cronapi.screen.changeView('", '').replace("', [])", '');
5322
+ }
5323
+ return "#/home";
5324
+ }
5275
5325
 
5276
- if (actionBlockly && crnTypeMenu === "idBloco") {
5277
- functionActionBlockly()
5278
-
5326
+ if (bcAction && bcTypeMenu === "idBloco") {
5327
+ fillAction();
5279
5328
  } else {
5280
- setTimeout(() => {
5281
- // Capturar o json do menu
5282
- let menuOptions = $(`#${idMenu}`)[0].parentElement.attributes['options'];
5283
- menuOptions = JSON.parse(menuOptions.value);
5284
- let subMenuOptions = menuOptions.subMenuOptions;
5285
-
5286
- // Capturar a url da pagina
5287
- let page = document.location.hash;
5288
- if (page === "") {
5289
- page = "home"
5290
- } else {
5291
- page = page.split("/");
5292
- }
5293
-
5294
- inicio(subMenuOptions);
5295
-
5296
- function inicio(items) {
5297
- let x = false;
5298
-
5299
- for (let i in items) {
5300
-
5301
- let action = items[i].action;
5302
- if (action && action != "") {
5303
- action = action.replace("cronapi.screen.changeView('", '');
5304
- action = action.replace("', [])", '')
5305
- action = action.split("/");
5306
- } else {
5307
- action = null
5308
- }
5309
-
5310
- if (items[i].level === 1) {
5311
- arrayPaiBreadcrumb = [];
5312
- }
5313
-
5314
- if (arrayPaiBreadcrumb.length != 0 && items[i].level === arrayPaiBreadcrumb[arrayPaiBreadcrumb.length - 1].level) {
5315
- if (!action) {
5316
- arrayPaiBreadcrumb[arrayPaiBreadcrumb.length - 1] = {
5317
- level: items[i].level,
5318
- title: items[i].title,
5319
- href: '#'
5320
- };
5321
-
5322
- } else if (action) {
5323
- arrayPaiBreadcrumb[arrayPaiBreadcrumb.length - 1] = {
5324
- level: items[i].level,
5325
- title: items[i].title,
5326
- href: document.location.origin + '/' + action.join("/")
5327
- };
5328
-
5329
- }
5330
-
5331
- } else {
5332
- if (!action) {
5333
- arrayPaiBreadcrumb.push({
5334
- level: items[i].level,
5335
- title: items[i].title,
5336
- href: '#'
5337
- });
5338
- } else if (action) {
5339
- arrayPaiBreadcrumb.push({
5340
- level: items[i].level,
5341
- title: items[i].title,
5342
- href: document.location.origin + '/' + action.join("/")
5343
- });
5344
- }
5345
- }
5346
-
5347
- if (items[i].menuItems.length > 0) {
5348
- inicio(items[i].menuItems);
5349
-
5350
- } else {
5351
- if (action) {
5352
- if (action[action.length - 1] === page[page.length - 1] || action[action.length - 1] === page) {
5353
- x = true;
5329
+ var observer = new MutationObserver((mutation, observer) => {
5330
+ const $parent = $(`#${bcMenuId}`).parent();
5331
+ const attrOptions = $parent.attr('options');
5332
+ if (attrOptions) {
5333
+ observer.disconnect(); // stop observing
5334
+
5335
+ const options = JSON.parse(attrOptions);
5336
+ const page = document.location.hash || 'home';
5337
+
5338
+ const findTrace = (array, action, path = []) => {
5339
+ for (let i = 0; i < array.length; i++) {
5340
+ var item = array[i];
5341
+ item.action = clearAction(item.action);
5342
+ if (item.action === action) {
5343
+ return [...path, item];
5344
+ }
5345
+ if (item.menuItems) {
5346
+ const result = findTrace(item.menuItems, action, [...path, item]);
5347
+ if (result) {
5348
+ return result;
5349
+ }
5350
+ }
5354
5351
  }
5352
+ return null;
5355
5353
  }
5356
- }
5357
5354
 
5358
- if (x) {
5359
- for (let y in arrayPaiBreadcrumb) {
5360
-
5361
- if (y == 0 && arrayPaiBreadcrumb[y].level == 1) {
5362
- breadcrumb.push({
5363
- type: "rootitem",
5364
- href: arrayPaiBreadcrumb[y].href,
5365
- text: arrayPaiBreadcrumb[y].title,
5366
- showText: true,
5367
- showIcon: false
5368
- })
5369
- } else if (y == 0 && arrayPaiBreadcrumb[y].level != 1) {
5370
- breadcrumb.push({
5371
- type: "rootitem",
5372
- href: arrayPaiBreadcrumb[y].href,
5373
- text: arrayPaiBreadcrumb[y].title,
5374
- showText: true,
5375
- showIcon: false
5376
- })
5377
- } else {
5378
- breadcrumb.push({
5379
- type: "item",
5380
- href: arrayPaiBreadcrumb[y].href,
5381
- text: arrayPaiBreadcrumb[y].title,
5382
- showText: true,
5383
- showIcon: false
5384
- })
5385
- }
5355
+ const trace = findTrace(options.subMenuOptions, page);
5356
+ if (trace) {
5357
+ for (var index in trace) {
5358
+ const item = trace[index];
5359
+ bcList.push({
5360
+ type: index == 0 ? 'rootitem' : 'item',
5361
+ href: item.action,
5362
+ text: item.title,
5363
+ showText: true,
5364
+ showIcon: false
5365
+ });
5366
+ }
5367
+ $(`#${bcId}`).kendoBreadcrumb({
5368
+ items: bcList,
5369
+ delimiterIcon: bcDelimiterIcon,
5370
+ navigational: true
5371
+ });
5386
5372
  }
5387
-
5388
- return breadcrumb
5389
- }
5390
5373
  }
5391
- }
5392
-
5393
- $(`#${idBreadcrumb}`).kendoBreadcrumb({
5394
- items: breadcrumb,
5395
- delimiterIcon: crnDelimiterIcon,
5396
- navigational: true
5397
- });
5398
-
5399
- }, 800);
5374
+ });
5375
+ observer.observe(document.body, { childList : true});
5400
5376
  }
5401
5377
  }
5402
5378
  }
@@ -5420,7 +5396,7 @@
5420
5396
  let blocklyParams = shortVersion.split('.run')[1];
5421
5397
  evaluated = await scope.$eval(blocklyPackage + blocklyParams);
5422
5398
  } else {
5423
- evaluated = scope.$eval(attrs.ngInitialValue);
5399
+ evaluated = scope.$eval(attrs.ngInitialValue) || attrs.ngInitialValue;
5424
5400
  }
5425
5401
  } catch (e) {
5426
5402
  evaluated = attrs.ngInitialValue;
@@ -14,7 +14,7 @@
14
14
  // data
15
15
  this.getReport = function(reportName) {
16
16
  var req = {
17
- url : 'api/rest/report',
17
+ url : window.hostApp + 'api/rest/report',
18
18
  method : 'POST',
19
19
  data : angular.toJson({
20
20
  'reportName' : reportName
@@ -26,7 +26,7 @@
26
26
  // bytes[]
27
27
  this.getPDF = function(report) {
28
28
  var req = {
29
- url : 'api/rest/report/pdf',
29
+ url : window.hostApp + 'api/rest/report/pdf',
30
30
  method : 'POST',
31
31
  responseType : 'arraybuffer',
32
32
  data : angular.toJson(report)
@@ -37,7 +37,7 @@
37
37
  // file
38
38
  this.getPDFAsFile = function(report) {
39
39
  var req = {
40
- url : 'api/rest/report/pdfasfile',
40
+ url : window.hostApp + 'api/rest/report/pdfasfile',
41
41
  method : 'POST',
42
42
  data : angular.toJson(report)
43
43
  };
@@ -46,7 +46,7 @@
46
46
 
47
47
  this.getContentAsString = function(report) {
48
48
  var req = {
49
- url : 'api/rest/report/contentasstring',
49
+ url : window.hostApp + 'api/rest/report/contentasstring',
50
50
  method : 'POST',
51
51
  data : angular.toJson(report)
52
52
  };
@@ -55,7 +55,7 @@
55
55
 
56
56
  this.getDataSourcesParams = function(datasourcesInBand) {
57
57
  var req = {
58
- url : 'api/rest/report/getdatasourcesparams',
58
+ url : window.hostApp + 'api/rest/report/getdatasourcesparams',
59
59
  method : 'POST',
60
60
  data : angular.toJson(datasourcesInBand)
61
61
  };
@@ -80,14 +80,17 @@
80
80
  console.log(files[i].$valid);
81
81
  }
82
82
  var _u = JSON.parse(localStorage.getItem('_u'));
83
+ let headerValues = window.isUsingCookie() ? {
84
+ 'Content-Type' : undefined
85
+ } : {
86
+ 'Content-Type' : undefined,
87
+ 'X-AUTH-TOKEN' : (_u ?_u.token : '')
88
+ };
83
89
  this.$promise = $http({
84
90
  method: 'POST',
85
91
  url: (window.hostApp || "") + uploadUrl,
86
92
  data: formData,
87
- headers: {
88
- 'Content-Type': undefined,
89
- 'X-AUTH-TOKEN': (_u ?_u.token : '')
90
- },
93
+ headers: headerValues,
91
94
  onProgress: function(event) {
92
95
  this.safeApply(function() {
93
96
  if (event.lengthComputable) {
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "2.9.6-SP.4",
3
+ "version": "2.9.6-SP.41",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {
7
7
  "build": "npm i && gulp",
8
- "test": "echo \"Error: no test specified\" && exit 1"
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "preinstall": "npx force-resolutions"
9
10
  },
10
11
  "repository": {
11
12
  "type": "git",
@@ -63,14 +64,18 @@
63
64
  "angular-ui-notification": "0.3.6",
64
65
  "ui-select": "0.18.1",
65
66
  "bootstrap": "3.4.1",
66
- "chart.js": "2.7.0",
67
+ "chart.js": "2.9.4",
67
68
  "cpf_cnpj": "0.2.0",
68
69
  "font-awesome": "4.4.0",
69
70
  "jquery": "3.5.1",
70
71
  "justgage": "1.3.5",
71
- "moment": "2.29.1",
72
+ "moment": "2.29.4",
72
73
  "moment-timezone": "0.5.33",
73
74
  "ng-file-upload": "12.2.13",
74
75
  "signature_pad": "^3.0.0-beta.4"
76
+ },
77
+ "resolutions": {
78
+ "chart.js": "2.9.4",
79
+ "moment": "2.29.4"
75
80
  }
76
81
  }
package/postupdate.json CHANGED
@@ -387,6 +387,10 @@
387
387
  "old": "plugins/chart.js/dist/Chart.min.js",
388
388
  "new": "node_modules/chart.js/dist/Chart.min.js"
389
389
  },
390
+ {
391
+ "old": "node_modules/cronapp-lib-js/dist/js/chart.js/Chart.min.js",
392
+ "new": "node_modules/chart.js/dist/Chart.min.js"
393
+ },
390
394
  {
391
395
  "old": "plugins/angular-chart.js/dist/angular-chart.min.js",
392
396
  "new": "node_modules/angular-chart.js/dist/angular-chart.min.js"
@@ -471,6 +475,10 @@
471
475
  "old": "plugins/moment/min/moment-with-locales.min.js",
472
476
  "new": "node_modules/moment/min/moment-with-locales.min.js"
473
477
  },
478
+ {
479
+ "old": "node_modules/cronapp-lib-js/dist/js/moment/moment-with-locales.min.js",
480
+ "new": "node_modules/moment/min/moment-with-locales.min.js"
481
+ },
474
482
  {
475
483
  "old": "plugins/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js",
476
484
  "new": "node_modules/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"