cronapp-framework-js 3.0.0-SP.5 → 3.0.0-SP.51

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 (150) hide show
  1. package/components/crn-dynamic-file.components.json +65 -34
  2. package/components/crn-dynamic-menu.components.json +0 -21
  3. package/components/crn-enterprise-combobox-multiple.components.json +6 -0
  4. package/components/crn-navbar.components.json +26 -1
  5. package/components/cron-breadcrumbs.components.json +7 -3
  6. package/components/templates/Component_Container/crn-eight-four-container.template.html +2 -2
  7. package/components/templates/Component_Container/crn-four-eight-container.template.html +2 -2
  8. package/components/templates/Component_Container/crn-one-container.template.html +1 -1
  9. package/components/templates/Component_Container/crn-three-container.template.html +3 -3
  10. package/components/templates/Component_Container/crn-three-six-three-container.template.html +3 -3
  11. package/components/templates/Component_Container/crn-two-container.template.html +2 -2
  12. package/components/templates/combobox-dynamic.template.html +4 -4
  13. package/components/templates/cron-autocomplete.designtime.html +2 -2
  14. package/components/templates/cron-calendar.template.html +1 -1
  15. package/components/templates/cron-combobox-multiple.template.html +1 -1
  16. package/components/templates/cron-grid.designtime.html +5 -4
  17. package/components/templates/dynamicfile.designtime.html +5 -0
  18. package/components/templates/dynamicfile.template.html +20 -3
  19. package/css/themes/custom/aquamarine/custom-aquamarine.css +24 -10
  20. package/css/themes/custom/cerulean/custom-cerulean.css +1 -0
  21. package/css/themes/custom/cosmo/custom-cosmo.css +16 -16
  22. package/css/themes/custom/cosmo/panel-cosmo.css +1 -1
  23. package/css/themes/custom/cyborg/button-cyborg.css +67 -3
  24. package/css/themes/custom/cyborg/custom-cyborg.css +250 -69
  25. package/css/themes/custom/cyborg/navbar-cyborg.css +4 -4
  26. package/css/themes/custom/cyborg/panel-cyborg.css +6 -7
  27. package/css/themes/custom/darkly/custom-darkly.css +1 -8
  28. package/css/themes/custom/dsgov/button-dsgov.css +0 -1
  29. package/css/themes/custom/dsgov/custom-dsgov.css +12 -1
  30. package/css/themes/custom/dsgov/table-grid-dsgov.css +14 -9
  31. package/css/themes/custom/flatly/custom-flatly.css +1 -0
  32. package/css/themes/custom/fuse/custom-fuse.css +15 -19
  33. package/css/themes/custom/journal/custom-journal.css +1 -0
  34. package/css/themes/custom/krypton/custom-krypton.css +991 -236
  35. package/css/themes/custom/krypton/grid-krypton.css +253 -66
  36. package/css/themes/custom/krypton/navbar-krypton.css +13 -12
  37. package/css/themes/custom/krypton/panel-krypton.css +29 -26
  38. package/css/themes/custom/lumen/button-lumen.css +8 -8
  39. package/css/themes/custom/lumen/custom-lumen.css +46 -34
  40. package/css/themes/custom/lumen/navbar-lumen.css +1 -1
  41. package/css/themes/custom/lumen/panel-lumen.css +17 -13
  42. package/css/themes/custom/material/custom-material.css +12 -1
  43. package/css/themes/custom/material/grid-material.css +1 -1
  44. package/css/themes/custom/material/navbar-material.css +13 -0
  45. package/css/themes/custom/material-round/custom-material-round.css +187 -34
  46. package/css/themes/custom/material-round/grid-material-round.css +174 -18
  47. package/css/themes/custom/materialui/custom-materialui.css +1 -0
  48. package/css/themes/custom/navigator/custom-navigator.css +80 -21
  49. package/css/themes/custom/paper/custom-paper.css +284 -27
  50. package/css/themes/custom/readable/button-readable.css +61 -1
  51. package/css/themes/custom/readable/custom-readable.css +242 -26
  52. package/css/themes/custom/readable/navbar-readable.css +1 -2
  53. package/css/themes/custom/readable/panel-readable.css +6 -8
  54. package/css/themes/custom/sandstone/button-sandstone.css +12 -0
  55. package/css/themes/custom/sandstone/custom-sandstone.css +1 -0
  56. package/css/themes/custom/simplex/custom-simplex.css +1 -0
  57. package/css/themes/custom/slate/custom-slate.css +4 -3
  58. package/css/themes/custom/spacelab/custom-spacelab.css +1 -0
  59. package/css/themes/custom/superhero/button-superhero.css +1 -1
  60. package/css/themes/custom/superhero/custom-superhero.css +348 -45
  61. package/css/themes/custom/superhero/navbar-superhero.css +5 -1
  62. package/css/themes/custom/superhero/panel-superhero.css +4 -5
  63. package/css/themes/custom/superhero/tabs-superhero.css +1 -1
  64. package/css/themes/custom/theme-general/button.css +4 -0
  65. package/css/themes/custom/theme-general/menu-vertical-retratil.css +35 -23
  66. package/css/themes/custom/theme-general/menu.css +10 -2
  67. package/css/themes/custom/theme-general/table-grid.css +14 -2
  68. package/css/themes/custom/theme-general/theme-general.css +30 -0
  69. package/css/themes/custom/united/custom-united.css +1 -0
  70. package/css/themes/custom/yeti/custom-yeti.css +1 -0
  71. package/dist/components/js/format.min.js +1 -1
  72. package/dist/components/js/jquery.inputmask.bundle.js +1 -1
  73. package/dist/components/js/jquery.mask.min.js +1 -1
  74. package/dist/components/templates/Component_Container/crn-eight-four-container.template.html +1 -1
  75. package/dist/components/templates/Component_Container/crn-four-eight-container.template.html +1 -1
  76. package/dist/components/templates/Component_Container/crn-one-container.template.html +1 -1
  77. package/dist/components/templates/Component_Container/crn-three-container.template.html +1 -1
  78. package/dist/components/templates/Component_Container/crn-three-six-three-container.template.html +1 -1
  79. package/dist/components/templates/Component_Container/crn-two-container.template.html +1 -1
  80. package/dist/components/templates/combobox-dynamic.template.html +1 -1
  81. package/dist/components/templates/cron-autocomplete.designtime.html +1 -1
  82. package/dist/components/templates/cron-calendar.template.html +1 -1
  83. package/dist/components/templates/cron-combobox-multiple.template.html +1 -1
  84. package/dist/components/templates/cron-grid.designtime.html +1 -1
  85. package/dist/components/templates/dynamicfile.designtime.html +1 -0
  86. package/dist/components/templates/dynamicfile.template.html +1 -1
  87. package/dist/css/themes/custom/aquamarine/custom-aquamarine.css +1 -1
  88. package/dist/css/themes/custom/cerulean/custom-cerulean.css +1 -1
  89. package/dist/css/themes/custom/cosmo/custom-cosmo.css +1 -1
  90. package/dist/css/themes/custom/cosmo/panel-cosmo.css +1 -1
  91. package/dist/css/themes/custom/cyborg/button-cyborg.css +1 -1
  92. package/dist/css/themes/custom/cyborg/custom-cyborg.css +1 -1
  93. package/dist/css/themes/custom/cyborg/navbar-cyborg.css +1 -1
  94. package/dist/css/themes/custom/cyborg/panel-cyborg.css +1 -1
  95. package/dist/css/themes/custom/darkly/custom-darkly.css +1 -1
  96. package/dist/css/themes/custom/dsgov/button-dsgov.css +1 -1
  97. package/dist/css/themes/custom/dsgov/custom-dsgov.css +1 -1
  98. package/dist/css/themes/custom/dsgov/table-grid-dsgov.css +1 -1
  99. package/dist/css/themes/custom/flatly/custom-flatly.css +1 -1
  100. package/dist/css/themes/custom/fuse/custom-fuse.css +1 -1
  101. package/dist/css/themes/custom/journal/custom-journal.css +1 -1
  102. package/dist/css/themes/custom/krypton/custom-krypton.css +1 -1
  103. package/dist/css/themes/custom/krypton/grid-krypton.css +1 -1
  104. package/dist/css/themes/custom/krypton/navbar-krypton.css +1 -1
  105. package/dist/css/themes/custom/krypton/panel-krypton.css +1 -1
  106. package/dist/css/themes/custom/lumen/button-lumen.css +1 -1
  107. package/dist/css/themes/custom/lumen/custom-lumen.css +1 -1
  108. package/dist/css/themes/custom/lumen/navbar-lumen.css +1 -1
  109. package/dist/css/themes/custom/lumen/panel-lumen.css +1 -1
  110. package/dist/css/themes/custom/material/custom-material.css +1 -1
  111. package/dist/css/themes/custom/material/grid-material.css +1 -1
  112. package/dist/css/themes/custom/material/navbar-material.css +1 -1
  113. package/dist/css/themes/custom/material-round/custom-material-round.css +1 -1
  114. package/dist/css/themes/custom/material-round/grid-material-round.css +1 -1
  115. package/dist/css/themes/custom/materialui/custom-materialui.css +1 -1
  116. package/dist/css/themes/custom/navigator/custom-navigator.css +1 -1
  117. package/dist/css/themes/custom/paper/custom-paper.css +1 -1
  118. package/dist/css/themes/custom/readable/button-readable.css +1 -1
  119. package/dist/css/themes/custom/readable/custom-readable.css +1 -1
  120. package/dist/css/themes/custom/readable/navbar-readable.css +1 -1
  121. package/dist/css/themes/custom/readable/panel-readable.css +1 -1
  122. package/dist/css/themes/custom/sandstone/button-sandstone.css +1 -1
  123. package/dist/css/themes/custom/sandstone/custom-sandstone.css +1 -1
  124. package/dist/css/themes/custom/simplex/custom-simplex.css +1 -1
  125. package/dist/css/themes/custom/slate/custom-slate.css +1 -1
  126. package/dist/css/themes/custom/spacelab/custom-spacelab.css +1 -1
  127. package/dist/css/themes/custom/superhero/button-superhero.css +1 -1
  128. package/dist/css/themes/custom/superhero/custom-superhero.css +1 -1
  129. package/dist/css/themes/custom/superhero/navbar-superhero.css +1 -1
  130. package/dist/css/themes/custom/superhero/panel-superhero.css +1 -1
  131. package/dist/css/themes/custom/superhero/tabs-superhero.css +1 -1
  132. package/dist/css/themes/custom/theme-general/button.css +1 -1
  133. package/dist/css/themes/custom/theme-general/menu-vertical-retratil.css +1 -1
  134. package/dist/css/themes/custom/theme-general/menu.css +1 -1
  135. package/dist/css/themes/custom/theme-general/table-grid.css +1 -1
  136. package/dist/css/themes/custom/theme-general/theme-general.css +1 -1
  137. package/dist/css/themes/custom/united/custom-united.css +1 -1
  138. package/dist/css/themes/custom/yeti/custom-yeti.css +1 -1
  139. package/dist/js/app.js +1 -1
  140. package/dist/js/controllers.js +1 -1
  141. package/dist/js/directives.js +17 -12
  142. package/dist/js/reports/reports.service.js +1 -1
  143. package/dist/js/upload.service.js +1 -1
  144. package/js/app.js +5 -4
  145. package/js/controllers.js +42 -19
  146. package/js/directives.js +382 -121
  147. package/js/reports/reports.service.js +5 -5
  148. package/js/upload.service.js +7 -4
  149. package/package.json +1 -1
  150. package/postupdate.json +6 -0
