cronapp-framework-js 3.0.0-SP.9 → 3.1.0

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 (160) 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/crn-start.components.json +3 -0
  6. package/components/cron-breadcrumbs.components.json +7 -3
  7. package/components/templates/Component_Container/crn-eight-four-container.template.html +2 -2
  8. package/components/templates/Component_Container/crn-four-eight-container.template.html +2 -2
  9. package/components/templates/Component_Container/crn-one-container.template.html +1 -1
  10. package/components/templates/Component_Container/crn-three-container.template.html +3 -3
  11. package/components/templates/Component_Container/crn-three-six-three-container.template.html +3 -3
  12. package/components/templates/Component_Container/crn-two-container.template.html +2 -2
  13. package/components/templates/cron-autocomplete.designtime.html +2 -2
  14. package/components/templates/cron-combobox-multiple.template.html +1 -1
  15. package/components/templates/cron-grid.designtime.html +5 -4
  16. package/components/templates/dynamicfile.designtime.html +5 -0
  17. package/components/templates/dynamicfile.template.html +20 -3
  18. package/css/app.css +5 -0
  19. package/css/fonts/nunito/nunito.css +270 -0
  20. package/css/themes/custom/aquamarine/custom-aquamarine.css +24 -10
  21. package/css/themes/custom/cerulean/custom-cerulean.css +1 -0
  22. package/css/themes/custom/cosmo/custom-cosmo.css +16 -16
  23. package/css/themes/custom/cosmo/panel-cosmo.css +1 -1
  24. package/css/themes/custom/cyborg/button-cyborg.css +67 -3
  25. package/css/themes/custom/cyborg/custom-cyborg.css +250 -69
  26. package/css/themes/custom/cyborg/navbar-cyborg.css +4 -4
  27. package/css/themes/custom/cyborg/panel-cyborg.css +6 -7
  28. package/css/themes/custom/darkly/custom-darkly.css +1 -8
  29. package/css/themes/custom/dsgov/button-dsgov.css +0 -1
  30. package/css/themes/custom/dsgov/custom-dsgov.css +12 -1
  31. package/css/themes/custom/dsgov/table-grid-dsgov.css +14 -9
  32. package/css/themes/custom/flatly/custom-flatly.css +1 -0
  33. package/css/themes/custom/fuse/custom-fuse.css +15 -19
  34. package/css/themes/custom/journal/custom-journal.css +1 -0
  35. package/css/themes/custom/krypton/custom-krypton.css +991 -236
  36. package/css/themes/custom/krypton/grid-krypton.css +253 -66
  37. package/css/themes/custom/krypton/navbar-krypton.css +13 -12
  38. package/css/themes/custom/krypton/panel-krypton.css +29 -26
  39. package/css/themes/custom/lumen/button-lumen.css +8 -8
  40. package/css/themes/custom/lumen/custom-lumen.css +46 -34
  41. package/css/themes/custom/lumen/navbar-lumen.css +1 -1
  42. package/css/themes/custom/lumen/panel-lumen.css +17 -13
  43. package/css/themes/custom/material/custom-material.css +12 -1
  44. package/css/themes/custom/material/grid-material.css +1 -1
  45. package/css/themes/custom/material/navbar-material.css +13 -0
  46. package/css/themes/custom/material-round/custom-material-round.css +187 -34
  47. package/css/themes/custom/material-round/grid-material-round.css +174 -18
  48. package/css/themes/custom/materialui/custom-materialui.css +1 -0
  49. package/css/themes/custom/nature/custom-nature.css +2131 -0
  50. package/css/themes/custom/nature/grid-nature.css +396 -0
  51. package/css/themes/custom/nature/navbar-nature.css +98 -0
  52. package/css/themes/custom/nature/panel-nature.css +72 -0
  53. package/css/themes/custom/navigator/custom-navigator.css +80 -21
  54. package/css/themes/custom/paper/custom-paper.css +284 -27
  55. package/css/themes/custom/readable/button-readable.css +61 -1
  56. package/css/themes/custom/readable/custom-readable.css +242 -26
  57. package/css/themes/custom/readable/navbar-readable.css +1 -2
  58. package/css/themes/custom/readable/panel-readable.css +6 -8
  59. package/css/themes/custom/sandstone/button-sandstone.css +12 -0
  60. package/css/themes/custom/sandstone/custom-sandstone.css +1 -0
  61. package/css/themes/custom/simplex/custom-simplex.css +1 -0
  62. package/css/themes/custom/slate/custom-slate.css +4 -3
  63. package/css/themes/custom/spacelab/custom-spacelab.css +1 -0
  64. package/css/themes/custom/superhero/button-superhero.css +1 -1
  65. package/css/themes/custom/superhero/custom-superhero.css +348 -45
  66. package/css/themes/custom/superhero/navbar-superhero.css +5 -1
  67. package/css/themes/custom/superhero/panel-superhero.css +4 -5
  68. package/css/themes/custom/superhero/tabs-superhero.css +1 -1
  69. package/css/themes/custom/theme-general/button.css +4 -0
  70. package/css/themes/custom/theme-general/menu-vertical-retratil.css +35 -23
  71. package/css/themes/custom/theme-general/menu.css +10 -2
  72. package/css/themes/custom/theme-general/table-grid.css +14 -2
  73. package/css/themes/custom/theme-general/theme-general.css +30 -0
  74. package/css/themes/custom/united/custom-united.css +1 -0
  75. package/css/themes/custom/yeti/custom-yeti.css +1 -0
  76. package/css/themes/nature.min.css +9 -0
  77. package/dist/components/js/format.min.js +1 -1
  78. package/dist/components/js/jquery.inputmask.bundle.js +1 -1
  79. package/dist/components/js/jquery.mask.min.js +1 -1
  80. package/dist/components/templates/Component_Container/crn-eight-four-container.template.html +1 -1
  81. package/dist/components/templates/Component_Container/crn-four-eight-container.template.html +1 -1
  82. package/dist/components/templates/Component_Container/crn-one-container.template.html +1 -1
  83. package/dist/components/templates/Component_Container/crn-three-container.template.html +1 -1
  84. package/dist/components/templates/Component_Container/crn-three-six-three-container.template.html +1 -1
  85. package/dist/components/templates/Component_Container/crn-two-container.template.html +1 -1
  86. package/dist/components/templates/cron-autocomplete.designtime.html +1 -1
  87. package/dist/components/templates/cron-combobox-multiple.template.html +1 -1
  88. package/dist/components/templates/cron-grid.designtime.html +1 -1
  89. package/dist/components/templates/dynamicfile.designtime.html +1 -0
  90. package/dist/components/templates/dynamicfile.template.html +1 -1
  91. package/dist/css/app.css +1 -1
  92. package/dist/css/themes/custom/aquamarine/custom-aquamarine.css +1 -1
  93. package/dist/css/themes/custom/cerulean/custom-cerulean.css +1 -1
  94. package/dist/css/themes/custom/cosmo/custom-cosmo.css +1 -1
  95. package/dist/css/themes/custom/cosmo/panel-cosmo.css +1 -1
  96. package/dist/css/themes/custom/cyborg/button-cyborg.css +1 -1
  97. package/dist/css/themes/custom/cyborg/custom-cyborg.css +1 -1
  98. package/dist/css/themes/custom/cyborg/navbar-cyborg.css +1 -1
  99. package/dist/css/themes/custom/cyborg/panel-cyborg.css +1 -1
  100. package/dist/css/themes/custom/darkly/custom-darkly.css +1 -1
  101. package/dist/css/themes/custom/dsgov/button-dsgov.css +1 -1
  102. package/dist/css/themes/custom/dsgov/custom-dsgov.css +1 -1
  103. package/dist/css/themes/custom/dsgov/table-grid-dsgov.css +1 -1
  104. package/dist/css/themes/custom/flatly/custom-flatly.css +1 -1
  105. package/dist/css/themes/custom/fuse/custom-fuse.css +1 -1
  106. package/dist/css/themes/custom/journal/custom-journal.css +1 -1
  107. package/dist/css/themes/custom/krypton/custom-krypton.css +1 -1
  108. package/dist/css/themes/custom/krypton/grid-krypton.css +1 -1
  109. package/dist/css/themes/custom/krypton/navbar-krypton.css +1 -1
  110. package/dist/css/themes/custom/krypton/panel-krypton.css +1 -1
  111. package/dist/css/themes/custom/lumen/button-lumen.css +1 -1
  112. package/dist/css/themes/custom/lumen/custom-lumen.css +1 -1
  113. package/dist/css/themes/custom/lumen/navbar-lumen.css +1 -1
  114. package/dist/css/themes/custom/lumen/panel-lumen.css +1 -1
  115. package/dist/css/themes/custom/material/custom-material.css +1 -1
  116. package/dist/css/themes/custom/material/grid-material.css +1 -1
  117. package/dist/css/themes/custom/material/navbar-material.css +1 -1
  118. package/dist/css/themes/custom/material-round/custom-material-round.css +1 -1
  119. package/dist/css/themes/custom/material-round/grid-material-round.css +1 -1
  120. package/dist/css/themes/custom/materialui/custom-materialui.css +1 -1
  121. package/dist/css/themes/custom/nature/custom-nature.css +1 -0
  122. package/dist/css/themes/custom/nature/grid-nature.css +1 -0
  123. package/dist/css/themes/custom/nature/navbar-nature.css +1 -0
  124. package/dist/css/themes/custom/nature/panel-nature.css +1 -0
  125. package/dist/css/themes/custom/navigator/custom-navigator.css +1 -1
  126. package/dist/css/themes/custom/paper/custom-paper.css +1 -1
  127. package/dist/css/themes/custom/readable/button-readable.css +1 -1
  128. package/dist/css/themes/custom/readable/custom-readable.css +1 -1
  129. package/dist/css/themes/custom/readable/navbar-readable.css +1 -1
  130. package/dist/css/themes/custom/readable/panel-readable.css +1 -1
  131. package/dist/css/themes/custom/sandstone/button-sandstone.css +1 -1
  132. package/dist/css/themes/custom/sandstone/custom-sandstone.css +1 -1
  133. package/dist/css/themes/custom/simplex/custom-simplex.css +1 -1
  134. package/dist/css/themes/custom/slate/custom-slate.css +1 -1
  135. package/dist/css/themes/custom/spacelab/custom-spacelab.css +1 -1
  136. package/dist/css/themes/custom/superhero/button-superhero.css +1 -1
  137. package/dist/css/themes/custom/superhero/custom-superhero.css +1 -1
  138. package/dist/css/themes/custom/superhero/navbar-superhero.css +1 -1
  139. package/dist/css/themes/custom/superhero/panel-superhero.css +1 -1
  140. package/dist/css/themes/custom/superhero/tabs-superhero.css +1 -1
  141. package/dist/css/themes/custom/theme-general/button.css +1 -1
  142. package/dist/css/themes/custom/theme-general/menu-vertical-retratil.css +1 -1
  143. package/dist/css/themes/custom/theme-general/menu.css +1 -1
  144. package/dist/css/themes/custom/theme-general/table-grid.css +1 -1
  145. package/dist/css/themes/custom/theme-general/theme-general.css +1 -1
  146. package/dist/css/themes/custom/united/custom-united.css +1 -1
  147. package/dist/css/themes/custom/yeti/custom-yeti.css +1 -1
  148. package/dist/css/themes/nature.min.css +1 -0
  149. package/dist/js/app.js +1 -1
  150. package/dist/js/controllers.js +1 -1
  151. package/dist/js/directives.js +17 -12
  152. package/dist/js/reports/reports.service.js +1 -1
  153. package/dist/js/upload.service.js +1 -1
  154. package/js/app.js +5 -4
  155. package/js/controllers.js +43 -25
  156. package/js/directives.js +368 -77
  157. package/js/reports/reports.service.js +5 -5
  158. package/js/upload.service.js +7 -4
  159. package/package.json +1 -1
  160. package/postupdate.json +6 -0
