11/*!
2- angular-xeditable - 0.6 .0
2+ angular-xeditable - 0.7 .0
33Edit-in-place for angular.js
4- Build date: 2016-12-27
4+ Build date: 2017-03-24
55*/
66/**
77 * Angular-xeditable module
@@ -171,10 +171,11 @@ angular.module('xeditable').directive('editableBsdate', ['editableDirectiveFacto
171171 [ 'eClearText' , 'clear-text' ] ,
172172 [ 'eCloseText' , 'close-text' ] ,
173173 [ 'eCloseOnDateSelection' , 'close-on-date-selection' ] ,
174- [ 'eDatePickerAppendToBody ' , 'datepicker-append-to-body' ] ,
174+ [ 'eDatepickerAppendToBody ' , 'datepicker-append-to-body' ] ,
175175 [ 'eOnOpenFocus' , 'on-open-focus' ] ,
176176 [ 'eName' , 'name' ] ,
177- [ 'eDateDisabled' , 'date-disabled' ]
177+ [ 'eDateDisabled' , 'date-disabled' ] ,
178+ [ 'eAltInputFormats' , 'alt-input-formats' ]
178179 ] ;
179180
180181 var dateOptionsNames = [
@@ -281,6 +282,7 @@ angular.module('xeditable').directive('editableBsdate', ['editableDirectiveFacto
281282 }
282283 } ) ;
283284} ] ) ;
285+
284286/*
285287Angular-ui bootstrap editable timepicker
286288http://angular-ui.github.io/bootstrap/#/timepicker
@@ -289,7 +291,7 @@ angular.module('xeditable').directive('editableBstime', ['editableDirectiveFacto
289291 function ( editableDirectiveFactory ) {
290292 return editableDirectiveFactory ( {
291293 directiveName : 'editableBstime' ,
292- inputTpl : '<uib-timepicker></uib-timepicker >' ,
294+ inputTpl : '<div uib-timepicker></div >' ,
293295 render : function ( ) {
294296 this . parent . render . call ( this ) ;
295297
@@ -321,10 +323,11 @@ angular.module('xeditable').directive('editableCheckbox', ['editableDirectiveFac
321323 inputTpl : '<input type="checkbox">' ,
322324 render : function ( ) {
323325 this . parent . render . call ( this ) ;
324- if ( this . attrs . eTitle ) {
325- this . inputEl . wrap ( '<label></label>' ) ;
326+ this . inputEl . wrap ( '<label></label>' ) ;
327+
328+ if ( this . attrs . eTitle ) {
326329 this . inputEl . parent ( ) . append ( '<span>' + this . attrs . eTitle + '</span>' ) ;
327- }
330+ }
328331 } ,
329332 autosubmit : function ( ) {
330333 var self = this ;
@@ -403,7 +406,9 @@ angular.module('xeditable').directive('editableCombodate', ['editableDirectiveFa
403406
404407 var combodate = editableCombodate . getInstance ( this . inputEl , options ) ;
405408 combodate . $widget . find ( 'select' ) . bind ( 'change' , function ( e ) {
406- self . scope . $data = ( new Date ( combodate . getValue ( ) ) ) . toISOString ( ) ;
409+ //.replace is so this works in Safari
410+ self . scope . $data = combodate . getValue ( ) ?
411+ ( new Date ( combodate . getValue ( ) . replace ( / - / g, "/" ) ) ) . toISOString ( ) : null ;
407412 } ) ;
408413 }
409414 } ) ;
@@ -471,7 +476,7 @@ Input types: text|password|email|tel|number|url|search|color|date|datetime|datet
471476 var self = this ;
472477 self . inputEl . bind ( 'keydown' , function ( e ) {
473478 //submit on tab
474- if ( e . keyCode === 9 ) {
479+ if ( e . keyCode === 9 && self . editorEl . attr ( 'blur' ) === 'submit' ) {
475480 self . scope . $apply ( function ( ) {
476481 self . scope . $form . $submit ( ) ;
477482 } ) ;
@@ -507,6 +512,7 @@ angular.module('xeditable').directive('editableTagsInput', ['editableDirectiveFa
507512 var dir = editableDirectiveFactory ( {
508513 directiveName : 'editableTagsInput' ,
509514 inputTpl : '<tags-input></tags-input>' ,
515+ useCopy : true ,
510516 render : function ( ) {
511517 this . parent . render . call ( this ) ;
512518 this . inputEl . append ( editableUtils . rename ( 'auto-complete' , this . attrs . $autoCompleteElement ) ) ;
@@ -540,19 +546,24 @@ angular.module('xeditable').directive('editableRadiolist', [
540546 inputTpl : '<span></span>' ,
541547 render : function ( ) {
542548 this . parent . render . call ( this ) ;
543- var parsed = editableNgOptionsParser ( this . attrs . eNgOptions ) ;
544- var ngChangeHtml = '' ;
549+ var parsed = editableNgOptionsParser ( this . attrs . eNgOptions ) ,
550+ ngChangeHtml = '' ,
551+ ngNameHtml = '' ;
545552
546553 if ( this . attrs . eNgChange ) {
547- ngChangeHtml = 'ng-change="' + this . attrs . eNgChange + '"' ;
554+ ngChangeHtml = ' ng-change="' + this . attrs . eNgChange + '"' ;
548555 }
549-
556+
557+ if ( this . attrs . eName ) {
558+ ngNameHtml = ' name="' + this . attrs . eName + '"' ;
559+ }
560+
550561 var html = '<label data-ng-repeat="' + parsed . ngRepeat + '">' +
551562 '<input type="radio" data-ng-disabled="::' +
552563 this . attrs . eNgDisabled +
553564 '" data-ng-model="$parent.$parent.$data" data-ng-value="' + $interpolate . startSymbol ( ) +
554565 '::' + parsed . locals . valueFn + $interpolate . endSymbol ( ) + '"' +
555- ngChangeHtml + '>' +
566+ ngChangeHtml + ngNameHtml + '>' +
556567 '<span data-ng-bind="::' + parsed . locals . displayFn + '"></span></label>' ;
557568
558569 this . inputEl . removeAttr ( 'ng-model' ) ;
@@ -589,11 +600,14 @@ angular.module('xeditable').directive('editableSelect', ['editableDirectiveFacto
589600 } ,
590601 autosubmit : function ( ) {
591602 var self = this ;
592- self . inputEl . bind ( 'change' , function ( ) {
593- self . scope . $apply ( function ( ) {
594- self . scope . $form . $submit ( ) ;
603+
604+ if ( ! self . attrs . hasOwnProperty ( "eMultiple" ) ) {
605+ self . inputEl . bind ( 'change' , function ( ) {
606+ self . scope . $apply ( function ( ) {
607+ self . scope . $form . $submit ( ) ;
608+ } ) ;
595609 } ) ;
596- } ) ;
610+ }
597611 }
598612 } ) ;
599613} ] ) ;
@@ -620,7 +634,8 @@ angular.module('xeditable').directive('editableTextarea', ['editableDirectiveFac
620634 self . scope . $form . $submit ( ) ;
621635 } ) ;
622636 }
623- } else if ( ( e . ctrlKey || e . metaKey ) && ( e . keyCode === 13 ) ) {
637+ } else if ( ( e . ctrlKey || e . metaKey ) && ( e . keyCode === 13 ) ||
638+ ( e . keyCode === 9 && self . editorEl . attr ( 'blur' ) === 'submit' ) ) {
624639 self . scope . $apply ( function ( ) {
625640 self . scope . $form . $submit ( ) ;
626641 } ) ;
@@ -696,8 +711,8 @@ angular.module('xeditable').factory('editableController',
696711 function ( $q , editableUtils ) {
697712
698713 //EditableController function
699- EditableController . $inject = [ '$scope' , '$attrs' , '$element' , '$parse' , 'editableThemes' , 'editableIcons' , 'editableOptions' , '$rootScope' , '$compile' , '$q' ] ;
700- function EditableController ( $scope , $attrs , $element , $parse , editableThemes , editableIcons , editableOptions , $rootScope , $compile , $q ) {
714+ EditableController . $inject = [ '$scope' , '$attrs' , '$element' , '$parse' , 'editableThemes' , 'editableIcons' , 'editableOptions' , '$rootScope' , '$compile' , '$q' , '$sce' ] ;
715+ function EditableController ( $scope , $attrs , $element , $parse , editableThemes , editableIcons , editableOptions , $rootScope , $compile , $q , $sce ) {
701716 var valueGetter ;
702717
703718 //if control is disabled - it does not participate in waiting process
@@ -1134,7 +1149,7 @@ angular.module('xeditable').factory('editableController',
11341149
11351150 self . setError = function ( msg ) {
11361151 if ( ! angular . isObject ( msg ) ) {
1137- $scope . $error = msg ;
1152+ $scope . $error = $sce . trustAsHtml ( msg ) ;
11381153 self . error = msg ;
11391154 }
11401155 } ;
@@ -1539,10 +1554,12 @@ angular.module('xeditable').factory('editableFormController',
15391554 //by default activate first field
15401555 selectionStart = this . $editables [ 0 ] . elem [ 0 ] . selectionStart ?
15411556 this . $editables [ 0 ] . elem [ 0 ] . selectionStart :
1542- this . $editables [ 0 ] . elem [ 0 ] . text ? this . $editables [ 0 ] . elem [ 0 ] . text . length : 0 ;
1557+ this . $editables [ 0 ] . elem [ 0 ] . text ? this . $editables [ 0 ] . elem [ 0 ] . text . length :
1558+ this . $editables [ 0 ] . elem [ 0 ] . innerHTML ? this . $editables [ 0 ] . elem [ 0 ] . innerHTML . length : 0 ;
15431559 selectionEnd = this . $editables [ 0 ] . elem [ 0 ] . selectionEnd ?
15441560 this . $editables [ 0 ] . elem [ 0 ] . selectionEnd :
1545- this . $editables [ 0 ] . elem [ 0 ] . text ? this . $editables [ 0 ] . elem [ 0 ] . text . length : 0 ;
1561+ this . $editables [ 0 ] . elem [ 0 ] . text ? this . $editables [ 0 ] . elem [ 0 ] . text . length :
1562+ this . $editables [ 0 ] . elem [ 0 ] . innerHTML ? this . $editables [ 0 ] . elem [ 0 ] . innerHTML . length : 0 ;
15461563 this . $editables [ 0 ] . activate ( selectionStart , selectionEnd ) ;
15471564 }
15481565 } ,
@@ -2562,7 +2579,7 @@ angular.module('xeditable').factory('editableThemes', function() {
25622579 noformTpl : '<span class="editable-wrap"></span>' ,
25632580 controlsTpl : '<span class="editable-controls"></span>' ,
25642581 inputTpl : '' ,
2565- errorTpl : '<div class="editable-error" data-ng-if="$error" data-ng-bind="$error"></div>' ,
2582+ errorTpl : '<div class="editable-error" data-ng-if="$error" data-ng-bind-html ="$error"></div>' ,
25662583 buttonsTpl : '<span class="editable-buttons"></span>' ,
25672584 submitTpl : '<button type="submit">save</button>' ,
25682585 cancelTpl : '<button type="button" ng-click="$form.$cancel()">cancel</button>' ,
@@ -2575,7 +2592,7 @@ angular.module('xeditable').factory('editableThemes', function() {
25752592 noformTpl : '<span class="editable-wrap"></span>' ,
25762593 controlsTpl : '<div class="editable-controls controls control-group" ng-class="{\'error\': $error}"></div>' ,
25772594 inputTpl : '' ,
2578- errorTpl : '<div class="editable-error help-block" data-ng-if="$error" data-ng-bind="$error"></div>' ,
2595+ errorTpl : '<div class="editable-error help-block" data-ng-if="$error" data-ng-bind-html ="$error"></div>' ,
25792596 buttonsTpl : '<span class="editable-buttons"></span>' ,
25802597 submitTpl : '<button type="submit" class="btn btn-primary"><span></span></button>' ,
25812598 cancelTpl : '<button type="button" class="btn" ng-click="$form.$cancel()">' +
@@ -2591,7 +2608,7 @@ angular.module('xeditable').factory('editableThemes', function() {
25912608 noformTpl : '<span class="editable-wrap"></span>' ,
25922609 controlsTpl : '<div class="editable-controls form-group" ng-class="{\'has-error\': $error}"></div>' ,
25932610 inputTpl : '' ,
2594- errorTpl : '<div class="editable-error help-block" data-ng-if="$error" data-ng-bind="$error"></div>' ,
2611+ errorTpl : '<div class="editable-error help-block" data-ng-if="$error" data-ng-bind-html ="$error"></div>' ,
25952612 buttonsTpl : '<span class="editable-buttons"></span>' ,
25962613 submitTpl : '<button type="submit" class="btn btn-primary"><span></span></button>' ,
25972614 cancelTpl : '<button type="button" class="btn btn-default" ng-click="$form.$cancel()">' +
@@ -2650,7 +2667,7 @@ angular.module('xeditable').factory('editableThemes', function() {
26502667 noformTpl : '<span class="editable-wrap"></span>' ,
26512668 controlsTpl : '<div class="editable-controls ui fluid input" ng-class="{\'error\': $error}"></div>' ,
26522669 inputTpl : '' ,
2653- errorTpl : '<div class="editable-error ui error message" data-ng-if="$error" data-ng-bind="$error"></div>' ,
2670+ errorTpl : '<div class="editable-error ui error message" data-ng-if="$error" data-ng-bind-html ="$error"></div>' ,
26542671 buttonsTpl : '<span class="mini ui buttons"></span>' ,
26552672 submitTpl : '<button type="submit" class="ui primary button"><i class="ui check icon"></i></button>' ,
26562673 cancelTpl : '<button type="button" class="ui button" ng-click="$form.$cancel()">' +
0 commit comments