cronapp-framework-js 2.8.35 → 2.8.38

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/directives.js CHANGED
@@ -796,7 +796,7 @@
796
796
  if (o.length >= 10 && o.match(ISO_PATTERN)) {
797
797
  return "datetimeoffset'" + o + "'";
798
798
  } else {
799
- return "'" + o + "'";
799
+ return "'" + o.replaceAll("'", "''") + "'";
800
800
  }
801
801
  }
802
802
  } else {
@@ -1786,40 +1786,47 @@
1786
1786
  }
1787
1787
  return obj;
1788
1788
  },
1789
- generateToolbarButtonCall: function(toolbarButton, scope, options) {
1789
+ removeSpecialChar: function(value) {
1790
+ return value.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
1791
+ },
1792
+ generateToolbarButtonCall: function(toolbarButton, scope, options, attrs) {
1790
1793
  var buttonCall;
1791
1794
  var generateObjTemplate = function(functionToCall, title, iconClass) {
1792
1795
  var obj = {
1793
1796
  template: function() {
1794
- var buttonId = app.common.generateId();
1795
- return createTemplateButton(buttonId, functionToCall, title, iconClass);
1797
+ return createTemplateButton(functionToCall, title, iconClass);
1796
1798
  }.bind(this)
1797
1799
  };
1798
1800
  return obj;
1799
1801
  }.bind(this);
1800
1802
 
1801
- var createTemplateButton = function(buttonId, functionToCall, title, iconClass) {
1803
+ var createTemplateButton = function(functionToCall, title, iconClass) {
1802
1804
  var template = '';
1803
1805
 
1804
1806
  let security = toolbarButton.security ? `cronapp-security="${toolbarButton.security}"` : "";
1805
1807
 
1808
+ let modelName = this.removeSpecialChar(attrs.ngModel);
1809
+ let buttonType = this.removeSpecialChar(toolbarButton.type);
1810
+ let buttonDesc = toolbarButton.title ? this.removeSpecialChar(toolbarButton.title): this.removeSpecialChar(toolbarButton.iconClass);
1811
+ let buttonId = `${modelName}-${buttonType}-${buttonDesc}`;
1812
+
1806
1813
  if (toolbarButton.type == "SaveOrCancelChanges") {
1807
1814
  if (toolbarButton.saveButton)
1808
- template = '<a #SECURITY# role="button" class="saveorcancelchanges k-button k-button-icontext k-grid-save-changes" id="#BUTTONID#" href="javascript:void(0)"><span class="k-icon k-i-check"></span>#TITLE#</a>';
1815
+ template = '<a #SECURITY# role="button" class="saveorcancelchanges k-button k-button-icontext k-grid-save-changes" data-id="#BUTTONID#" href="javascript:void(0)"><span class="k-icon k-i-check"></span>#TITLE#</a>';
1809
1816
  else
1810
- template = '<a #SECURITY# role="button" class="saveorcancelchanges k-button k-button-icontext k-grid-cancel-changes" id="#BUTTONID#" href="javascript:void(0)"><span class="k-icon k-i-cancel" ></span>#TITLE#</a>';
1817
+ template = '<a #SECURITY# role="button" class="saveorcancelchanges k-button k-button-icontext k-grid-cancel-changes" data-id="#BUTTONID#" href="javascript:void(0)"><span class="k-icon k-i-cancel" ></span>#TITLE#</a>';
1811
1818
  }
1812
1819
  else if (toolbarButton.type == "Blockly" || toolbarButton.type == "Customized") {
1813
- template = '<a #SECURITY# class="k-button k-grid-custom" id="#BUTTONID#" href="javascript:void(0)"><span class="#ICONCLASS#" ></span>#TITLE#</a>';
1820
+ template = '<a #SECURITY# class="k-button k-grid-custom" data-id="#BUTTONID#" href="javascript:void(0)"><span class="#ICONCLASS#" ></span>#TITLE#</a>';
1814
1821
  }
1815
1822
  else if (toolbarButton.type == "Native" && toolbarButton.title == 'create') {
1816
- template = '<a #SECURITY# role="button" id="#BUTTONID#" class="k-button k-button-icontext k-grid-add" href="javascript:void(0)"><span class="k-icon k-i-plus"></span>{{"Add" | translate}}</a>';
1823
+ template = '<a #SECURITY# role="button" data-id="#BUTTONID#" class="k-button k-button-icontext k-grid-add" href="javascript:void(0)"><span class="k-icon k-i-plus"></span>{{"Add" | translate}}</a>';
1817
1824
  }
1818
1825
  else if (toolbarButton.type == "Native" && toolbarButton.title == 'excel') {
1819
- template = '<a #SECURITY# role="button" id="#BUTTONID#" class="k-button k-button-icontext k-grid-excel" href="javascript:void(0)"><span class="k-icon k-i-file-excel"></span>{{"exportExcel" | translate}}</a>';
1826
+ template = '<a #SECURITY# role="button" data-id="#BUTTONID#" class="k-button k-button-icontext k-grid-excel" href="javascript:void(0)"><span class="k-icon k-i-file-excel"></span>{{"exportExcel" | translate}}</a>';
1820
1827
  }
1821
1828
  else if (toolbarButton.type == "Native" && toolbarButton.title == 'pdf') {
1822
- template = '<a #SECURITY# role="button" id="#BUTTONID#" class="k-button k-button-icontext k-grid-pdf" href="javascript:void(0)"><span class="k-icon k-i-file-pdf"></span>{{"exportPDF" | translate}}</a>';
1829
+ template = '<a #SECURITY# role="button" data-id="#BUTTONID#" class="k-button k-button-icontext k-grid-pdf" href="javascript:void(0)"><span class="k-icon k-i-file-pdf"></span>{{"exportPDF" | translate}}</a>';
1823
1830
  }
1824
1831
 
1825
1832
  template = template
@@ -1832,13 +1839,14 @@
1832
1839
  var cronappDatasource = eval(options.dataSourceScreen.entityDataSource.name);
1833
1840
 
1834
1841
  var waitRender = setInterval(function() {
1835
- if ($('#' + buttonId).length > 0) {
1842
+ if ($(`[data-id=${buttonId}]`).length > 0) {
1836
1843
  scope.safeApply(function() {
1837
- var x = angular.element($('#' + buttonId ));
1844
+ var x = angular.element($(`[data-id=${buttonId}]`));
1838
1845
  $compile(x)(scope);
1846
+ $(`[data-id=${buttonId}]`).attr('id', buttonId);
1839
1847
  });
1840
1848
 
1841
- $('#' + buttonId).click(function() {
1849
+ $(`[data-id=${buttonId}]`).click(function() {
1842
1850
 
1843
1851
  var currentGrid = options.refComponent;
1844
1852
  var selectedRows = [];
@@ -2048,7 +2056,7 @@
2048
2056
  return widthDevice;
2049
2057
  },
2050
2058
 
2051
- getColumns: function(options, datasource, scope, tooltips) {
2059
+ getColumns: function(options, datasource, scope, tooltips, attrs) {
2052
2060
  var helperDirective = this;
2053
2061
 
2054
2062
  function getTemplate(column) {
@@ -2214,6 +2222,28 @@
2214
2222
 
2215
2223
  }
2216
2224
 
2225
+ function setIdCommandButton(idForCommand, command) {
2226
+ let waitRender = setInterval(() => {
2227
+ if ($(`.k-grid-${idForCommand}`).is(":visible")) {
2228
+ clearInterval(waitRender);
2229
+ var currentGrid = options.refComponent;
2230
+
2231
+ $(`.k-grid-${idForCommand}`).each((idx,elem) => {
2232
+ let $elem = $(elem);
2233
+ if (!$elem.attr('id')) {
2234
+ let item = currentGrid.dataItem($elem.closest('tr'));
2235
+
2236
+ let modelName = this.removeSpecialChar(attrs.ngModel);
2237
+ let key = item["_objectKey"];
2238
+ let id = `${modelName}-${command}-${key}`;
2239
+ $elem.attr('id', id);
2240
+ }
2241
+ });
2242
+
2243
+ }
2244
+ }, 200);
2245
+ }
2246
+
2217
2247
  function getCommandForEditButtonDatabase(opt, command) {
2218
2248
  var cmd;
2219
2249
  let idForCommand = app.common.generateId();
@@ -2254,6 +2284,7 @@
2254
2284
  text: { edit: " ", update: " ", cancel: " " },
2255
2285
  };
2256
2286
  }
2287
+ setIdCommandButton.bind(this)(idForCommand, command);
2257
2288
  return cmd;
2258
2289
  }
2259
2290
 
@@ -2285,6 +2316,7 @@
2285
2316
  template: template
2286
2317
  };
2287
2318
  }
2319
+ setIdCommandButton.bind(this)(idForCommand, command);
2288
2320
  return cmd;
2289
2321
  }
2290
2322
 
@@ -2516,6 +2548,7 @@
2516
2548
  attributes: getAttributes(column)
2517
2549
  };
2518
2550
  columns.push(addColumn);
2551
+ setIdCommandButton.bind(this)(idForCommand, column.dataType);
2519
2552
  }
2520
2553
  else if (column.dataType == "Selectable") {
2521
2554
  var checkColumn = {
@@ -2541,7 +2574,7 @@
2541
2574
 
2542
2575
  return pageable;
2543
2576
  },
2544
- getToolbar: function(options, scope) {
2577
+ getToolbar: function(options, scope, attrs) {
2545
2578
 
2546
2579
  function generateToolbarTemplate(toolbarButton) {
2547
2580
  let security = toolbarButton.security ? `cronapp-security="${toolbarButton.security}" class` : "class";
@@ -2567,7 +2600,7 @@
2567
2600
  else {
2568
2601
  toolbarButton.methodCall += "cronapi.internal.focusFormInput();"
2569
2602
  }
2570
- var button = this.generateToolbarButtonCall(toolbarButton, scope, options);
2603
+ var button = this.generateToolbarButtonCall(toolbarButton, scope, options, attrs);
2571
2604
  toolbar.push(button);
2572
2605
 
2573
2606
  if (!options.hideModalButtons) {
@@ -2575,7 +2608,7 @@
2575
2608
  }
2576
2609
  }
2577
2610
  else {
2578
- let toolbarOp = this.generateToolbarButtonCall(toolbarButton, scope, options);
2611
+ let toolbarOp = this.generateToolbarButtonCall(toolbarButton, scope, options, attrs);
2579
2612
  toolbar.push(toolbarOp);
2580
2613
  }
2581
2614
  }
@@ -2587,12 +2620,12 @@
2587
2620
  }
2588
2621
  }
2589
2622
  else if (toolbarButton.type == "Blockly" || toolbarButton.type == "Customized") {
2590
- var buttonBlockly = this.generateToolbarButtonCall(toolbarButton, scope, options);
2623
+ var buttonBlockly = this.generateToolbarButtonCall(toolbarButton, scope, options, attrs);
2591
2624
  toolbar.push(buttonBlockly);
2592
2625
  }
2593
2626
  else if (toolbarButton.type == "SaveOrCancelChanges") {
2594
2627
  if (options.editable != 'no') {
2595
- var buttonSaveOrCancel = this.generateToolbarButtonCall(toolbarButton, scope, options);
2628
+ var buttonSaveOrCancel = this.generateToolbarButtonCall(toolbarButton, scope, options, attrs);
2596
2629
  toolbar.push(buttonSaveOrCancel);
2597
2630
  }
2598
2631
  }
@@ -2816,9 +2849,9 @@
2816
2849
 
2817
2850
  var datasource = app.kendoHelper.getDataSource(options.dataSourceScreen.entityDataSource, scope, options.allowPaging, options.pageCount, options.columns, options.groupings);
2818
2851
 
2819
- var columns = this.getColumns(options, datasource, scope, tooltips);
2852
+ var columns = this.getColumns(options, datasource, scope, tooltips, attrs);
2820
2853
  var pageAble = this.getPageAble(options);
2821
- var toolbar = this.getToolbar(options, scope);
2854
+ var toolbar = this.getToolbar(options, scope, attrs);
2822
2855
  var editable = this.getEditable(options);
2823
2856
  var filterable = anyFilterableColumn(options);
2824
2857
 
@@ -2918,6 +2951,28 @@
2918
2951
  }
2919
2952
 
2920
2953
  compileListing(e);
2954
+
2955
+ $(".k-command-cell a[class*='k-grid-']").each((idx, elem) => {
2956
+ let $elem = $(elem);
2957
+ if (!$elem.attr('id')) {
2958
+ let item = this.dataItem($elem.closest('tr'));
2959
+ let command = 'destroy';
2960
+ if ($elem.hasClass('k-grid-update')) {
2961
+ command = 'update';
2962
+ }
2963
+ else if ($elem.hasClass('k-grid-cancel')) {
2964
+ command = 'cancel';
2965
+ }
2966
+ else if ($elem.hasClass('k-grid-edit')) {
2967
+ command = 'edit';
2968
+ }
2969
+
2970
+ let modelName = helperDirective.removeSpecialChar(attrs.ngModel);
2971
+ let key = item["_objectKey"];
2972
+ let id = `${modelName}-${command}-${key}`;
2973
+ $elem.attr('id', id);
2974
+ }
2975
+ });
2921
2976
  },
2922
2977
  cancel: function(e) {
2923
2978
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
@@ -3586,6 +3641,9 @@
3586
3641
  _combobox.isEvaluating = false;
3587
3642
  } else {
3588
3643
  _dataSource.findObj([options.value], false, function(data) {
3644
+ if (Array.isArray(data)) {
3645
+ data = data[0];
3646
+ }
3589
3647
  options.success(data);
3590
3648
  _combobox.isEvaluating = false;
3591
3649
 
@@ -3695,9 +3753,18 @@
3695
3753
  var found = _goTo(_scope, combobox, combobox.dataItem());
3696
3754
 
3697
3755
  if (!found) {
3698
- dataItem = objectClone(combobox.dataItem(), combobox.dataSource.options.schema.model.fields);
3699
- dataSourceScreen.data.push(dataItem);
3700
- _goTo(_scope, combobox, dataItem);
3756
+ combobox.isEvaluating = true;
3757
+ dataSourceScreen.findObj([value], false, (dataresult) => {
3758
+ if (Array.isArray(dataresult)) {
3759
+ dataresult = dataresult[0];
3760
+ }
3761
+ if (dataresult) {
3762
+ dataSourceScreen.data.push(dataresult);
3763
+ _goTo(_scope, combobox, dataresult);
3764
+ modelSetter(_scope, value);
3765
+ }
3766
+ combobox.isEvaluating = false;
3767
+ });
3701
3768
  }
3702
3769
  }
3703
3770
  }
@@ -4160,7 +4227,7 @@
4160
4227
  autoComplete.enable(false);
4161
4228
  } else {
4162
4229
  autoComplete.enable(true);
4163
- }
4230
+ }
4164
4231
 
4165
4232
  if (ngModelCtrl) {
4166
4233
  ngModelCtrl.$formatters.push(function (value) {
@@ -4561,150 +4628,113 @@
4561
4628
 
4562
4629
  .directive('cronDynamicMenu', ['$compile', '$translate', function ($compile, $translate) {
4563
4630
  'use strict';
4564
- const populateSubitems = (item) => {
4565
- var subitem = item.menuItems;
4566
- var templateSubitens = '';
4567
-
4568
- subitem.forEach((subitem) => {
4569
- var securitySubitem = (subitem.security && subitem.security != null) ? ' cronapp-security="' + subitem.security + '" ' : '';
4570
- var actionSubitem = (subitem.action && subitem.action != null) ? ' ng-click="' + subitem.action + '" ' : '';
4571
- var hideSubitem = (subitem.hide && subitem.hide != null) ? ' ng-hide="' + subitem.hide + '" ' : '';
4572
- var iconClassSubitem = (subitem.iconClass && subitem.iconClass != null) ? '<i class="' + subitem.iconClass + '"></i>&nbsp;' : '';
4573
- var titleSubitem = '<span></span>';
4574
- var caretSubitem = (subitem.menuItems && Array.isArray(subitem.menuItems) && (subitem.menuItems.length > 0)) ? '<span class="caret submenu"></span>' : '';
4575
-
4576
- if (subitem.title) {
4577
- titleSubitem = '<span>' + $translate.instant(subitem.title) + '</span>';
4578
- }
4579
-
4580
- if (subitem.menuItems.length > 0) {
4581
- templateSubitens = templateSubitens + '<li class="dropdown-submenu">\
4582
- <a class="dropdown-item dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false" href=""' + securitySubitem + actionSubitem + '>' + iconClassSubitem + titleSubitem + caretSubitem + '</a>\
4583
- ' + populateItems(subitem.menuItems) + '\
4584
- </li>';
4585
-
4586
- } else {
4587
- templateSubitens = templateSubitens + '<li class="dropdown-submenu">\
4588
- <a role="button" aria-haspopup="true" aria-expanded="false" href=""' + securitySubitem + actionSubitem + '>' + iconClassSubitem + titleSubitem + caretSubitem + '</a>\
4589
- </li>';
4590
- }
4591
- });
4592
-
4593
- if (templateSubitens != '') {
4594
- templateSubitens = '<ul class="dropdown-menu">' + templateSubitens + '</ul>';
4595
- }
4596
-
4597
- return templateSubitens;
4598
- };
4599
-
4600
4631
  const populateItems = (items) => {
4601
4632
  var templateItens = '';
4602
-
4633
+
4603
4634
  if (items && items.length > 0 && Array.isArray(items)) {
4604
4635
  items.forEach(function (item) {
4605
-
4606
- var security = (item.security && item.security != null) ? ' cronapp-security="' + item.security + '" ' : '';
4607
- var action = (item.action && item.action != null) ? ' ng-click="' + item.action + '" ' : '';
4608
- var hide = (item.hide && item.hide != null) ? ' ng-hide="' + item.hide + '" ' : '';
4609
- var iconClass = (item.iconClass && item.iconClass != null) ? '<i class="' + item.iconClass + '"></i>&nbsp;' : '';
4610
- var title = '<span></span>';
4611
- var caret = (item.menuItems && Array.isArray(item.menuItems) && (item.menuItems.length > 0)) ? '<span class="caret submenu"></span>' : '';
4612
-
4636
+
4637
+ var security = (item.security && item.security != null) ? ` cronapp-security="${item.security }" ` : '';
4638
+ var action = (item.action && item.action != null) ? ` ng-click="${item.action}" ` : '';
4639
+ var hide = (item.hide && item.hide != null) ? ` ng-hide="${item.hide}" ` : '';
4640
+ var iconClass = (item.iconClass && item.iconClass != null) ? `<i class="${item.iconClass}" id="menu-tag-i-${item.id}"></i>&nbsp;` : '';
4641
+ var title = `<span id="menu-tag-span-${item.id}"></span>`;
4642
+ var caret = (item.menuItems && Array.isArray(item.menuItems) && (item.menuItems.length > 0)) ? `<span class="caret submenu" id="menu-tag-span-sub-${item.id}"></span>` : '';
4643
+
4613
4644
  if (item.title) {
4614
- title = '<span>' + $translate.instant(item.title) + '</span>';
4645
+ title = `<span id="menu-tag-span-${item.id}">${$translate.instant(item.title)}</span>`;
4615
4646
  }
4616
-
4647
+
4617
4648
  if (item.menuItems.length > 0) {
4618
- templateItens = templateItens + '\
4619
- <li class="dropdown-submenu" ' + security + hide + '> \
4620
- <a href="" ' + action + ' class="dropdown-item dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' + iconClass + title + caret + ' </a> \
4621
- ' + populateSubitems(item) + '\
4622
- </li>';
4649
+ templateItens = templateItens + `
4650
+ <li class="dropdown-submenu" ${security}${hide} id="menu-tag-li-sub-${item.id}"> \
4651
+ <a href="" ${action} id="menu-tag-a-sub-${item.id}" class="dropdown-item dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> ${iconClass} ${title} ${caret} </a> \
4652
+ ${populateItems(item.menuItems)}\
4653
+ </li>`;
4623
4654
  } else {
4624
- templateItens = templateItens + '\
4625
- <li class="dropdown-submenu" ' + security + hide + '> \
4626
- <a href="" ' + action + ' class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' + iconClass + title + caret + ' </a> \
4627
- </li>';
4655
+ templateItens = templateItens + `
4656
+ <li class="dropdown-submenu" ${security} ${hide} id="menu-tag-li-${item.id}"> \
4657
+ <a href="" ${action} id="menu-tag-a-${item.id}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">${iconClass} ${title} ${caret} </a>
4658
+ </li>`;
4628
4659
  }
4629
-
4660
+
4630
4661
  });
4631
-
4662
+
4632
4663
  if (templateItens != '') {
4633
- templateItens = '<ul class="dropdown-menu">' + templateItens + '</ul>';
4664
+ templateItens = `<ul class="dropdown-menu" id="menu-tag-ul-${items[0].id}">${templateItens}</ul>`;
4634
4665
  }
4635
4666
  }
4636
-
4637
4667
  return templateItens;
4638
4668
  }
4639
4669
  return {
4640
4670
  restrict: 'EA',
4641
4671
  populateMenu: function (menuOptions, isVertical) {
4642
4672
  var template = '';
4643
-
4673
+
4644
4674
  if (menuOptions && menuOptions != null && menuOptions.subMenuOptions && menuOptions.subMenuOptions != null && Array.isArray(menuOptions.subMenuOptions)) {
4645
-
4675
+
4646
4676
  menuOptions.subMenuOptions.forEach(function (menu) {
4647
-
4648
- var security = (menu.security && menu.security != null) ? ' cronapp-security="' + menu.security + '" ' : '';
4649
- var action = (menu.action && menu.action != null) ? ' ng-click="' + menu.action + '" ' : '';
4650
- var caret = (menu.menuItems && Array.isArray(menu.menuItems) && (menu.menuItems.length > 0)) ? '<span class="caret"></span>' : '';
4651
- var hide = (menu.hide && menu.hide != null) ? ' ng-hide="' + menu.hide + '" ' : '';
4652
- var iconClass = (menu.iconClass && menu.iconClass != null) ? '<i class="' + menu.iconClass + '"></i>&nbsp;' : '';
4653
- var title = '<span></span>'
4654
-
4677
+
4678
+ var security = (menu.security && menu.security != null) ? ` cronapp-security="${menu.security}" ` : '';
4679
+ var action = (menu.action && menu.action != null) ? ` ng-click="${menu.action }" ` : '';
4680
+ var caret = (menu.menuItems && Array.isArray(menu.menuItems) && (menu.menuItems.length > 0)) ? `<span class="caret" id="menu-tag-span-sub-${menu.id}"></span>` : '';
4681
+ var hide = (menu.hide && menu.hide != null) ? ` ng-hide="${menu.hide}" ` : '';
4682
+ var iconClass = (menu.iconClass && menu.iconClass != null) ? `<i class="${menu.iconClass}"></i>&nbsp;` : '';
4683
+ var title = `<span id="menu-tag-span-${menu.id}"></span>`;
4684
+
4655
4685
  if (menu.title) {
4656
- title = '<span>' + $translate.instant(menu.title) + '</span>';
4686
+ title = `<span id="menu-tag-span-${menu.id}">${$translate.instant(menu.title)}</span>`;
4657
4687
  }
4658
-
4659
- template = template + '\
4660
- <li class="dropdown nav-item '+ (isVertical ? 'col-md-12 padding-0' : '') + '"' + security + hide + '>\
4661
- <a href="" ' + action + ' class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">\
4662
- ' + iconClass + title + caret + '\
4663
- </a> \
4664
- ' + populateItems(menu.menuItems) + '\
4665
- </li>';
4666
-
4688
+
4689
+ template = template + `
4690
+ <li class="dropdown nav-item ${(isVertical ? 'col-md-12 padding-0' : '')}" ${security} ${hide} id="menu-tag-li-sub-${menu.id}">
4691
+ <a href="" ${action} id="menu-tag-a-sub-${menu.id}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">\
4692
+ ${iconClass} ${title} ${caret}
4693
+ </a>
4694
+ ${populateItems(menu.menuItems)}
4695
+ </li>`;
4696
+
4667
4697
  })
4668
4698
  }
4669
-
4699
+
4670
4700
  return template;
4671
4701
  },
4672
4702
  link: function (scope, element, attrs) {
4673
4703
  $translate.onReady(() => {
4674
4704
  //Somente fica na vertical se for o menu principal da IDE (E estiver configurado para isso)
4675
4705
  let isVertical = element.closest('.crn-navigator-vertical').length;
4676
-
4677
- var TEMPLATE_MAIN = '<ul class="nav navbar-nav ' + (isVertical ? 'col-md-12 padding-0' : '') + ' " style="float:left"></ul>';
4706
+
4678
4707
  var options = {};
4679
4708
  try {
4680
4709
  options = JSON.parse(attrs.options);
4681
4710
  } catch (e) {
4682
4711
  console.log('CronDynamicMenu: Invalid configuration!')
4683
4712
  }
4684
-
4713
+ let baseId = options && options.subMenuOptions ? options.subMenuOptions[0].id : "first";
4714
+ var TEMPLATE_MAIN = `<ul id="menu-tag-ul-base-${baseId}" class="nav navbar-nav ${(isVertical ? 'col-md-12 padding-0' : '')}" style="float:left"></ul>`;
4685
4715
  var main = $(TEMPLATE_MAIN);
4686
4716
  main.attr('id', attrs.id);
4687
-
4717
+
4688
4718
  var menus = this.populateMenu(options, isVertical);
4689
4719
  main.append(menus);
4690
4720
  if (isVertical) {
4691
4721
  main.append($('#navbar2 li:first').addClass('col-md-12 padding-0'));
4692
4722
  }
4693
-
4723
+
4694
4724
  var newElement = angular.element(main);
4695
4725
  element.html('');
4696
4726
  element.append(main);
4697
4727
  element.attr('id', null);
4698
4728
  $compile(newElement)(scope);
4699
-
4729
+
4700
4730
  var multilevelAction = attrs.multilevelAction;
4701
-
4731
+
4702
4732
  if (multilevelAction === 'hover') {
4703
4733
  $('.dropdown-menu .dropdown-submenu').on('mouseover', function () {
4704
4734
  var subMenu = $(this).children('ul.dropdown-menu');
4705
4735
  subMenu.addClass('displayBlock');
4706
4736
  });
4707
-
4737
+
4708
4738
  $('.dropdown-menu .dropdown-submenu').on('mouseout', function () {
4709
4739
  var subMenu = $(this).children('ul.dropdown-menu');
4710
4740
  subMenu.removeClass('displayBlock');
@@ -4723,7 +4753,6 @@
4723
4753
  return false;
4724
4754
  });
4725
4755
  }
4726
-
4727
4756
  });
4728
4757
  }
4729
4758
  }
@@ -4758,9 +4787,9 @@
4758
4787
 
4759
4788
  function inicio(items) {
4760
4789
  let x = false;
4761
-
4790
+
4762
4791
  for (let i in items) {
4763
-
4792
+
4764
4793
  let action = items[i].action;
4765
4794
  if (action && action != "") {
4766
4795
  action = action.replace("cronapi.screen.changeView('", '');
@@ -4769,11 +4798,11 @@
4769
4798
  } else {
4770
4799
  action = null
4771
4800
  }
4772
-
4801
+
4773
4802
  if (items[i].level === 1) {
4774
4803
  arrayPaiBreadcrumb = [];
4775
4804
  }
4776
-
4805
+
4777
4806
  if (arrayPaiBreadcrumb.length != 0 && items[i].level === arrayPaiBreadcrumb[arrayPaiBreadcrumb.length - 1].level) {
4778
4807
  if (!action) {
4779
4808
  arrayPaiBreadcrumb[arrayPaiBreadcrumb.length - 1] = {
@@ -4781,16 +4810,16 @@
4781
4810
  title: items[i].title,
4782
4811
  href: '#'
4783
4812
  };
4784
-
4813
+
4785
4814
  } else if (action) {
4786
4815
  arrayPaiBreadcrumb[arrayPaiBreadcrumb.length - 1] = {
4787
4816
  level: items[i].level,
4788
4817
  title: items[i].title,
4789
4818
  href: document.location.origin + '/' + action.join("/")
4790
4819
  };
4791
-
4820
+
4792
4821
  }
4793
-
4822
+
4794
4823
  } else {
4795
4824
  if (!action) {
4796
4825
  arrayPaiBreadcrumb.push({
@@ -4806,10 +4835,10 @@
4806
4835
  });
4807
4836
  }
4808
4837
  }
4809
-
4838
+
4810
4839
  if (items[i].menuItems.length > 0) {
4811
4840
  inicio(items[i].menuItems);
4812
-
4841
+
4813
4842
  } else {
4814
4843
  if (action) {
4815
4844
  if (action[action.length - 1] === page[page.length - 1]) {
@@ -4817,10 +4846,10 @@
4817
4846
  }
4818
4847
  }
4819
4848
  }
4820
-
4849
+
4821
4850
  if (x) {
4822
4851
  for (let y in arrayPaiBreadcrumb) {
4823
-
4852
+
4824
4853
  if (y == 0 && arrayPaiBreadcrumb[y].level == 1) {
4825
4854
  breadcrumb.push({
4826
4855
  type: "rootitem",
@@ -4847,7 +4876,7 @@
4847
4876
  })
4848
4877
  }
4849
4878
  }
4850
-
4879
+
4851
4880
  return breadcrumb
4852
4881
  }
4853
4882
  }
@@ -4880,7 +4909,7 @@
4880
4909
  let blocklyPackage = shortVersion.split("').names")[0];
4881
4910
  blocklyPackage = blocklyPackage.split("').attr()")[0];
4882
4911
  let blocklyParams = shortVersion.split('.run')[1];
4883
- evaluated = await scope.$eval(blocklyPackage + blocklyParams);
4912
+ evaluated = await scope.$eval(blocklyPackage + blocklyParams);
4884
4913
  } else {
4885
4914
  evaluated = scope.$eval(attrs.ngInitialValue);
4886
4915
  }
@@ -4922,7 +4951,12 @@
4922
4951
  let falseValue = attrs.ngFalseValue ? attrs.ngFalseValue.split("'").join("") : false;
4923
4952
  let trueValue = attrs.ngTrueValue ? attrs.ngTrueValue.split("'").join("") : true;
4924
4953
 
4925
- if (attrs.crnAllowNullValues == 'true') {
4954
+ let isAllowNullValues = (value) => {
4955
+ return value === 'true' || value === undefined
4956
+ || value === null || value.length == 0;
4957
+ };
4958
+
4959
+ if (isAllowNullValues(attrs.crnAllowNullValues)) {
4926
4960
  ctrl.$render = function () {
4927
4961
  let viewValue = ctrl.$viewValue;
4928
4962
  el.data('checked', viewValue);
@@ -4945,7 +4979,7 @@
4945
4979
  }
4946
4980
  setTimeout(() => ctrl.$setViewValue(viewValue));
4947
4981
  };
4948
- } else if (attrs.crnAllowNullValues == 'false') {
4982
+ } else {
4949
4983
  ctrl.$render = function () {
4950
4984
  let viewValue = ctrl.$viewValue;
4951
4985
  if (ctrl.$viewValue === undefined || ctrl.$viewValue === null) {
@@ -4953,7 +4987,7 @@
4953
4987
  viewValue = false;
4954
4988
  }
4955
4989
  if (viewValue === falseValue) {
4956
- let modelForEval = `${el.attr('ng-model')}=${attrs.ngFalseValue}`;
4990
+ let modelForEval = attrs.ngFalseValue ? `${el.attr('ng-model')}=${attrs.ngFalseValue}` : `${el.attr('ng-model')}=${falseValue}`;
4957
4991
  scope.$eval(modelForEval);
4958
4992
  }
4959
4993
  el.data('checked', viewValue);
@@ -5099,7 +5133,7 @@
5099
5133
  restrict: 'EA',
5100
5134
  replace: true,
5101
5135
  link: function (scope, element, attrs, ngModelCtrl) {
5102
-
5136
+
5103
5137
  let attributeValue = attrs.attributeValue;
5104
5138
  let orderedAttributeValue = attrs.orderedAttributeValue
5105
5139
  let listType = attrs.listType;
@@ -5107,21 +5141,21 @@
5107
5141
  content = $(content);
5108
5142
  let templateDyn = '';
5109
5143
  let contentUL = '';
5110
-
5144
+
5111
5145
  $.each(content, function (i, item) {
5112
5146
  contentUL = contentUL + item.outerHTML;
5113
5147
  });
5114
-
5148
+
5115
5149
  switch (listType) {
5116
5150
  case 'numbered-list':
5117
5151
  templateDyn = `<ol style="list-style-type: ${attributeValue}">${contentUL}</ol>`
5118
5152
  break
5119
-
5153
+
5120
5154
  case 'ordered-list':
5121
5155
  templateDyn = `<ul style="list-style-type: ${orderedAttributeValue}">${contentUL}</ul>`
5122
5156
  break
5123
5157
  }
5124
-
5158
+
5125
5159
  templateDyn = $(templateDyn);
5126
5160
  $(element).replaceWith(templateDyn);
5127
5161
  $compile(templateDyn)(scope);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "2.8.35",
3
+ "version": "2.8.38",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
package/v10.22.1 DELETED
File without changes