package/js/directives.js CHANGED
@@ -925,6 +925,37 @@
925
925
  }
926
926
  }])
927
927
 
928
+ .directive('screenVariables', [function() {
929
+ 'use strict';
930
+ return {
931
+ link: async function(scope, elem, attrs, ctrl) {
932
+ let screenVariables = eval(attrs.screenVariables);
933
+ if (screenVariables && screenVariables.length) {
934
+ screenVariables.forEach(async (screenVariables) => {
935
+ if (scope.vars && !scope.vars[screenVariables.key]) {
936
+ let value = screenVariables.value || '';
937
+ if (screenVariables.type === 'blockly') {
938
+ value = await scope.$eval(value.replace('.run(','.toPromise().run('));
939
+ }
940
+ else if (screenVariables.type === 'expression') {
941
+ if (value.startsWith('params')) {
942
+ value = scope.params[value.replace('params.','')];
943
+ }
944
+ else if (value.startsWith('vars')) {
945
+ value = scope.vars[value.replace('vars.','')];
946
+ }
947
+ else {
948
+ value = await scope.$eval(value);
949
+ }
950
+ }
951
+ scope.vars[screenVariables.key] = value;
952
+ }
953
+ });
954
+ }
955
+ }
956
+ }
957
+ }])
958
+
928
959
  .directive('mask', maskDirectiveMask)
