cronapp-framework-js 2.9.3 → 2.9.4

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 (76) hide show
  1. package/components/crn-datepicker.components.json +5 -0
  2. package/components/crn-datetimepicker.components.json +5 -0
  3. package/components/crn-enterprise-combobox.components.json +19 -2
  4. package/components/crn-infinite-scroll.components.json +29 -0
  5. package/components/crn-navbar.components.json +33 -1
  6. package/components/crn-textinputicon.components.json +0 -26
  7. package/components/templates/date.template.html +2 -2
  8. package/components/templates/textinputicon.template.html +1 -1
  9. package/components/upload/upload.html +1 -1
  10. package/css/app.css +4 -0
  11. package/css/themes/custom/aquamarine/custom-aquamarine.css +2 -20
  12. package/css/themes/custom/cerulean/custom-cerulean.css +1 -28
  13. package/css/themes/custom/cosmo/custom-cosmo.css +0 -27
  14. package/css/themes/custom/cyborg/custom-cyborg.css +0 -27
  15. package/css/themes/custom/cyborg/navbar-cyborg.css +6 -0
  16. package/css/themes/custom/darkly/custom-darkly.css +0 -25
  17. package/css/themes/custom/dsgov/form-dsgov.css +0 -19
  18. package/css/themes/custom/flatly/custom-flatly.css +2 -22
  19. package/css/themes/custom/fuse/custom-fuse.css +6 -33
  20. package/css/themes/custom/journal/custom-journal.css +2 -28
  21. package/css/themes/custom/lumen/custom-lumen.css +0 -43
  22. package/css/themes/custom/lumen/navbar-lumen.css +9 -0
  23. package/css/themes/custom/paper/custom-paper.css +0 -30
  24. package/css/themes/custom/paper/navbar-paper.css +11 -0
  25. package/css/themes/custom/readable/custom-readable.css +0 -27
  26. package/css/themes/custom/sandstone/custom-sandstone.css +0 -26
  27. package/css/themes/custom/simplex/custom-simplex.css +0 -27
  28. package/css/themes/custom/slate/custom-slate.css +33 -33
  29. package/css/themes/custom/spacelab/custom-spacelab.css +0 -27
  30. package/css/themes/custom/superhero/custom-superhero.css +0 -27
  31. package/css/themes/custom/theme-general/forms.css +7 -42
  32. package/css/themes/custom/theme-general/menu-vertical-retratil.css +130 -0
  33. package/css/themes/custom/theme-general/theme-general.css +1 -0
  34. package/css/themes/custom/united/custom-united.css +0 -22
  35. package/css/themes/custom/united/navbar-united.css +9 -0
  36. package/css/themes/custom/yeti/custom-yeti.css +0 -28
  37. package/css/themes/custom/yeti/navbar-yeti.css +9 -0
  38. package/dist/components/templates/date.template.html +1 -1
  39. package/dist/components/templates/textinputicon.template.html +1 -1
  40. package/dist/css/app.css +1 -1
  41. package/dist/css/themes/custom/aquamarine/custom-aquamarine.css +1 -1
  42. package/dist/css/themes/custom/cerulean/custom-cerulean.css +1 -1
  43. package/dist/css/themes/custom/cosmo/custom-cosmo.css +1 -1
  44. package/dist/css/themes/custom/cyborg/custom-cyborg.css +1 -1
  45. package/dist/css/themes/custom/cyborg/navbar-cyborg.css +1 -1
  46. package/dist/css/themes/custom/darkly/custom-darkly.css +1 -1
  47. package/dist/css/themes/custom/dsgov/form-dsgov.css +1 -1
  48. package/dist/css/themes/custom/flatly/custom-flatly.css +1 -1
  49. package/dist/css/themes/custom/fuse/custom-fuse.css +1 -1
  50. package/dist/css/themes/custom/journal/custom-journal.css +1 -1
  51. package/dist/css/themes/custom/lumen/custom-lumen.css +1 -1
  52. package/dist/css/themes/custom/lumen/navbar-lumen.css +1 -1
  53. package/dist/css/themes/custom/paper/custom-paper.css +1 -1
  54. package/dist/css/themes/custom/paper/navbar-paper.css +1 -1
  55. package/dist/css/themes/custom/readable/custom-readable.css +1 -1
  56. package/dist/css/themes/custom/sandstone/custom-sandstone.css +1 -1
  57. package/dist/css/themes/custom/simplex/custom-simplex.css +1 -1
  58. package/dist/css/themes/custom/slate/custom-slate.css +1 -1
  59. package/dist/css/themes/custom/spacelab/custom-spacelab.css +1 -1
  60. package/dist/css/themes/custom/superhero/custom-superhero.css +1 -1
  61. package/dist/css/themes/custom/theme-general/forms.css +1 -1
  62. package/dist/css/themes/custom/theme-general/menu-vertical-retratil.css +1 -0
  63. package/dist/css/themes/custom/theme-general/theme-general.css +1 -1
  64. package/dist/css/themes/custom/united/custom-united.css +1 -1
  65. package/dist/css/themes/custom/united/navbar-united.css +1 -1
  66. package/dist/css/themes/custom/yeti/custom-yeti.css +1 -1
  67. package/dist/css/themes/custom/yeti/navbar-yeti.css +1 -1
  68. package/dist/img/cron-icon/crn-infinite-scroll.svg +1 -0
  69. package/dist/js/app.js +1 -1
  70. package/dist/js/controllers.js +1 -1
  71. package/dist/js/directives.js +18 -2
  72. package/img/cron-icon/crn-infinite-scroll.svg +1 -0
  73. package/js/app.js +2 -1
  74. package/js/controllers.js +2 -2
  75. package/js/directives.js +184 -19
  76. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ <svg id="Camada_1" data-name="Camada 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.cls-1{fill:#c9c9c9;}</style></defs><path class="cls-1" d="M20,0H4A4,4,0,0,0,0,4V20a4,4,0,0,0,4,4H20a4,4,0,0,0,4-4V4A4,4,0,0,0,20,0Zm.67,16.67a1.33,1.33,0,0,1,.94,2.27h0l-2.67,2.67h0a1.33,1.33,0,0,1-1.88,0h0l-2.67-2.67h0a1.33,1.33,0,0,1,.94-2.27H16V7.33h-.67a1.33,1.33,0,0,1-.94-2.27h0l2.67-2.67h0a1.33,1.33,0,0,1,1.88,0h0l2.67,2.67h0a1.33,1.33,0,0,1-.94,2.27H20v9.34Z"/></svg>