package/js/directives.js CHANGED
@@ -83,14 +83,8 @@
83
83
  return {
84
84
  restrict: 'E',
85
85
  link: async function (scope, element, attrs, ngModelCtrl) {
86
- let options = {};
87
-
88
- try {
89
- options = JSON.parse(attrs.options);
90
- } catch (e) {
91
- console.error(e);
92
- }
93
-
86
+
87
+ let options = scope.$eval(attrs.options) || {};
94
88
  const cronCalendarElement = $(element);
95
89
 
96
90
  const culture = navigator.language || navigator.userLanguage;
@@ -2688,6 +2682,67 @@
2688
2682
  return attributes;
2689
2683
  }
2690
2684
 
2685
+ function commandClick(e, column) {
2686
+ e.preventDefault();
2687
+ let tr = $(e.target).closest("tr");
2688
+ let grid = tr.closest('table');
2689
+ let itemAsObj = this.dataItem(tr);
2690
+ let item = this.dataItem(tr);
2691
+ let index = $(grid.find('tbody')[0]).children().index(tr);
2692
+ let call = undefined;
2693
+ if (column.dataType == "Customized" || column.dataType == "CustomizedLink" || column.dataType == "GroupedButtons")
2694
+ call = column.execute;
2695
+ else
2696
+ call = generateBlocklyCall(column.blocklyInfo);
2697
+ let cronappDatasource = this.dataSource.transport.options.cronappDatasource;
2698
+ let currentGrid = options.refComponent;
2699
+ let selectedRows = [];
2700
+ currentGrid.select().each(function() {
2701
+ let gridRow = currentGrid.dataItem(this);
2702
+ cronappDatasource.data.forEach(function(dsRow) {
2703
+ if (dsRow.__$id == gridRow.__$id)
2704
+ selectedRows.push(dsRow);
2705
+ });
2706
+ });
2707
+
2708
+ if (!(cronappDatasource.inserting || cronappDatasource.editing)) {
2709
+ let tr = e.currentTarget.parentElement.parentElement;
2710
+ this.select(tr);
2711
+ }
2712
+
2713
+ let selectedRowsKeyOrObj = [];
2714
+ if (options.fieldType && options.fieldType === 'key') {
2715
+ item = helperDirective.changeObjectField(cronappDatasource, cronappDatasource.findObjInDs(item));
2716
+ selectedRows.forEach(row => {
2717
+ selectedRowsKeyOrObj.push(helperDirective.changeObjectField(cronappDatasource, cronappDatasource.findObjInDs(row)));
2718
+ });
2719
+ }
2720
+ else {
2721
+ selectedRowsKeyOrObj = selectedRows;
2722
+ }
2723
+
2724
+ let consolidated = {
2725
+ item: item,
2726
+ index: index
2727
+ }
2728
+
2729
+ let contextVars = {
2730
+ 'currentData': cronappDatasource.data,
2731
+ 'datasource': cronappDatasource.copyWithoutAngularObj(),
2732
+ 'selectedIndex': index,
2733
+ 'index': index,
2734
+ 'selectedRow': item,
2735
+ 'consolidated': consolidated,
2736
+ 'item': item,
2737
+ 'selectedKeys': cronappDatasource.getKeyValues(cronappDatasource.findObjInDs(itemAsObj), true),
2738
+ 'selectedRows': selectedRowsKeyOrObj
2739
+ };
2740
+
2741
+ cronappDatasource.goTo(itemAsObj);
2742
+ scope.$eval(call, contextVars);
2743
+ return;
2744
+ };
2745
+
2691
2746
  var columns = [];
2692
2747
  if (options.columns) {
2693
2748
  options.columns.forEach(function(column) {
@@ -2757,7 +2812,7 @@
2757
2812
  className = 'k-custom-command' + (label ? ' k-button-with-label' : '');
2758
2813
  }
2759
2814
  if (column.theme)
2760
- className += ' ' + column.theme;
2815
+ className += ' btn ' + column.theme;
2761
2816
 
2762
2817
  var tooltip = '';
2763
2818
  if (column.tooltip && column.tooltip.length)
@@ -2769,79 +2824,21 @@
2769
2824
  className += ' ' + classForTooltip;
2770
2825
  }
2771
2826
 
2827
+ let width = column.width;
2828
+ if (width) {
2829
+ width += 'px';
2830
+ }
2831
+
2772
2832
  let idForCommand = app.common.generateId();
2773
2833
  let ariaLabel = tooltip || label || idForCommand;
2774
- let template = `<a href class='k-button ${className} k-grid-${idForCommand}' aria-label='${ariaLabel}'><span class='${column.iconClass}'></span>${label}</a>`;
2834
+ let template = `<a href class='k-button ${className} k-grid-${idForCommand}' aria-label='${ariaLabel}' style='width:${width}'><span class='${column.iconClass}'></span>${label}</a>`;
2775
2835
 
2776
2836
  var addColumn = {
2777
2837
  command: [{
2778
2838
  name: idForCommand,
2779
2839
  template: template,
2780
2840
  click: function(e) {
2781
- e.preventDefault();
2782
- var tr = $(e.target).closest("tr");
2783
- var grid = tr.closest('table');
2784
-
2785
- var itemAsObj = this.dataItem(tr);
2786
- var item = this.dataItem(tr);
2787
- var index = $(grid.find('tbody')[0]).children().index(tr)
2788
-
2789
-
2790
- var call = undefined;
2791
- if (column.dataType == "Customized" || column.dataType == "CustomizedLink")
2792
- call = column.execute;
2793
- else
2794
- call = generateBlocklyCall(column.blocklyInfo);
2795
-
2796
- var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
2797
- var currentGrid = options.refComponent;
2798
- var selectedRows = [];
2799
- currentGrid.select().each(function() {
2800
- var gridRow = currentGrid.dataItem(this);
2801
- cronappDatasource.data.forEach(function(dsRow) {
2802
- if (dsRow.__$id == gridRow.__$id)
2803
- selectedRows.push(dsRow);
2804
- });
2805
- });
2806
-
2807
- if (!(cronappDatasource.inserting || cronappDatasource.editing)) {
2808
- var tr = e.currentTarget.parentElement.parentElement;
2809
- this.select(tr);
2810
- }
2811
-
2812
- let selectedRowsKeyOrObj = [];
2813
- if(options.fieldType && options.fieldType === 'key') {
2814
- item = helperDirective.changeObjectField(cronappDatasource, cronappDatasource.findObjInDs(item));
2815
- selectedRows.forEach(row => {
2816
- selectedRowsKeyOrObj.push(helperDirective.changeObjectField(cronappDatasource, cronappDatasource.findObjInDs(row)));
2817
- });
2818
- }
2819
- else {
2820
- selectedRowsKeyOrObj = selectedRows;
2821
- }
2822
-
2823
- var consolidated = {
2824
- item: item,
2825
- index: index
2826
- }
2827
-
2828
- var contextVars = {
2829
- 'currentData': cronappDatasource.data,
2830
- 'datasource': cronappDatasource.copyWithoutAngularObj(),
2831
- 'selectedIndex': index,
2832
- 'index': index,
2833
- 'selectedRow': item,
2834
- 'consolidated': consolidated,
2835
- 'item': item,
2836
- 'selectedKeys': cronappDatasource.getKeyValues(cronappDatasource.findObjInDs(itemAsObj), true),
2837
- 'selectedRows': selectedRowsKeyOrObj
2838
- };
2839
-
2840
- if (this.element.find('input[type=checkbox]').length === 0) {
2841
- cronappDatasource.goTo(itemAsObj);
2842
- }
2843
- scope.$eval(call, contextVars);
2844
- return;
2841
+ commandClick.bind(this)(e, column);
2845
2842
  }
2846
2843
  }],
2847
2844
  width: widthDevice.width,
@@ -2852,6 +2849,62 @@
2852
2849
  columns.push(addColumn);
2853
2850
  setIdCommandButton.bind(this)(idForCommand, column.dataType);
2854
2851
  }
2852
+ else if (column.dataType == "GroupedButtons") {
2853
+
2854
+ if (column.buttonColumns && column.buttonColumns.length) {
2855
+
2856
+ let commands = [];
2857
+
2858
+ column.buttonColumns.forEach(function(buttonColumn) {
2859
+ let label = buttonColumn.label == undefined ? '': buttonColumn.label;
2860
+ if (buttonColumn.iconClass && label)
2861
+ label = '&nbsp;' + label;
2862
+
2863
+ let className = 'k-custom-command' + (label ? ' k-button-with-label' : '');
2864
+ if (buttonColumn.theme)
2865
+ className += ' btn ' + buttonColumn.theme;
2866
+
2867
+ let tooltip = '';
2868
+ if (buttonColumn.tooltip && buttonColumn.tooltip.length)
2869
+ tooltip = buttonColumn.tooltip;
2870
+
2871
+ if (tooltip) {
2872
+ let classForTooltip = app.common.generateId();
2873
+ tooltips[classForTooltip] = tooltip;
2874
+ className += ' ' + classForTooltip;
2875
+ }
2876
+
2877
+ let width = buttonColumn.width;
2878
+ if (width) {
2879
+ width += 'px';
2880
+ }
2881
+
2882
+ let idForCommand = app.common.generateId();
2883
+ let ariaLabel = tooltip || label || idForCommand;
2884
+ let template = `<a href class='k-button ${className} k-grid-${idForCommand}' aria-label='${ariaLabel}' style='width:${width}'><span class='${buttonColumn.iconClass}'></span>${label}</a>`;
2885
+
2886
+ let command = {
2887
+ name: idForCommand,
2888
+ template: template,
2889
+ click: function(e) {
2890
+ buttonColumn.dataType = column.dataType;
2891
+ commandClick.bind(this)(e, buttonColumn);
2892
+ }
2893
+ };
2894
+ commands.push(command);
2895
+ });
2896
+
2897
+ var addColumn = {
2898
+ command: commands,
2899
+ width: widthDevice.width,
2900
+ title: column.headerText ? column.headerText: '',
2901
+ hidden: !widthDevice.visible,
2902
+ attributes: getAttributes(column)
2903
+ };
2904
+ columns.push(addColumn);
2905
+ setIdCommandButton.bind(this)(app.common.generateId(), column.dataType);
2906
+ }
2907
+ }
2855
2908
  else if (column.dataType == "Selectable") {
2856
2909
  var checkColumn = {
2857
2910
  selectable: true,
@@ -2989,7 +3042,11 @@
2989
3042
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
2990
3043
  if (!(cronappDatasource.inserting || cronappDatasource.editing)) {
2991
3044
  if (this.selectable) {
3045
+ setToActiveInCronappDataSource.bind(this)(e.data);
2992
3046
  this.select(e.masterRow);
3047
+ if (options.columns.find(c => c.dataType == 'Selectable') !== undefined) {
3048
+ collapseAllExcecptCurrent(this, e.detailRow, e.masterRow);
3049
+ }
2993
3050
  }
2994
3051
  else {
2995
3052
  setToActiveInCronappDataSource.bind(this)(e.data);
@@ -3217,14 +3274,22 @@
3217
3274
  },
3218
3275
  change: function(e) {
3219
3276
  var item = this.dataItem(this.select());
3220
- setToActiveInCronappDataSource.bind(this)(item);
3277
+ if ((options.details && options.details.length == 0) || (!cronapi.internal.hasMethodInCallStack('detailInit'))) {
3278
+ setToActiveInCronappDataSource.bind(this)(item);
3279
+ }
3221
3280
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
3222
3281
  if(options.fieldType && options.fieldType === 'key'){
3223
3282
  cronappDatasource.active = helperDirective.changeObjectField(cronappDatasource, cronappDatasource.active);
3224
3283
  }
3284
+
3285
+ let trDetails = this.select().next();
3286
+ let trMasters = this.select();
3287
+
3225
3288
  if (ngModelCtrl) {
3226
3289
  if ("multiple" === options.allowSelectionRowType) {
3227
3290
  let selecteds = [];
3291
+ trDetails = [];
3292
+ trMasters = [];
3228
3293
  this.select().each((i, row)=> {
3229
3294
  let item = this.dataItem(row);
3230
3295
  let objInDs = cronappDatasource.findObjInDs(item, false);
@@ -3234,6 +3299,10 @@
3234
3299
  if (objInDs !== null){
3235
3300
  selecteds.push(objInDs);
3236
3301
  }
3302
+ if (item["_objectKey"] === cronappDatasource.active["_objectKey"]) {
3303
+ trMasters.push(this.select()[i]);
3304
+ trDetails.push(this.select().next()[i]);
3305
+ }
3237
3306
  });
3238
3307
  ngModelCtrl.$setViewValue(selecteds);
3239
3308
  }
@@ -3246,7 +3315,7 @@
3246
3315
  }
3247
3316
  }
3248
3317
  }
3249
- collapseAllExcecptCurrent(this, this.select().next(), this.select());
3318
+ collapseAllExcecptCurrent(this, trDetails, trMasters);
3250
3319
 
3251
3320
  if (attrs && attrs.ngChange) {
3252
3321
  scope.$eval(attrs.ngChange);
@@ -3269,8 +3338,8 @@
3269
3338
  command = 'edit';
3270
3339
  }
3271
3340
 
3272
- let modelName = helperDirective.getModelName(attrs);
3273
- if (item && item["_objectKey"]) {
3341
+ let modelName = helperDirective.getModelName(attrs);
3342
+ if (item && item["_objectKey"]) {
3274
3343
  let key = item["_objectKey"];
3275
3344
  let id = `${modelName}-${command}-${key}`;
3276
3345
  $elem.attr('id', id);
@@ -3445,11 +3514,63 @@
3445
3514
  }
3446
3515
  });
3447
3516
 
3517
+ grid.selectable.userEvents.unbind("select");
3518
+
3448
3519
  });
3449
3520
 
3521
+ let contextMenuId = app.common.generateId();
3522
+ let contextMenuValue = app.common.generateId();
3523
+ let contextMenuClose = app.common.generateId();
3524
+ let contextMenuHtml = $(`<ul id="${contextMenuId}">
3525
+ <li id="copyText">
3526
+ <input id="${contextMenuValue}">
3527
+ <span id="${contextMenuClose}" class="k-icon k-i-close" style="margin-left: 5px;"></span>
3528
+ </li>
3529
+ </ul>`);
3450
3530
  element.html($templateDyn);
3531
+ element.append(contextMenuHtml);
3451
3532
  $compile($templateDyn)(element.scope());
3452
3533
 
3534
+ let contextMenu = $(`#${contextMenuId}`).kendoContextMenu({
3535
+ target: $templateDyn,
3536
+ filter: "td",
3537
+ close: (e) => {
3538
+ if (!closeContextMenu) {
3539
+ e.preventDefault();
3540
+ }
3541
+ },
3542
+ open: (e) => {
3543
+ let cell = e.target;
3544
+ let row = $(cell).parent()[0];
3545
+ let grid = $templateDyn.data("kendoGrid");
3546
+ let itemId = e.item.id;
3547
+
3548
+ let cellText = cell.innerText;
3549
+ if (cellText.length && cellText !== '​') {
3550
+ $(e.item).find(`#${contextMenuValue}`).val(cellText);
3551
+ closeContextMenu = false;
3552
+ }
3553
+ else {
3554
+ let menuRejected = () => {
3555
+ return new Promise((resolve, reject) => {
3556
+ let waiting = setInterval(() => {
3557
+ if ($(`#${contextMenuId}`).is(':visible')) {
3558
+ clearInterval(waiting);
3559
+ $(`#${contextMenuId}`).hide();
3560
+ }
3561
+ });
3562
+ });
3563
+ }
3564
+ menuRejected();
3565
+ }
3566
+ }
3567
+ }).data("kendoContextMenu");
3568
+
3569
+ $(`#${contextMenuClose}`).on("click", (e) => {
3570
+ closeContextMenu = true;
3571
+ contextMenu.close();
3572
+ });
3573
+
3453
3574
  }