929
960
 
930
961
  .directive('cronappFilter', function($compile) {
@@ -2688,6 +2719,67 @@
2688
2719
  return attributes;
2689
2720
  }
2690
2721
 
2722
+ function commandClick(e, column) {
2723
+ e.preventDefault();
2724
+ let tr = $(e.target).closest("tr");
2725
+ let grid = tr.closest('table');
2726
+ let itemAsObj = this.dataItem(tr);
2727
+ let item = this.dataItem(tr);
2728
+ let index = $(grid.find('tbody')[0]).children().index(tr);
2729
+ let call = undefined;
2730
+ if (column.dataType == "Customized" || column.dataType == "CustomizedLink" || column.dataType == "GroupedButtons")
2731
+ call = column.execute;
2732
+ else
2733
+ call = generateBlocklyCall(column.blocklyInfo);
2734
+ let cronappDatasource = this.dataSource.transport.options.cronappDatasource;
2735
+ let currentGrid = options.refComponent;
2736
+ let selectedRows = [];
2737
+ currentGrid.select().each(function() {
2738
+ let gridRow = currentGrid.dataItem(this);
2739
+ cronappDatasource.data.forEach(function(dsRow) {
2740
+ if (dsRow.__$id == gridRow.__$id)
2741
+ selectedRows.push(dsRow);
2742
+ });
2743
+ });
2744
+
2745
+ if (!(cronappDatasource.inserting || cronappDatasource.editing)) {
2746
+ let tr = e.currentTarget.parentElement.parentElement;
2747
+ this.select(tr);
2748
+ }
2749
+
2750
+ let selectedRowsKeyOrObj = [];
2751
+ if (options.fieldType && options.fieldType === 'key') {
2752
+ item = helperDirective.changeObjectField(cronappDatasource, cronappDatasource.findObjInDs(item));
2753
+ selectedRows.forEach(row => {
2754
+ selectedRowsKeyOrObj.push(helperDirective.changeObjectField(cronappDatasource, cronappDatasource.findObjInDs(row)));
2755
+ });
2756
+ }
2757
+ else {
2758
+ selectedRowsKeyOrObj = selectedRows;
2759
+ }
2760
+
2761
+ let consolidated = {
2762
+ item: item,
2763
+ index: index
2764
+ }
2765
+
2766
+ let contextVars = {
2767
+ 'currentData': cronappDatasource.data,
2768
+ 'datasource': cronappDatasource.copyWithoutAngularObj(),
2769
+ 'selectedIndex': index,
2770
+ 'index': index,
2771
+ 'selectedRow': item,
2772
+ 'consolidated': consolidated,
2773
+ 'item': item,
2774
+ 'selectedKeys': cronappDatasource.getKeyValues(cronappDatasource.findObjInDs(itemAsObj), true),
2775
+ 'selectedRows': selectedRowsKeyOrObj
2776
+ };
2777
+
2778
+ cronappDatasource.goTo(itemAsObj);
2779
+ scope.$eval(call, contextVars);
2780
+ return;
2781
+ };
2782
+
2691
2783
  var columns = [];
2692
2784
  if (options.columns) {
2693
2785
  options.columns.forEach(function(column) {
@@ -2757,7 +2849,7 @@
2757
2849
  className = 'k-custom-command' + (label ? ' k-button-with-label' : '');
2758
2850
  }
2759
2851
  if (column.theme)
2760
- className += ' ' + column.theme;
2852
+ className += ' btn ' + column.theme;
2761
2853
 
2762
2854
  var tooltip = '';
2763
2855
  if (column.tooltip && column.tooltip.length)
@@ -2769,79 +2861,21 @@
2769
2861
  className += ' ' + classForTooltip;
2770
2862
  }
2771
2863
 
2864
+ let width = column.width;
2865
+ if (width) {
2866
+ width += 'px';
2867
+ }
2868
+
2772
2869
  let idForCommand = app.common.generateId();
2773
2870
  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>`;
2871
+ 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
2872
 
2776
2873
  var addColumn = {
2777
2874
  command: [{
2778
2875
  name: idForCommand,
2779
2876
  template: template,
2780
2877
  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;
2878
+ commandClick.bind(this)(e, column);
2845
2879
  }
2846
2880
  }],
2847
2881
  width: widthDevice.width,
@@ -2852,6 +2886,62 @@
2852
2886
  columns.push(addColumn);
2853
2887
  setIdCommandButton.bind(this)(idForCommand, column.dataType);
2854
2888
  }
2889
+ else if (column.dataType == "GroupedButtons") {
2890
+
2891
+ if (column.buttonColumns && column.buttonColumns.length) {
2892
+
2893
+ let commands = [];
2894
+
2895
+ column.buttonColumns.forEach(function(buttonColumn) {
2896
+ let label = buttonColumn.label == undefined ? '': buttonColumn.label;
2897
+ if (buttonColumn.iconClass && label)
2898
+ label = '&nbsp;' + label;
2899
+
2900
+ let className = 'k-custom-command' + (label ? ' k-button-with-label' : '');
2901
+ if (buttonColumn.theme)
2902
+ className += ' btn ' + buttonColumn.theme;
2903
+
2904
+ let tooltip = '';
2905
+ if (buttonColumn.tooltip && buttonColumn.tooltip.length)
2906
+ tooltip = buttonColumn.tooltip;
2907
+
2908
+ if (tooltip) {
2909
+ let classForTooltip = app.common.generateId();
2910
+ tooltips[classForTooltip] = tooltip;
2911
+ className += ' ' + classForTooltip;
2912
+ }
2913
+
2914
+ let width = buttonColumn.width;
2915
+ if (width) {
2916
+ width += 'px';
2917
+ }
2918
+
2919
+ let idForCommand = app.common.generateId();
2920
+ let ariaLabel = tooltip || label || idForCommand;
2921
+ let template = `<a href class='k-button ${className} k-grid-${idForCommand}' aria-label='${ariaLabel}' style='width:${width}'><span class='${buttonColumn.iconClass}'></span>${label}</a>`;
2922
+
2923
+ let command = {
2924
+ name: idForCommand,
2925
+ template: template,
2926
+ click: function(e) {
2927
+ buttonColumn.dataType = column.dataType;
2928
+ commandClick.bind(this)(e, buttonColumn);
2929
+ }
2930
+ };
2931
+ commands.push(command);
2932
+ });
2933
+
2934
+ var addColumn = {
2935
+ command: commands,
2936
+ width: widthDevice.width,
2937
+ title: column.headerText ? column.headerText: '',
2938
+ hidden: !widthDevice.visible,
2939
+ attributes: getAttributes(column)
2940
+ };
2941
+ columns.push(addColumn);
2942
+ setIdCommandButton.bind(this)(app.common.generateId(), column.dataType);
2943
+ }
2944
+ }
2855
2945
  else if (column.dataType == "Selectable") {
2856
2946
  var checkColumn = {
2857
2947
  selectable: true,
@@ -2989,7 +3079,11 @@
2989
3079
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
2990
3080
  if (!(cronappDatasource.inserting || cronappDatasource.editing)) {
2991
3081
  if (this.selectable) {
3082
+ setToActiveInCronappDataSource.bind(this)(e.data);
2992
3083
  this.select(e.masterRow);
3084
+ if (options.columns.find(c => c.dataType == 'Selectable') !== undefined) {
3085
+ collapseAllExcecptCurrent(this, e.detailRow, e.masterRow);
3086
+ }
2993
3087
  }
2994
3088
  else {
2995
3089
  setToActiveInCronappDataSource.bind(this)(e.data);
@@ -3217,14 +3311,22 @@
3217
3311
  },
3218
3312
  change: function(e) {
3219
3313
  var item = this.dataItem(this.select());
3220
- setToActiveInCronappDataSource.bind(this)(item);
3314
+ if ((options.details && options.details.length == 0) || (!cronapi.internal.hasMethodInCallStack('detailInit'))) {
3315
+ setToActiveInCronappDataSource.bind(this)(item);
3316
+ }
3221
3317
  var cronappDatasource = this.dataSource.transport.options.cronappDatasource;
3222
3318
  if(options.fieldType && options.fieldType === 'key'){
3223
3319
  cronappDatasource.active = helperDirective.changeObjectField(cronappDatasource, cronappDatasource.active);
3224
3320
  }
3321
+
3322
+ let trDetails = this.select().next();
3323
+ let trMasters = this.select();
3324
+
3225
3325
  if (ngModelCtrl) {
3226
3326
  if ("multiple" === options.allowSelectionRowType) {
3227
3327
  let selecteds = [];
3328
+ trDetails = [];
3329
+ trMasters = [];
3228
3330
  this.select().each((i, row)=> {
3229
3331
  let item = this.dataItem(row);
3230
3332
  let objInDs = cronappDatasource.findObjInDs(item, false);
@@ -3234,6 +3336,10 @@
3234
3336
  if (objInDs !== null){
3235
3337
  selecteds.push(objInDs);
3236
3338
  }
3339
+ if (item["_objectKey"] === cronappDatasource.active["_objectKey"]) {
3340
+ trMasters.push(this.select()[i]);
3341
+ trDetails.push(this.select().next()[i]);
3342
+ }
3237
3343
  });
3238
3344
  ngModelCtrl.$setViewValue(selecteds);
3239
3345
  }
@@ -3246,7 +3352,7 @@
3246
3352
  }
3247
3353
  }
3248
3354
  }
3249
- collapseAllExcecptCurrent(this, this.select().next(), this.select());
3355
+ collapseAllExcecptCurrent(this, trDetails, trMasters);
3250
3356
 
3251
3357
  if (attrs && attrs.ngChange) {
3252
3358
  scope.$eval(attrs.ngChange);
@@ -3269,8 +3375,8 @@
3269
3375
  command = 'edit';
3270
3376
  }
3271
3377
 
3272
- let modelName = helperDirective.getModelName(attrs);
3273
- if (item && item["_objectKey"]) {
3378
+ let modelName = helperDirective.getModelName(attrs);
3379
+ if (item && item["_objectKey"]) {
3274
3380
  let key = item["_objectKey"];
3275
3381
  let id = `${modelName}-${command}-${key}`;
3276
3382
  $elem.attr('id', id);
@@ -3445,11 +3551,63 @@
3445
3551
  }
3446
3552
  });
3447
3553
 
3554
+ grid.selectable.userEvents.unbind("select");
3555
+
3448
3556
  });
3449
3557
 
3558
+ let contextMenuId = app.common.generateId();
3559
+ let contextMenuValue = app.common.generateId();
3560
+ let contextMenuClose = app.common.generateId();
3561
+ let contextMenuHtml = $(`<ul id="${contextMenuId}">
3562
+ <li id="copyText">
3563
+ <input id="${contextMenuValue}">
3564
+ <span id="${contextMenuClose}" class="k-icon k-i-close" style="margin-left: 5px;"></span>
3565
+ </li>
3566
+ </ul>`);
3450
3567
  element.html($templateDyn);
3568
+ element.append(contextMenuHtml);
3451
3569
  $compile($templateDyn)(element.scope());
3452
3570
 
3571
+ let contextMenu = $(`#${contextMenuId}`).kendoContextMenu({
3572
+ target: $templateDyn,
3573
+ filter: "td",
3574
+ close: (e) => {
3575
+ if (!closeContextMenu) {
3576
+ e.preventDefault();
3577
+ }
3578
+ },
3579
+ open: (e) => {
3580
+ let cell = e.target;
3581
+ let row = $(cell).parent()[0];
3582
+ let grid = $templateDyn.data("kendoGrid");
3583
+ let itemId = e.item.id;
3584
+
3585
+ let cellText = cell.innerText;
3586
+ if (cellText.length && cellText !== '​') {
3587
+ $(e.item).find(`#${contextMenuValue}`).val(cellText);
3588
+ closeContextMenu = false;
3589
+ }
3590
+ else {
3591
+ let menuRejected = () => {
3592
+ return new Promise((resolve, reject) => {
3593
+ let waiting = setInterval(() => {
3594
+ if ($(`#${contextMenuId}`).is(':visible')) {
3595
+ clearInterval(waiting);
3596
+ $(`#${contextMenuId}`).hide();
3597
+ }
3598
+ });
3599
+ });
3600
+ }
3601
+ menuRejected();
3602
+ }
3603
+ }
3604
+ }).data("kendoContextMenu");
3605
+
3606
+ $(`#${contextMenuClose}`).on("click", (e) => {
3607
+ closeContextMenu = true;
3608
+ contextMenu.close();
3609
+ });
3610
+
3453
3611
  }