package/js/app.js CHANGED
@@ -19,7 +19,8 @@ var cronappModules = [
19
19
  'upload.services',
20
20
  'ui.tinymce',
21
21
  'ngCookies',
22
- 'kendo.directives'
22
+ 'kendo.directives',
23
+ 'sync.service'
23
24
  ];
24
25
 
25
26
  if (window.customModules) {
package/js/controllers.js CHANGED
@@ -78,7 +78,7 @@
78
78
 
79
79
  });
80
80
 
81
- app.controller('LoginController', function($controller, $scope, $http, $rootScope, $window, $state, $translate, Notification, ReportService, UploadService, $location, $stateParams, $timeout, $cookies, $templateCache, DashboardService) {
81
+ app.controller('LoginController', function($controller, $scope, $http, $rootScope, $window, $state, $translate, Notification, ReportService, UploadService, $location, $stateParams, $timeout, $cookies, $templateCache, DashboardService, SyncService) {
82
82
 
83
83
  $http.get(window.NotificationProviderOptions.templateUrl, {cache: true})
84
84
  .then((response) => $templateCache.put(window.NotificationProviderOptions.templateUrl, response.data));
@@ -259,7 +259,7 @@
259
259
 
260
260
  });
261
261
 
262
- app.controller('HomeController', function($controller, $scope, $http, $rootScope, $state, $translate, Notification, ReportService, UploadService, $location, $stateParams, $timeout, DashboardService) {
262
+ app.controller('HomeController', function($controller, $scope, $http, $rootScope, $state, $translate, Notification, ReportService, UploadService, $location, $stateParams, $timeout, DashboardService, SyncService) {
263
263
 
264
264
  $scope.$http = $http;
265
265
  $scope.params = $stateParams;
package/js/directives.js CHANGED
@@ -1552,9 +1552,82 @@
1552
1552
  getSchedulerProperties: function(options, datasource, scope) {
1553
1553
  let schedulerStartDate = (options.initialDateStrategy === 'Expression' ? scope.$eval(generateBlocklyCall(options.initialDateBlocklyInfo)) : options.initialDate);
1554
1554
  let lastSearchedPeriod = {start: null, end: null};
1555
+
1555
1556
  let needsToFetchData = function(searchablePeriod) {
1556
1557
  return !angular.equals(lastSearchedPeriod, searchablePeriod);
1557
1558
  };
1559
+
1560
+ let customDaysOfWeek = (e) => {
1561
+ let view = e.sender.view();
1562
+ let alreadyChanged = e.sender.element.find('.k-scheduler-header.k-state-default.changed').length;
1563
+ if (view.name === 'month' && !alreadyChanged && options.useCustomDaysOfWeek) {
1564
+ e.sender.element.find('.k-scheduler-header.k-state-default').html(`<div class="k-scheduler-header k-state-default">
1565
+ <div class="k-scheduler-header-wrap">
1566
+ <table class="k-scheduler-table">
1567
+ <tbody>
1568
+ <tr>
1569
+ <th colspan="1" class="">${options.daysOfWeek.sunday}</th>
1570
+ <th colspan="1" class="">${options.daysOfWeek.monday}</th>
1571
+ <th colspan="1" class="">${options.daysOfWeek.tuesday}</th>
1572
+ <th colspan="1" class="">${options.daysOfWeek.wednesday}</th>
1573
+ <th colspan="1" class="">${options.daysOfWeek.thursday}</th>
1574
+ <th colspan="1" class="">${options.daysOfWeek.friday}</th>
1575
+ <th colspan="1" class="">${options.daysOfWeek.saturday}</th>
1576
+ </tr>
1577
+ </tbody>
1578
+ </table>
1579
+ </div>
1580
+ </div>`);
1581
+ e.sender.element.find('.k-scheduler-header.k-state-default').addClass('changed');
1582
+ }
1583
+ };
1584
+
1585
+ let hookSeeAllEventsClick = (e) => {
1586
+ let alreadyHooked = e.sender.element.find('.k-more-events.k-button.hooked').length;
1587
+
1588
+ if (!alreadyHooked) {
1589
+ let view = e.sender.view();
1590
+ let optionView = options.views.find(v => v.type === view.name);
1591
+ let randomId = app.common.generateId();
1592
+ e.sender.element.find('.k-more-events.k-button').attr('data-id', randomId);
1593
+ let blocklyCall = generateBlocklyCall(optionView.moreEventsBlockly);
1594
+ if (blocklyCall) {
1595
+ handleBlockAfterRender(randomId, (e) => {
1596
+
1597
+ let lastEvent = $(e.currentTarget).prev();
1598
+ let uid = lastEvent.data('uid');
1599
+ let dataLastEvent = options.refComponent.dataItems().find((f) => { return f.uid == uid });
1600
+
1601
+ let contextVars = {
1602
+ scheduleData: {
1603
+ type: 'seeAll',
1604
+ selectedDate: dataLastEvent.start
1605
+ }
1606
+ };
1607
+ scope.$eval(blocklyCall, contextVars);
1608
+ });
1609
+ }
1610
+ e.sender.element.find('.k-more-events.k-button').addClass('hooked');
1611
+ }
1612
+ }
1613
+
1614
+ let handleBlockAfterRender = (randomId, func) => {
1615
+ return new Promise((resolve) => {
1616
+ let waitRender = setInterval(() => {
1617
+ let $objClick = $(`[data-id="${randomId}"]`);
1618
+ if ($objClick.length) {
1619
+ clearInterval(waitRender);
1620
+ $objClick.off('click');
1621
+ $objClick.on('click', (e) => {
1622
+ func(e);
1623
+ e.stopImmediatePropagation();
1624
+ });
1625
+ resolve();
1626
+ }
1627
+ }, 100);
1628
+ });
1629
+ };
1630
+
1558
1631
  let visibleViews = [];
1559
1632
  if(options.views) {
1560
1633
  for(let viewIndex in options.views) {
@@ -1584,7 +1657,6 @@
1584
1657
  }
1585
1658
  }
1586
1659
 
1587
-
1588
1660
  let cronSchedulerProperties = {
1589
1661
  dateHeaderTemplate: kendo.template(`#=kendo.toString(date, ${kendo.culture().name.toLowerCase().includes('pt')?'\'ddd dd/M\'':'\'ddd M/dd\''})#`),
1590
1662
  showWorkHours: options.showWorkHours,
@@ -1621,7 +1693,40 @@
1621
1693
  // An endDate method which returns the end date of the view.
1622
1694
 
1623
1695
  //kendo.format("view:: start: {0:d}; end: {1:d};", view.startDate(), view.endDate())
1624
- },
1696
+ customDaysOfWeek(e);
1697
+ hookSeeAllEventsClick(e);
1698
+ },
1699
+ eventTemplate: (data) => {
1700
+ let contextVars = { scheduleData: data };
1701
+ let getDescriptionContent = (withIfen) => {
1702
+ if (!data.description) return '';
1703
+ return (withIfen? ' - ' : '') + data.description;
1704
+ }
1705
+
1706
+ let randomId = app.common.generateId();
1707
+ let currentView = options.refComponent.view().name;
1708
+ let view = options.views.find(v => v.type === currentView);
1709
+
1710
+ let result = [];
1711
+ result.push(`<div class='k-event-template' data-id='${randomId}'>`);
1712
+
1713
+ if (currentView !== 'agenda') {
1714
+ result.push(`<div class='k-event-title'>${data.title}${view.showDescription? getDescriptionContent(true) :''} </div>`);
1715
+ }
1716
+ else {
1717
+ result.push(`<div class='k-event-title'>${data.title}</div>`);
1718
+ !view.showDescription || result.push(`<div class='k-event-description'>${getDescriptionContent(false)}</div>`);
1719
+ }
1720
+ result.push('</div>');
1721
+
1722
+ let blocklyCall = generateBlocklyCall(view.blockly);
1723
+ if (blocklyCall) {
1724
+ handleBlockAfterRender(randomId, () => {
1725
+ scope.$eval(blocklyCall, contextVars);
1726
+ });
1727
+ }
1728
+ return result.join('');
1729
+ },
1625
1730
  change: (e) => {
1626
1731
  if (e && e.events && e.events.length) {
1627
1732
  this.setDatasourceActiveItem(datasource, e.events[0], 'id');
@@ -1634,7 +1739,7 @@
1634
1739
  if (options && options.allowCustomAction) {
1635
1740
  let container = e.container;
1636
1741
 
1637
- let btnLabel = options.customActionLabel ? options.customActionLabel : $translate.instant(Details);
1742
+ let btnLabel = options.customActionLabel ? options.customActionLabel : $translate.instant('Details');
1638
1743
  /* ACTION: ADD custom button */
1639
1744
  let detailButton = $('<a class="k-button">' + btnLabel + '</a>');
1640
1745
 
@@ -3642,12 +3747,41 @@
3642
3747
  options.close = attrs.ngClose ? function (){scope.$eval(attrs.ngClose)}: undefined;
3643
3748
  options.dataBound = attrs.ngDataBound ? function (){scope.$eval(attrs.ngDataBound)}: undefined;
3644
3749
  options.filtering = attrs.ngFiltering ? function (){scope.$eval(attrs.ngFiltering)}: undefined;
3645
- options.select = attrs.ngSelect ? function (){scope.$eval(attrs.ngSelect);}: undefined;
3646
- options.change = function() {
3647
- _scope.$apply(function () {
3648
- _ngModelCtrl.$setViewValue(this.value());
3649
- }.bind(combobox));
3650
- }
3750
+
3751
+ options.select = attrs.ngSelect ? function (e) {
3752
+ scope.safeApply(() => {
3753
+ var contextVars = {
3754
+ 'selected' : e.dataItem,
3755
+ 'selectedKey' : e.dataItem[options.dataValueField],
3756
+ 'selectedValue' : e.dataItem[options.dataTextField]
3757
+ };
3758
+ scope.$eval(attrs.ngSelect, contextVars);
3759
+ });
3760
+ }: undefined;
3761
+ options.change = attrs.ngChange ? function(e) {
3762
+ var dataItem = this.dataItem();
3763
+ scope.safeApply(() => {
3764
+ if (attrs['ngModel']) {
3765
+ _ngModelCtrl.$$parse(attrs['ngModel']).assign(scope, this.value(), attrs['ngModel'].split("."));
3766
+ }
3767
+ var contextVars = {
3768
+ 'selected' : dataItem,
3769
+ 'selectedKey' : dataItem[options.dataValueField],
3770
+ 'selectedValue' : dataItem[options.dataTextField]
3771
+ };
3772
+ scope.$eval(attrs.ngChange, contextVars);
3773
+ });
3774
+ }: function(e) {
3775
+ scope.safeApply(() => {
3776
+ if (attrs['ngModel']) {
3777
+ _ngModelCtrl.$$parse(attrs['ngModel']).assign(scope, this.value(), attrs['ngModel'].split("."));
3778
+ }
3779
+ });
3780
+ };
3781
+
3782
+ options.messages = {
3783
+ noData: attrs.noResultsMessage ? attrs.noResultsMessage : "NO DATA FOUND"
3784
+ };
3651
3785
 
3652
3786
  var combobox;
3653
3787
  if (select.dontAllowOutsideList === true) {
@@ -3696,23 +3830,13 @@
3696
3830
  var _scope = scope;
3697
3831
  var _ngModelCtrl = ngModelCtrl;
3698
3832
 
3699
- var initializing = true;
3700
3833
  if (ngModelCtrl) {
3701
3834
  ngModelCtrl.$formatters.push(function (value) {
3702
3835
  var result = '';
3703
-
3704
3836
  if ((typeof value === 'boolean') || (value)) {
3705
3837
  result = value;
3706
3838
  }
3707
3839
  combobox.value(result);
3708
-
3709
- if (!initializing) {
3710
- if (attrs.ngChange) scope.$eval(attrs.ngChange);
3711
- }
3712
-
3713
-
3714
- initializing = false;
3715
- combobox.value(result);
3716
3840
  return result;
3717
3841
  });
3718
3842
  ngModelCtrl.$parsers.push(function (value) {
@@ -5662,6 +5786,47 @@
5662
5786
  }
5663
5787
  })
5664
5788
 
5789
+ .directive('crnInfiniteScroll', ['$compile', function($compile){
5790
+ 'use strict';
5791
+ return {
5792
+ restrict: 'EA',
5793
+ link: function(scope, element, attrs) {
5794
+ var dataSource = attrs.crnInfiniteScroll ? eval(attrs.crnInfiniteScroll) : attrs.crnDatasource ? eval(attrs.crnDatasource): undefined;
5795
+ if (dataSource) {
5796
+ let nextPageInfinite = {
5797
+ isVisible: false,
5798
+ checkVisibility: function(visible) {
5799
+ if (nextPageInfinite.isVisible !== visible) {
5800
+ nextPageInfinite.isVisible = visible;
5801
+ if (nextPageInfinite.isVisible) {
5802
+ if (dataSource.loaded && dataSource.loadedFinish) {
5803
+ dataSource.nextPage();
5804
+ } else {
5805
+ let intervalNextPage = setInterval(function() {
5806
+ if (dataSource.loaded && dataSource.loadedFinish) {
5807
+ dataSource.nextPage();
5808
+ clearInterval(intervalNextPage);
5809
+ }
5810
+ }, 250);
5811
+ }
5812
+ }
5813
+ }
5814
+ },
5815
+ eventScroll: function() {
5816
+ var topElem = element.offset().top;
5817
+ var botElem = element.offset().top + element.outerHeight();
5818
+ var botScrn = $(window).scrollTop() + $(window).innerHeight();
5819
+ var topScrn = $(window).scrollTop();
5820
+ nextPageInfinite.checkVisibility((botScrn > topElem) && (topScrn < botElem));
5821
+ }
5822
+ };
5823
+ $(window).scroll(nextPageInfinite.eventScroll);
5824
+ $(window).ready(nextPageInfinite.eventScroll);
5825
+ }
5826
+ }
5827
+ }
5828
+ }])
5829
+
5665
5830
  }(app));
5666
5831
 
5667
5832
  function maskDirectiveAsDate($compile, $translate, $parse) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cronapp-framework-js",
3
- "version": "2.9.3",
3
+ "version": "2.9.4",
4
4
  "description": "Javascript library for CronApp's projects",
5
5
  "main": "cronapp.framework.js",
6
6
  "scripts": {