3454
3575
  };
3455
3576
  }])
@@ -3531,8 +3652,8 @@
3531
3652
  getAllParent(cronappDatasource, itemResult.d.results[0], ids, resolve, reject);
3532
3653
  },
3533
3654
  beforeSend: (xhr) => {
3534
- if (window.uToken) {
3535
- xhr.setRequestHeader ("X-AUTH-TOKEN", window.uToken);
3655
+ if (!window.isUsingCookie()) {
3656
+ xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
3536
3657
  }
3537
3658
  },
3538
3659
  error: () => reject(),
@@ -3673,8 +3794,8 @@
3673
3794
  resolve();
3674
3795
  },
3675
3796
  beforeSend: (xhr) => {
3676
- if (window.uToken) {
3677
- xhr.setRequestHeader ("X-AUTH-TOKEN", window.uToken);
3797
+ if (!window.isUsingCookie()) {
3798
+ xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
3678
3799
  }
3679
3800
  },
3680
3801
  error: () => reject(),
@@ -4175,9 +4296,10 @@
4175
4296
  options.dataBound = attrs.ngDataBound ? function (){scope.$eval(attrs.ngDataBound)}: undefined;
4176
4297
  options.filtering = attrs.ngFiltering ? function (){scope.$eval(attrs.ngFiltering)}: undefined;
4177
4298
  options.open = function(e) {
4178
- if (!dataSourceScreen.fetched || (dataSourceScreen.data.length > combobox.dataSource.data().length)) {
4299
+ if (!dataSourceScreen.fetched || (dataSourceScreen.lastLoadedTime !== combobox.dataSource.lastLoadedTime)) {
4179
4300
  combobox.options.firstLazyRead = true;
4180
4301
  combobox.dataSource.read();
4302
+ combobox.dataSource.lastLoadedTime = dataSourceScreen.lastLoadedTime;
4181
4303
  }
4182
4304
  };
4183
4305
 
@@ -4225,6 +4347,13 @@
4225
4347
 
4226
4348
  this.toComboType(attrs, parent, select, combobox);
4227
4349
 
4350
+ let forcedRefreshModelAt;
4351
+ let canRefresh = () => {
4352
+ let check = performance.now();
4353
+ if (!forcedRefreshModelAt) return true;
4354
+ return check - forcedRefreshModelAt > 2000;
4355
+ };
4356
+
4228
4357
  var forceChangeModel = async function(value) {
4229
4358
 
4230
4359
  $log.debug("forceChangeModel | " + attrs['id'] + " | " + value);
@@ -4331,7 +4460,7 @@
4331
4460
  overRideRefresh: function() {
4332
4461
  dataSourceScreen.fetched = false;
4333
4462
  dataSourceScreen.cleanup();
4334
- defineInitialValue();
4463
+ canRefresh() && defineInitialValue();
4335
4464
  }
4336
4465
  });
4337
4466
  }