3454
3612
  };
3455
3613
  }])
@@ -3531,8 +3689,8 @@
3531
3689
  getAllParent(cronappDatasource, itemResult.d.results[0], ids, resolve, reject);
3532
3690
  },
3533
3691
  beforeSend: (xhr) => {
3534
- if (window.uToken) {
3535
- xhr.setRequestHeader ("X-AUTH-TOKEN", window.uToken);
3692
+ if (!window.isUsingCookie()) {
3693
+ xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
3536
3694
  }
3537
3695
  },
3538
3696
  error: () => reject(),
@@ -3673,8 +3831,8 @@
3673
3831
  resolve();
3674
3832
  },
3675
3833
  beforeSend: (xhr) => {
3676
- if (window.uToken) {
3677
- xhr.setRequestHeader ("X-AUTH-TOKEN", window.uToken);
3834
+ if (!window.isUsingCookie()) {
3835
+ xhr.setRequestHeader ("X-AUTH-TOKEN", cronapi.util.getUserToken());
3678
3836
  }
3679
3837
  },
3680
3838
  error: () => reject(),
@@ -4175,9 +4333,10 @@
4175
4333
  options.dataBound = attrs.ngDataBound ? function (){scope.$eval(attrs.ngDataBound)}: undefined;
4176
4334
  options.filtering = attrs.ngFiltering ? function (){scope.$eval(attrs.ngFiltering)}: undefined;
4177
4335
  options.open = function(e) {
4178
- if (!dataSourceScreen.fetched || (dataSourceScreen.data.length > combobox.dataSource.data().length)) {
4336
+ if (!dataSourceScreen.fetched || (dataSourceScreen.lastLoadedTime !== combobox.dataSource.lastLoadedTime)) {
4179
4337
  combobox.options.firstLazyRead = true;
4180
4338
  combobox.dataSource.read();
4339
+ combobox.dataSource.lastLoadedTime = dataSourceScreen.lastLoadedTime;
4181
4340
  }
4182
4341
  };
4183
4342
 
@@ -4225,6 +4384,13 @@
4225
4384
 
4226
4385
  this.toComboType(attrs, parent, select, combobox);
4227
4386
 
4387
+ let forcedRefreshModelAt;
4388
+ let canRefresh = () => {
4389
+ let check = performance.now();
4390
+ if (!forcedRefreshModelAt) return true;
4391
+ return check - forcedRefreshModelAt > 2000;
4392
+ };
4393
+
4228
4394
  var forceChangeModel = async function(value) {
4229
4395
 
4230
4396
  $log.debug("forceChangeModel | " + attrs['id'] + " | " + value);
@@ -4331,7 +4497,7 @@
4331
4497
  overRideRefresh: function() {
4332
4498
  dataSourceScreen.fetched = false;
4333
4499
  dataSourceScreen.cleanup();
4334
- defineInitialValue();
4500
+ canRefresh() && defineInitialValue();
4335
4501
  }
4336
4502
  });
4337
4503
  }
