cronapp-lib-js 2.8.4 → 2.8.5

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.
@@ -26,6 +26,7 @@
26
26
  //FIX_025 - CRONAPP-2964 [Câmara] Número 00 não aparece na grade
27
27
  //FIX_026 - CRONAPP-4565 Checkbox acionado ao clicar em botão customizado
28
28
  //FIX_027 - CRONAPP-4621 Permitir validação reativa
29
+ //FIX_028 - CRONAPP-4939 Criar componente breadcumb (Adicionado componente breadcrumb)
29
30
 
30
31
  /**
31
32
  * Kendo UI v2019.1.220 (http://www.telerik.com/kendo-ui)
@@ -28824,6 +28825,376 @@
28824
28825
  }, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {
28825
28826
  (a3 || a2)();
28826
28827
  }));
28828
+
28829
+ //BEGIN FIX_028
28830
+ (function (f, define) {
28831
+ define('kendo.breadcrumb', ['kendo.core'], f);
28832
+ }(function () {
28833
+ var __meta__ = {
28834
+ id: 'breadcrumb',
28835
+ name: 'Breadcrumb',
28836
+ category: 'web',
28837
+ description: 'The Breadcrumb widget displays navigation breadcrumb.',
28838
+ depends: ['core']
28839
+ };
28840
+ (function ($, undefined) {
28841
+ var kendo = window.kendo, Widget = kendo.ui.Widget, extend = $.extend, isPlainObject = $.isPlainObject, proxy = $.proxy, BREADCRUMB = '.kendoBreadcrumb', ARIA_HIDDEN = 'aria-hidden', ARIA_LABEL = 'aria-label', CLICK = 'click', FOCUS = 'focus', BLUR = 'blur', KEYDOWN = 'keydown', CHANGE = 'change', DOT = '.';
28842
+ var breadcrumbStyles = {
28843
+ widget: 'k-widget k-breadcrumb',
28844
+ overlay: 'k-breadcrumb-container',
28845
+ textbox: 'k-textbox',
28846
+ link: 'k-breadcrumb-link',
28847
+ item: 'k-breadcrumb-item',
28848
+ delimiter: 'k-breadcrumb-delimiter-icon',
28849
+ rootItem: 'k-breadcrumb-root-item',
28850
+ rootLink: 'k-breadcrumb-root-link',
28851
+ overflowIcon: 'k-breadcrumb-overflow-icon',
28852
+ focused: 'k-state-focused',
28853
+ hidden: 'k-hidden',
28854
+ inputWrapper: 'k-breadcrumb-input-container'
28855
+ };
28856
+ var Breadcrumb = Widget.extend({
28857
+ init: function (element, options) {
28858
+ var that = this;
28859
+ options = options || {};
28860
+ Widget.fn.init.call(that, element, options);
28861
+ that._wrapper();
28862
+ if (options.editable) {
28863
+ that._editable();
28864
+ that._tabindex();
28865
+ }
28866
+ that.wrapper.on(CLICK + BREADCRUMB, 'a:not(.k-state-disabled)', proxy(that._click, that));
28867
+ if (options.value || options.bindToLocation || !options.items) {
28868
+ that._value();
28869
+ } else if (options.items) {
28870
+ that.items(options.items);
28871
+ }
28872
+ that._resizeHandler = kendo.onResize(function () {
28873
+ that.resize(true);
28874
+ });
28875
+ },
28876
+ options: {
28877
+ editable: false,
28878
+ navigational: false,
28879
+ bindToLocation: false,
28880
+ items: null,
28881
+ name: 'Breadcrumb',
28882
+ gap: 0,
28883
+ rootIcon: 'home',
28884
+ delimiterIcon: 'arrow-chevron-right',
28885
+ messages: { rootTitle: 'Go to root' }
28886
+ },
28887
+ events: [
28888
+ CHANGE,
28889
+ CLICK
28890
+ ],
28891
+ destroy: function () {
28892
+ var that = this;
28893
+ Widget.fn.destroy.call(that);
28894
+ kendo.unbindResize(that._resizeHandler);
28895
+ that.wrapper.add(that.wrapper.find('input')).add(that.wrapper.find('a')).off(BREADCRUMB);
28896
+ },
28897
+ items: function (items) {
28898
+ var that = this;
28899
+ if (items === undefined) {
28900
+ return that.options.items;
28901
+ }
28902
+ that.options.items = items;
28903
+ that._segments = items;
28904
+ that.refresh();
28905
+ },
28906
+ _update: function (val) {
28907
+ var that = this;
28908
+ if (val !== that.value()) {
28909
+ that._generateSegments(val);
28910
+ that.refresh();
28911
+ that.trigger(CHANGE, {
28912
+ sender: this,
28913
+ value: val
28914
+ });
28915
+ }
28916
+ },
28917
+ _generateSegments: function (value) {
28918
+ var that = this, options = that.options, items = options.items, path, segments;
28919
+ segments = that._split(value);
28920
+ if (!items) {
28921
+ that.options.items = that._segments = segments;
28922
+ return;
28923
+ }
28924
+ that._segments = [];
28925
+ for (var i = 0; i < segments.length; i++) {
28926
+ path = that._path(items.slice(0, i + 1));
28927
+ if (path !== '' && value.indexOf(path) > -1 && items[i] && items[i].text === segments[i]) {
28928
+ that._segments.push(items[i]);
28929
+ } else {
28930
+ that._segments.push(segments[i]);
28931
+ }
28932
+ }
28933
+ },
28934
+ _click: function (e) {
28935
+ var that = this, options = that.options, item = $(e.target).closest(DOT + breadcrumbStyles.item), previousDomItems = item.prevAll().addBack(), previousItems = that._getItems(previousDomItems), path = that._path(previousItems), segment = that._segments[item.index()];
28936
+ if (!options.navigational) {
28937
+ e.preventDefault();
28938
+ }
28939
+ if (!that.trigger(CLICK, {
28940
+ sender: that,
28941
+ originalEvent: e,
28942
+ isRoot: segment.type === 'rootitem',
28943
+ item: segment
28944
+ })) {
28945
+ that._update(path);
28946
+ }
28947
+ },
28948
+ _getItems: function (items) {
28949
+ var that = this;
28950
+ return $.map(items, function (item) {
28951
+ return that._segments[$(item).index()] || item.innerText;
28952
+ });
28953
+ },
28954
+ _edit: function () {
28955
+ var that = this, input = that.input;
28956
+ that.oldValue = that.value();
28957
+ that.inputWrapper.css('height', that.wrapper.height());
28958
+ that.overlay.hide();
28959
+ that.input.val(that.value());
28960
+ that.input.attr(ARIA_HIDDEN, false);
28961
+ that.inputWrapper.show();
28962
+ setTimeout(function () {
28963
+ input.select();
28964
+ });
28965
+ },
28966
+ _blur: function (shouldRestoreValue) {
28967
+ var that = this, input = that.input, inputWrapper = that.inputWrapper, wrapper = that.wrapper, overlay = that.overlay, val = input.val().replace(/\/{2,}/g, '/');
28968
+ if (overlay.is(':visible')) {
28969
+ return;
28970
+ }
28971
+ if (shouldRestoreValue) {
28972
+ val = that.oldValue;
28973
+ }
28974
+ input.attr(ARIA_HIDDEN, true);
28975
+ inputWrapper.hide();
28976
+ overlay.show();
28977
+ input.val('');
28978
+ that._update(val);
28979
+ wrapper.removeClass(breadcrumbStyles.focused);
28980
+ },
28981
+ _keydown: function (e) {
28982
+ var that = this, key = e.keyCode, isEnter = key === kendo.keys.ENTER, isEsc = key === kendo.keys.ESC;
28983
+ if (isEnter || isEsc) {
28984
+ that._blur(isEsc);
28985
+ setTimeout(function () {
28986
+ that.overlay.find('a').first().trigger('focus');
28987
+ });
28988
+ }
28989
+ },
28990
+ isNavigational: function (target) {
28991
+ var canNavigate = target.hasClass(breadcrumbStyles.textbox) || target.closest(DOT + breadcrumbStyles.item);
28992
+ if (target[0] === this.wrapper[0]) {
28993
+ return false;
28994
+ }
28995
+ return canNavigate && !target.hasClass('k-breadcrumb-last-item');
28996
+ },
28997
+ _wrapperKeydown: function (ev) {
28998
+ var that = this, target = $(ev.target), isNavigational = that.isNavigational(target);
28999
+ if (ev.keyCode === kendo.keys.ENTER && !isNavigational) {
29000
+ that._edit();
29001
+ }
29002
+ },
29003
+ _wrapperClick: function (ev) {
29004
+ var that = this, target = $(ev.target), isNavigational = that.isNavigational(target);
29005
+ if (!isNavigational) {
29006
+ this._edit();
29007
+ }
29008
+ },
29009
+ _wrapperFocus: function (ev) {
29010
+ $(ev.target).addClass(breadcrumbStyles.focused);
29011
+ },
29012
+ _wrapperBlur: function (ev) {
29013
+ $(ev.target).removeClass(breadcrumbStyles.focused);
29014
+ },
29015
+ _wrapper: function () {
29016
+ var that = this, element = this.element, elementIsInput = element.is('input');
29017
+ that.wrapper = elementIsInput ? element.wrap($('<nav />')).parent() : element;
29018
+ if (elementIsInput) {
29019
+ that.element.wrap($('<div />').addClass(breadcrumbStyles.inputWrapper)).addClass(breadcrumbStyles.textbox).parent().hide();
29020
+ that.inputWrapper = that.wrapper.find(DOT + breadcrumbStyles.inputWrapper);
29021
+ } else {
29022
+ that.inputWrapper = that.wrapper.append($('<div />').addClass(breadcrumbStyles.inputWrapper)).find(DOT + breadcrumbStyles.inputWrapper).hide();
29023
+ }
29024
+ that.wrapper.addClass(breadcrumbStyles.widget);
29025
+ that.wrapper.attr(ARIA_LABEL, 'Breadcrumb');
29026
+ that.overlay = that.wrapper.append($('<ol />').addClass(breadcrumbStyles.overlay)).find(DOT + breadcrumbStyles.overlay);
29027
+ },
29028
+ _editable: function () {
29029
+ var that = this, element = that.element, elementIsInput = element.is('input');
29030
+ if (elementIsInput) {
29031
+ that.input = that.element;
29032
+ } else {
29033
+ that.input = $('<input />');
29034
+ }
29035
+ that.inputWrapper.append(that.input);
29036
+ that.input.addClass(breadcrumbStyles.textbox).attr(ARIA_HIDDEN, true);
29037
+ that.input.on(BLUR + BREADCRUMB, proxy(that._blur, that, false)).on(KEYDOWN + BREADCRUMB, proxy(that._keydown, that));
29038
+ that.wrapper.on(FOCUS + BREADCRUMB, proxy(that._wrapperFocus, that)).on(BLUR + BREADCRUMB, proxy(that._wrapperBlur, that)).on(KEYDOWN + BREADCRUMB, proxy(that._wrapperKeydown, that)).on(CLICK + BREADCRUMB, proxy(that._wrapperClick, that));
29039
+ },
29040
+ _value: function () {
29041
+ var that = this, options = that.options;
29042
+ if (options.value) {
29043
+ that.value(options.value);
29044
+ } else if (options.bindToLocation) {
29045
+ that.value(window.location.href.replace(/http(s?):\/\//, '').replace(/\/$/, ''));
29046
+ } else {
29047
+ that.value('');
29048
+ }
29049
+ },
29050
+ _split: function (value) {
29051
+ return value.split('/').filter(function (item, index) {
29052
+ if (index > 0 && item === '') {
29053
+ return false;
29054
+ }
29055
+ return true;
29056
+ });
29057
+ },
29058
+ isRtl: function () {
29059
+ return kendo.support.isRtl(this.wrapper);
29060
+ },
29061
+ refresh: function () {
29062
+ var that = this, options = that.options, messages = options.messages, delimiterIcon = that.options.delimiterIcon, html = '', href = '', isOnlyRoot = that.value() === '', segments = that._segments, segment, idx, length, isLastSegment;
29063
+ if (delimiterIcon == 'arrow-chevron-right' && that.isRtl()) {
29064
+ delimiterIcon = 'arrow-chevron-left';
29065
+ }
29066
+ for (idx = 0, length = segments.length; idx < length; idx++) {
29067
+ segment = segments[idx];
29068
+ isLastSegment = idx === segments.length - 1;
29069
+ if (segment !== undefined) {
29070
+ if (!html) {
29071
+ href = '/';
29072
+ } else {
29073
+ href += segment.text || segment || '';
29074
+ }
29075
+ if (typeof segment === 'string') {
29076
+ segment = {
29077
+ type: !html ? 'rootitem' : 'item',
29078
+ href: options.navigational ? href : '#',
29079
+ text: segment,
29080
+ showIcon: !html,
29081
+ showText: !!html,
29082
+ icon: !html ? options.rootIcon : '',
29083
+ itemClass: !html ? 'k-breadcrumb-root-item' : '',
29084
+ linkClass: !html ? breadcrumbStyles.rootLink : '',
29085
+ delimiterIcon: delimiterIcon,
29086
+ renderDelimiter: !isLastSegment && !isOnlyRoot,
29087
+ lastSegment: isLastSegment,
29088
+ iconClass: ''
29089
+ };
29090
+ that._segments.splice(idx, 1, segment);
29091
+ } else if (isPlainObject(segment)) {
29092
+ segment = extend({}, segment, { type: segment.type ? segment.type.toLowerCase() : 'item' });
29093
+ segment = extend({}, segment, {
29094
+ text: segment.text || '',
29095
+ title: segment.text || '',
29096
+ icon: segment.icon || (segment.type === 'rootitem' ? options.rootIcon : ''),
29097
+ iconClass: segment.iconClass || '',
29098
+ lastSegment: isLastSegment,
29099
+ renderDelimiter: !isLastSegment && segments.length > 1,
29100
+ href: options.navigational ? segment.href : '#',
29101
+ delimiterIcon: delimiterIcon,
29102
+ itemClass: segment.itemClass || '',
29103
+ linkClass: segment.linkClass || '',
29104
+ showIcon: segment.showIcon === undefined ? segment.type === 'rootitem' && segment.type !== 'item' : segment.showIcon,
29105
+ showText: segment.showText === undefined ? segment.type === 'item' && segment.type !== 'rootitem' : segment.showText
29106
+ });
29107
+ if (segment.type === 'rootitem') {
29108
+ segment.itemClass += ' k-breadcrumb-root-item';
29109
+ segment.linkClass += ' ' + breadcrumbStyles.rootLink;
29110
+ }
29111
+ }
29112
+ if (segment.type === 'rootitem' && segment.text === '') {
29113
+ segment.title = messages.rootTitle;
29114
+ }
29115
+ href += href.match(/\/$/) ? '' : '/';
29116
+ html += kendo.template(this.itemTemplate)(segment);
29117
+ }
29118
+ }
29119
+ this.overlay.empty().append($(html));
29120
+ this.resize(true);
29121
+ },
29122
+ itemTemplate: '<li class="k-breadcrumb-item #:itemClass# #if(lastSegment){#k-breadcrumb-last-item#}#">' + '<a href="#:href#" class="#:linkClass# ' + '#if(type !== "rootitem"){# k-breadcrumb-link#}#' + '#if(showText && showIcon){# k-breadcrumb-icontext-link#}#' + '#if(showIcon && !showText){# k-breadcrumb-icon-link#}#' + '#if(lastSegment && type !== "rootitem"){# k-state-disabled#}#"' + '#if(lastSegment){# aria-current="page"#}# title="#:text || title#">' + '#if(showIcon) {#' + '<span class="#if(icon){#k-icon k-i-#:icon##}# #:iconClass#"></span>' + '#}#' + '#if(showText) {#' + '#:text#' + '#}#' + '</a>' + '#if(renderDelimiter) {#' + '<span class="k-breadcrumb-delimiter-icon k-icon k-i-#:delimiterIcon#" aria-hidden="true"></span>' + '#}#' + '#if(type === "rootitem" && renderDelimiter) {#' + '<span class="k-breadcrumb-delimiter-icon k-hidden k-icon k-i-#:delimiterIcon#" aria-hidden="true"></span>' + '#}#' + '</li>',
29123
+ _displayOverflowIcons: function (visible) {
29124
+ var that = this, rootItem = that.wrapper.find(DOT + breadcrumbStyles.rootItem);
29125
+ if (visible) {
29126
+ rootItem.find(DOT + breadcrumbStyles.delimiter).addClass(breadcrumbStyles.overflowIcon).removeClass(breadcrumbStyles.hidden);
29127
+ } else {
29128
+ rootItem.find(DOT + breadcrumbStyles.overflowIcon).removeClass(breadcrumbStyles.overflowIcon).last().addClass(breadcrumbStyles.hidden);
29129
+ }
29130
+ },
29131
+ _shrinkItems: function () {
29132
+ var that = this, wrapper = that.wrapper, overlay = that.overlay, items = that.overlay.find(DOT + breadcrumbStyles.item + ':visible:not(.k-breadcrumb-root-item)'), availableWidth = wrapper.width() - that.options.gap, item;
29133
+ if (items.length == 1) {
29134
+ return;
29135
+ }
29136
+ for (var i = 0; i < items.length; i += 1) {
29137
+ item = $(items[i]);
29138
+ if (kendo._outerWidth(overlay) >= availableWidth) {
29139
+ if (i == items.length - 1) {
29140
+ break;
29141
+ }
29142
+ item.hide();
29143
+ that._displayOverflowIcons(true);
29144
+ }
29145
+ }
29146
+ },
29147
+ _showItem: function (item, overlayWidth, availableWidth) {
29148
+ if (item.length && availableWidth > overlayWidth + kendo._outerWidth(item, true)) {
29149
+ item.show();
29150
+ return true;
29151
+ }
29152
+ return false;
29153
+ },
29154
+ _stretchItems: function () {
29155
+ var that = this, wrapper = that.wrapper, overlay = that.overlay, items = that.overlay.find(DOT + breadcrumbStyles.item + ':hidden:not(.k-breadcrumb-root-item)'), availableWidth = wrapper.width() - that.options.gap, item, overlayWidth;
29156
+ if (!items.length) {
29157
+ that._displayOverflowIcons(false);
29158
+ }
29159
+ for (var i = items.length - 1; i >= 0; i--) {
29160
+ item = $(items[i]);
29161
+ overlayWidth = kendo._outerWidth(overlay);
29162
+ if (overlayWidth > availableWidth || !this._showItem(item, overlayWidth, availableWidth)) {
29163
+ break;
29164
+ }
29165
+ }
29166
+ },
29167
+ _resize: function () {
29168
+ this._shrinkItems();
29169
+ this._stretchItems();
29170
+ },
29171
+ getSize: function () {
29172
+ return kendo.dimensions(this.wrapper);
29173
+ },
29174
+ value: function (val) {
29175
+ var that = this;
29176
+ if (val !== undefined) {
29177
+ that._generateSegments(val);
29178
+ that.refresh();
29179
+ return;
29180
+ }
29181
+ return that._path(that._segments);
29182
+ },
29183
+ _path: function (trail) {
29184
+ return $.map(trail, function (b) {
29185
+ var text = isPlainObject(b) ? b.text : b;
29186
+ return text === '/' ? '' : text;
29187
+ }).join('/');
29188
+ }
29189
+ });
29190
+ kendo.ui.plugin(Breadcrumb);
29191
+ }(window.kendo.jQuery));
29192
+ return window.kendo;
29193
+ }, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {
29194
+ (a3 || a2)();
29195
+ }));
29196
+ //END FIX_028
29197
+
28827
29198
  (function (f, define) {
28828
29199
  define('kendo.switch', ['kendo.core'], f);
28829
29200
  }(function () {