@@ -4364,6 +4493,9 @@
4364
4493
  }
4365
4494
 
4366
4495
  _compileAngular(scope, options.combobox.element[0]);
4496
+ if (options?.combobox?.span) {
4497
+ _compileAngular(scope, options.combobox.span);
4498
+ }
4367
4499
  });
4368
4500
 
4369
4501
  }
@@ -4465,6 +4597,10 @@
4465
4597
  });
4466
4598
 
4467
4599
  $("[aria-owns='" + `${attrs.id}_listbox` + "']").attr('aria-label', $translate.instant('template.crud.search'));
4600
+ if (ngModelCtrl.$modelValue) {
4601
+ _scope.cronapi.internal.forceRefreshNgModel(attrs.ngModel, ngModelCtrl.$modelValue);
4602
+ forcedRefreshModelAt = performance.now();
4603
+ }
4468
4604
  }
4469
4605
  };
4470
4606
  })
@@ -5262,6 +5398,87 @@
5262
5398
  return false;
5263
5399
  });
5264
5400
  }
5401
+ $('#checkCollapsibleMenu').on('click', function() {
5402
+ var mainView = document.getElementById("main-view");
5403
+ if (this.checked) {
5404
+ mainView.classList.remove("main-view-retratil");
5405
+ } else {
5406
+ mainView.classList.add("main-view-retratil");
5407
+ }
5408
+ });
5409
+
5410
+ let baseNav = element.closest('nav');
5411
+ if (baseNav && baseNav.length) {
5412
+
5413
+ let subMenuOnHover = !baseNav.hasClass('submenu-click');
5414
+ let baseNavId = baseNav.attr('id');
5415
+
5416
+ if (!baseNavId) {
5417
+ baseNavId = app.common.generateId();
5418
+ baseNav.attr('id', baseNavId);
5419
+ }
5420
+
5421
+ if (subMenuOnHover) {
5422
+ let alreadyHooked = $(`#${baseNavId} .dropdown-submenu`).data('hooked');
5423
+ if (!alreadyHooked) {
5424
+ $(`#${baseNavId} .dropdown-submenu`).on('mouseenter', function (e) {
5425
+ $(this).children('.dropdown-menu').addClass('show');
5426
+ }).on('mouseleave', function (e) {
5427
+ $(this).children('.dropdown-menu').removeClass('show');
5428
+ });
5429
+ $(`#${baseNavId} .dropdown-submenu`).data('hooked', true);
5430
+ }
5431
+
5432
+ }
5433
+ else {
5434
+ let alreayHooked = $(`#${baseNavId} .dropdown-menu a.dropdown-toggle`).data('hooked');
5435
+ if (!alreayHooked) {
5436
+ $(`#${baseNavId} .dropdown-menu a.dropdown-toggle`).on('click', function(e) {
5437
+ if (!$(this).next().hasClass('show')) {
5438
+ $(this).parents('.dropdown-menu').first().find('.show').removeClass('show');
5439
+ }
5440
+ var $subMenu = $(this).next('.dropdown-menu');
5441
+ $subMenu.toggleClass('show');
5442
+
5443
+ $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
5444
+ $('.dropdown-submenu .show').removeClass('show');
5445
+ });
5446
+
5447
+ if ($subMenu.length) {
5448
+ return false;
5449
+ }
5450
+ else {
5451
+ $('.dropdown-menu').removeClass('show');
5452
+ }
5453
+ });
5454
+ $(`#${baseNavId} .dropdown-menu a.dropdown-toggle`).data('hooked', true);
5455
+ }
5456
+
5457
+ let alreadyHookedBs = $(`#${baseNavId} .dropdown.nav-item`).data('hooked');
5458
+ if (!alreadyHookedBs) {
5459
+ $(`#${baseNavId} .dropdown.nav-item`).on('hidden.bs.dropdown', function (e) {
5460
+ $('.dropdown-submenu .show').removeClass("show");
5461
+ $('.dropdown-menu .show').removeClass('show');
5462
+ });
5463
+ $(`#${baseNavId} .dropdown.nav-item`).data('hooked', true);
5464
+ }
5465
+
5466
+ }
5467
+
5468
+ }
5469
+ else {
5470
+ let menuWihtoutNavBar_id = $(element).find('ul:first').attr('id')
5471
+ let alreadyHooked = $(`#${menuWihtoutNavBar_id} .dropdown-submenu`).data('hooked');
5472
+ if (!alreadyHooked) {
5473
+ $(`#${menuWihtoutNavBar_id} .dropdown-submenu`).on('mouseenter', function (e) {
5474
+ $(this).children('.dropdown-menu').addClass('show');
5475
+ }).on('mouseleave', function (e) {
5476
+ $(this).children('.dropdown-menu').removeClass('show');
5477
+ });
5478
+ $(`#${menuWihtoutNavBar_id} .dropdown-submenu`).data('hooked', true);
5479
+ }
5480
+ }
5481
+
5265
5482
  });