@@ -4364,6 +4530,9 @@
4364
4530
  }
4365
4531
 
4366
4532
  _compileAngular(scope, options.combobox.element[0]);
4533
+ if (options?.combobox?.span) {
4534
+ _compileAngular(scope, options.combobox.span);
4535
+ }
4367
4536
  });
4368
4537
 
4369
4538
  }
@@ -4465,6 +4634,10 @@
4465
4634
  });
4466
4635
 
4467
4636
  $("[aria-owns='" + `${attrs.id}_listbox` + "']").attr('aria-label', $translate.instant('template.crud.search'));
4637
+ if (ngModelCtrl.$modelValue) {
4638
+ _scope.cronapi.internal.forceRefreshNgModel(attrs.ngModel, ngModelCtrl.$modelValue);
4639
+ forcedRefreshModelAt = performance.now();
4640
+ }
4468
4641
  }
4469
4642
  };
4470
4643
  })
@@ -5262,6 +5435,87 @@
5262
5435
  return false;
5263
5436
  });
5264
5437
  }
5438
+ $('#checkCollapsibleMenu').on('click', function() {
5439
+ var mainView = document.getElementById("main-view");
5440
+ if (this.checked) {
5441
+ mainView.classList.remove("main-view-retratil");
5442
+ } else {
5443
+ mainView.classList.add("main-view-retratil");
5444
+ }
5445
+ });
5446
+
5447
+ let baseNav = element.closest('nav');
5448
+ if (baseNav && baseNav.length) {
5449
+
5450
+ let subMenuOnHover = !baseNav.hasClass('submenu-click');
5451
+ let baseNavId = baseNav.attr('id');
5452
+
5453
+ if (!baseNavId) {
5454
+ baseNavId = app.common.generateId();
5455
+ baseNav.attr('id', baseNavId);
5456
+ }
5457
+
5458
+ if (subMenuOnHover) {
5459
+ let alreadyHooked = $(`#${baseNavId} .dropdown-submenu`).data('hooked');
5460
+ if (!alreadyHooked) {
5461
+ $(`#${baseNavId} .dropdown-submenu`).on('mouseenter', function (e) {
5462
+ $(this).children('.dropdown-menu').addClass('show');
5463
+ }).on('mouseleave', function (e) {
5464
+ $(this).children('.dropdown-menu').removeClass('show');
5465
+ });
5466
+ $(`#${baseNavId} .dropdown-submenu`).data('hooked', true);
5467
+ }
5468
+
5469
+ }
5470
+ else {
5471
+ let alreayHooked = $(`#${baseNavId} .dropdown-menu a.dropdown-toggle`).data('hooked');
5472
+ if (!alreayHooked) {
5473
+ $(`#${baseNavId} .dropdown-menu a.dropdown-toggle`).on('click', function(e) {
5474
+ if (!$(this).next().hasClass('show')) {
5475
+ $(this).parents('.dropdown-menu').first().find('.show').removeClass('show');
5476
+ }
5477
+ var $subMenu = $(this).next('.dropdown-menu');
5478
+ $subMenu.toggleClass('show');
5479
+
5480
+ $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
5481
+ $('.dropdown-submenu .show').removeClass('show');
5482
+ });
5483
+
5484
+ if ($subMenu.length) {
5485
+ return false;
5486
+ }
5487
+ else {
5488
+ $('.dropdown-menu').removeClass('show');
5489
+ }
5490
+ });
5491
+ $(`#${baseNavId} .dropdown-menu a.dropdown-toggle`).data('hooked', true);
5492
+ }
5493
+
5494
+ let alreadyHookedBs = $(`#${baseNavId} .dropdown.nav-item`).data('hooked');
5495
+ if (!alreadyHookedBs) {
5496
+ $(`#${baseNavId} .dropdown.nav-item`).on('hidden.bs.dropdown', function (e) {
5497
+ $('.dropdown-submenu .show').removeClass("show");
5498
+ $('.dropdown-menu .show').removeClass('show');
5499
+ });
5500
+ $(`#${baseNavId} .dropdown.nav-item`).data('hooked', true);
5501
+ }
5502
+
5503
+ }
5504
+
5505
+ }
5506
+ else {
5507
+ let menuWihtoutNavBar_id = $(element).find('ul:first').attr('id')
5508
+ let alreadyHooked = $(`#${menuWihtoutNavBar_id} .dropdown-submenu`).data('hooked');
5509
+ if (!alreadyHooked) {
5510
+ $(`#${menuWihtoutNavBar_id} .dropdown-submenu`).on('mouseenter', function (e) {
5511
+ $(this).children('.dropdown-menu').addClass('show');
5512
+ }).on('mouseleave', function (e) {
5513
+ $(this).children('.dropdown-menu').removeClass('show');
5514
+ });
5515
+ $(`#${menuWihtoutNavBar_id} .dropdown-submenu`).data('hooked', true);
5516
+ }
5517
+ }
5518
+
5265
5519
  });
5266
5520
  });
5267
5521
  }
@@ -6022,6 +6276,12 @@ function maskDirective($compile, $translate, $parse, attrName) {
6022
6276
  if (type == 'time' || type == 'time-local') {
6023
6277
  momentDate = momentDate.year(1970).dayOfYear(1).month(0);
6024
6278
  }
6279
+ if (typeof value === "string" && (value.length < mask.length)) {
6280
+ let tempValue = formatWithMomentAs(mask, useUTC, value, "string");
6281
+ if (tempValue.startsWith(value) && (value.length < tempValue.length) && (isNaN(tempValue[value.length]) || tempValue[value.length] === " ")) {
6282
+ ngModelCtrl.$$element.val(tempValue.substring(0, value.length + 1));
6283
+ }
6284
+ }
6025
6285
  return momentDate.toDate();
6026
6286
  }
6027
6287
 
@@ -6797,6 +7057,9 @@ app.kendoHelper = {
6797
7057
  self.options.combobox.options.expanded = true;
6798
7058
  }
6799
7059
  e.success(data);
7060
+ if (self?.options?.combobox?.span) {
7061
+ self.options.$compile(self.options.combobox.span)(self.options.scope);
7062
+ }
6800
7063
  self.options.kendoCallback = e;
6801
7064
  if (self.options && self.options.combobox && self.options.combobox.element[0].id) {
6802
7065
  var expToFind = " .k-animation-container";
@@ -7258,6 +7521,33 @@ function cronReportViewer($compile) {
7258
7521
 
7259
7522
  executeReport(attrs.options);
7260
7523
 
7524
+ // Não inicia em em Tab não ativa
7525
+ // Verifica se esta dentro de um tab
7526
+ let elementTab = element[0].parentElement;
7527
+ while (elementTab) {
7528
+ if (elementTab.tagName === "BODY") {
7529
+ elementTab = null;
7530
+ } else if (elementTab.classList.contains("tab-pane")) {
7531
+ break;
7532
+ } else {
7533
+ elementTab = elementTab.parentElement;
7534
+ }
7535
+ }
7536
+ // Se estiver dentro de um tab e esta não estiver ativa, inclui observador para ler o relatorio ao ativar a tab
7537
+ if (elementTab && !elementTab.classList.contains("active")) {
7538
+ let observerClassChange = new MutationObserver(function(mutationsList, observer) {
7539
+ for (let mutation of mutationsList) {
7540
+ if (mutation.attributeName === "class" && mutation.target.classList.contains("active")) {
7541
+ executeReport(attrs.options);
7542
+ // Desconecta observador, pois só precisa ser executado uma vez.
7543
+ observer.disconnect();
7544
+ break;
7545
+ }
7546
+ }
7547
+ });
7548
+ observerClassChange.observe(elementTab, { attributes: true });
7549
+ }
7550
+
7261
7551
  var filterTimeout = null;
7262
7552
  scope.$watch(function(){ return attrs.options }, function(value, old){
7263
7553
  if (value !== old) {
@@ -7276,4 +7566,5 @@ function cronReportViewer($compile) {
7276
7566
 
7277
7567
  }
7278
7568
  };
7279
- }
7569
+ }
7570
+
@@ -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) {