5266
5483
  });
5267
5484
  }
@@ -5754,46 +5971,53 @@
5754
5971
  }
5755
5972
  })
5756
5973
 
5757
- .directive('crnInfiniteScroll', ['$compile', function($compile){
5758
- 'use strict';
5759
- return {
5760
- restrict: 'EA',
5761
- link: function(scope, element, attrs) {
5762
- var dataSource = attrs.crnInfiniteScroll ? eval(attrs.crnInfiniteScroll) : attrs.crnDatasource ? eval(attrs.crnDatasource): undefined;
5763
- if (dataSource) {
5764
- let nextPageInfinite = {
5765
- isVisible: false,
5766
- checkVisibility: function(visible) {
5767
- if (nextPageInfinite.isVisible !== visible) {
5768
- nextPageInfinite.isVisible = visible;
5769
- if (nextPageInfinite.isVisible) {
5770
- if (dataSource.loaded && dataSource.loadedFinish) {
5771
- dataSource.nextPage();
5772
- } else {
5773
- let intervalNextPage = setInterval(function() {
5774
- if (dataSource.loaded && dataSource.loadedFinish) {
5775
- dataSource.nextPage();
5776
- clearInterval(intervalNextPage);
5777
- }
5778
- }, 250);
5779
- }
5974
+ .directive('crnInfiniteScroll', ['$compile', function($compile) {
5975
+ 'use strict';
5976
+ return {
5977
+ restrict: 'EA',
5978
+ link: function(scope, element, attrs) {
5979
+ var dataSource = scope.$eval(attrs.crnInfiniteScroll || attrs.crnDatasource);
5980
+
5981
+ if (dataSource) {
5982
+ let nextPageInfinite = {
5983
+ isVisible: false,
5984
+ checkVisibility: function() {
5985
+ var topElem = element.offset().top;
5986
+ var botElem = element.offset().top + element.outerHeight();
5987
+ var botScrn = $(window).scrollTop() + $(window).innerHeight();
5988
+ var topScrn = $(window).scrollTop();
5989
+
5990
+ return (botScrn > topElem) && (topScrn < botElem);
5991
+ },
5992
+ eventScroll: function() {
5993
+ let visible = nextPageInfinite.checkVisibility();
5994
+
5995
+ if (visible && dataSource.loaded && dataSource.loadedFinish) {
5996
+ dataSource.nextPage();
5997
+ } else if (visible && !(dataSource.loaded && dataSource.loadedFinish)) {
5998
+ let intervalNextPage = setInterval(function() {
5999
+ if (dataSource.loaded && dataSource.loadedFinish) {
6000
+ dataSource.nextPage();
6001
+ clearInterval(intervalNextPage);
5780
6002
  }
5781
- }
5782
- },
5783
- eventScroll: function() {
5784
- var topElem = element.offset().top;
5785
- var botElem = element.offset().top + element.outerHeight();
5786
- var botScrn = $(window).scrollTop() + $(window).innerHeight();
5787
- var topScrn = $(window).scrollTop();
5788
- nextPageInfinite.checkVisibility((botScrn > topElem) && (topScrn < botElem));
6003
+ }, 250);
5789
6004
  }
5790
- };
5791
- $(window).scroll(nextPageInfinite.eventScroll);
5792
- $(window).ready(nextPageInfinite.eventScroll);
5793
- }
6005
+ }
6006
+ };
6007
+
6008
+ $(window).on('scroll', nextPageInfinite.eventScroll);
6009
+ $(window).on('load', nextPageInfinite.eventScroll);
6010
+
6011
+ scope.$on('$destroy', function() {
6012
+ $(window).off('scroll', nextPageInfinite.eventScroll);
6013
+ $(window).off('load', nextPageInfinite.eventScroll);
6014
+ });
6015
+ } else {
6016
+ console.error('DataSource não foi definido ou não está acessível.');
5794
6017
  }
5795
6018
  }
5796
- }])
6019
+ };
6020
+ }])
5797
6021
 
5798
6022
  }(app));
5799
6023
 
@@ -6022,6 +6246,12 @@ function maskDirective($compile, $translate, $parse, attrName) {
6022
6246
  if (type == 'time' || type == 'time-local') {
6023
6247
  momentDate = momentDate.year(1970).dayOfYear(1).month(0);
6024
6248
  }
6249
+ if (typeof value === "string" && (value.length < mask.length)) {
6250
+ let tempValue = formatWithMomentAs(mask, useUTC, value, "string");
6251
+ if (tempValue.startsWith(value) && (value.length < tempValue.length) && (isNaN(tempValue[value.length]) || tempValue[value.length] === " ")) {
6252
+ ngModelCtrl.$$element.val(tempValue.substring(0, value.length + 1));
6253
+ }
6254
+ }
6025
6255
  return momentDate.toDate();
6026
6256
  }
6027
6257
 
@@ -6797,6 +7027,9 @@ app.kendoHelper = {
6797
7027
  self.options.combobox.options.expanded = true;
6798
7028
  }
6799
7029
  e.success(data);
7030
+ if (self?.options?.combobox?.span) {
7031
+ self.options.$compile(self.options.combobox.span)(self.options.scope);
7032
+ }
6800
7033
  self.options.kendoCallback = e;
6801
7034
  if (self.options && self.options.combobox && self.options.combobox.element[0].id) {
6802
7035
  var expToFind = " .k-animation-container";
@@ -7258,6 +7491,33 @@ function cronReportViewer($compile) {
7258
7491
 
7259
7492
  executeReport(attrs.options);
7260
7493
 
7494
+ // Não inicia em em Tab não ativa
7495
+ // Verifica se esta dentro de um tab
7496
+ let elementTab = element[0].parentElement;
7497
+ while (elementTab) {
7498
+ if (elementTab.tagName === "BODY") {
7499
+ elementTab = null;
7500
+ } else if (elementTab.classList.contains("tab-pane")) {
7501
+ break;
7502
+ } else {
7503
+ elementTab = elementTab.parentElement;
7504
+ }
7505
+ }
7506
+ // Se estiver dentro de um tab e esta não estiver ativa, inclui observador para ler o relatorio ao ativar a tab
7507
+ if (elementTab && !elementTab.classList.contains("active")) {
7508
+ let observerClassChange = new MutationObserver(function(mutationsList, observer) {
7509
+ for (let mutation of mutationsList) {
7510
+ if (mutation.attributeName === "class" && mutation.target.classList.contains("active")) {
7511
+ executeReport(attrs.options);
7512
+ // Desconecta observador, pois só precisa ser executado uma vez.
7513
+ observer.disconnect();
7514
+ break;
7515
+ }
7516
+ }
7517
+ });
7518
+ observerClassChange.observe(elementTab, { attributes: true });
7519
+ }
7520
+
7261
7521
  var filterTimeout = null;
7262
7522
  scope.$watch(function(){ return attrs.options }, function(value, old){
7263
7523
  if (value !== old) {
@@ -7276,4 +7536,5 @@ function cronReportViewer($compile) {
7276
7536
 
7277
7537
  }
7278
7538
  };
7279
- }
7539
+ }
7540
+