dev build
This commit is contained in:
parent
ad3c8f5c83
commit
7191240c75
dist
src/editable-form
2
dist/CHANGELOG.txt
vendored
2
dist/CHANGELOG.txt
vendored
@ -4,6 +4,8 @@ X-editable changelog
|
|||||||
|
|
||||||
Version 1.5.1 wip
|
Version 1.5.1 wip
|
||||||
----------------------------
|
----------------------------
|
||||||
|
[enh #400] allow `validate` to change submitted value (vitalets)
|
||||||
|
[enh #396] bs3 popover: placement `auto` (vitalets)
|
||||||
[bug #357] select2: tags mode with space separator (vitalets)
|
[bug #357] select2: tags mode with space separator (vitalets)
|
||||||
[bug #374] dateui: clear button does not submit (vitalets)
|
[bug #374] dateui: clear button does not submit (vitalets)
|
||||||
|
|
||||||
|
15
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
15
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
@ -203,9 +203,18 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
//get new value from input
|
//get new value from input
|
||||||
var newValue = this.input.input2value();
|
var newValue = this.input.input2value();
|
||||||
|
|
||||||
// validation: if validate returns truthy value - means error
|
//validation: if validate returns string or truthy value - means error
|
||||||
|
//if returns object like {newValue: '...'} => submitted value is reassigned to it
|
||||||
var error = this.validate(newValue);
|
var error = this.validate(newValue);
|
||||||
if (error) {
|
if ($.type(error) === 'object' && error.newValue !== undefined) {
|
||||||
|
newValue = error.newValue;
|
||||||
|
this.input.value2input(newValue);
|
||||||
|
if(typeof error.msg === 'string') {
|
||||||
|
this.error(error.msg);
|
||||||
|
this.showForm();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (error) {
|
||||||
this.error(error);
|
this.error(error);
|
||||||
this.showForm();
|
this.showForm();
|
||||||
return;
|
return;
|
||||||
@ -504,6 +513,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
send: 'auto',
|
send: 'auto',
|
||||||
/**
|
/**
|
||||||
Function for client-side validation. If returns string - means validation not passed and string showed as error.
|
Function for client-side validation. If returns string - means validation not passed and string showed as error.
|
||||||
|
Since 1.5.1 you can modify submitted value by returning object from `validate`:
|
||||||
|
`{newValue: '...'}` or `{newValue: '...', msg: '...'}`
|
||||||
|
|
||||||
@property validate
|
@property validate
|
||||||
@type function
|
@type function
|
||||||
|
File diff suppressed because one or more lines are too long
@ -203,9 +203,18 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
//get new value from input
|
//get new value from input
|
||||||
var newValue = this.input.input2value();
|
var newValue = this.input.input2value();
|
||||||
|
|
||||||
// validation: if validate returns truthy value - means error
|
//validation: if validate returns string or truthy value - means error
|
||||||
|
//if returns object like {newValue: '...'} => submitted value is reassigned to it
|
||||||
var error = this.validate(newValue);
|
var error = this.validate(newValue);
|
||||||
if (error) {
|
if ($.type(error) === 'object' && error.newValue !== undefined) {
|
||||||
|
newValue = error.newValue;
|
||||||
|
this.input.value2input(newValue);
|
||||||
|
if(typeof error.msg === 'string') {
|
||||||
|
this.error(error.msg);
|
||||||
|
this.showForm();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (error) {
|
||||||
this.error(error);
|
this.error(error);
|
||||||
this.showForm();
|
this.showForm();
|
||||||
return;
|
return;
|
||||||
@ -504,6 +513,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
send: 'auto',
|
send: 'auto',
|
||||||
/**
|
/**
|
||||||
Function for client-side validation. If returns string - means validation not passed and string showed as error.
|
Function for client-side validation. If returns string - means validation not passed and string showed as error.
|
||||||
|
Since 1.5.1 you can modify submitted value by returning object from `validate`:
|
||||||
|
`{newValue: '...'}` or `{newValue: '...', msg: '...'}`
|
||||||
|
|
||||||
@property validate
|
@property validate
|
||||||
@type function
|
@type function
|
||||||
@ -4774,16 +4785,43 @@ Editableform based on Twitter Bootstrap 3
|
|||||||
var placement = typeof this.options.placement == 'function' ?
|
var placement = typeof this.options.placement == 'function' ?
|
||||||
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
||||||
this.options.placement;
|
this.options.placement;
|
||||||
|
|
||||||
|
var autoToken = /\s?auto?\s?/i;
|
||||||
|
var autoPlace = autoToken.test(placement);
|
||||||
|
if (autoPlace) {
|
||||||
|
placement = placement.replace(autoToken, '') || 'top';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var pos = this.getPosition();
|
var pos = this.getPosition();
|
||||||
var actualWidth = $tip[0].offsetWidth;
|
var actualWidth = $tip[0].offsetWidth;
|
||||||
var actualHeight = $tip[0].offsetHeight;
|
var actualHeight = $tip[0].offsetHeight;
|
||||||
|
|
||||||
|
if (autoPlace) {
|
||||||
|
var $parent = this.$element.parent();
|
||||||
|
|
||||||
|
var orgPlacement = placement;
|
||||||
|
var docScroll = document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
|
var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth();
|
||||||
|
var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight();
|
||||||
|
var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left;
|
||||||
|
|
||||||
|
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
|
||||||
|
placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
|
||||||
|
placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
|
||||||
|
placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
|
||||||
|
placement;
|
||||||
|
|
||||||
|
$tip
|
||||||
|
.removeClass(orgPlacement)
|
||||||
|
.addClass(placement);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
|
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
|
||||||
|
|
||||||
this.applyPlacement(calculatedOffset, placement);
|
this.applyPlacement(calculatedOffset, placement);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}).call(this.container());
|
}).call(this.container());
|
||||||
/*jshint laxcomma: false, eqeqeq: true*/
|
/*jshint laxcomma: false, eqeqeq: true*/
|
||||||
|
File diff suppressed because one or more lines are too long
@ -203,9 +203,18 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
//get new value from input
|
//get new value from input
|
||||||
var newValue = this.input.input2value();
|
var newValue = this.input.input2value();
|
||||||
|
|
||||||
// validation: if validate returns truthy value - means error
|
//validation: if validate returns string or truthy value - means error
|
||||||
|
//if returns object like {newValue: '...'} => submitted value is reassigned to it
|
||||||
var error = this.validate(newValue);
|
var error = this.validate(newValue);
|
||||||
if (error) {
|
if ($.type(error) === 'object' && error.newValue !== undefined) {
|
||||||
|
newValue = error.newValue;
|
||||||
|
this.input.value2input(newValue);
|
||||||
|
if(typeof error.msg === 'string') {
|
||||||
|
this.error(error.msg);
|
||||||
|
this.showForm();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (error) {
|
||||||
this.error(error);
|
this.error(error);
|
||||||
this.showForm();
|
this.showForm();
|
||||||
return;
|
return;
|
||||||
@ -504,6 +513,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
send: 'auto',
|
send: 'auto',
|
||||||
/**
|
/**
|
||||||
Function for client-side validation. If returns string - means validation not passed and string showed as error.
|
Function for client-side validation. If returns string - means validation not passed and string showed as error.
|
||||||
|
Since 1.5.1 you can modify submitted value by returning object from `validate`:
|
||||||
|
`{newValue: '...'}` or `{newValue: '...', msg: '...'}`
|
||||||
|
|
||||||
@property validate
|
@property validate
|
||||||
@type function
|
@type function
|
||||||
|
File diff suppressed because one or more lines are too long
15
dist/jqueryui-editable/js/jqueryui-editable.js
vendored
15
dist/jqueryui-editable/js/jqueryui-editable.js
vendored
@ -203,9 +203,18 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
//get new value from input
|
//get new value from input
|
||||||
var newValue = this.input.input2value();
|
var newValue = this.input.input2value();
|
||||||
|
|
||||||
// validation: if validate returns truthy value - means error
|
//validation: if validate returns string or truthy value - means error
|
||||||
|
//if returns object like {newValue: '...'} => submitted value is reassigned to it
|
||||||
var error = this.validate(newValue);
|
var error = this.validate(newValue);
|
||||||
if (error) {
|
if ($.type(error) === 'object' && error.newValue !== undefined) {
|
||||||
|
newValue = error.newValue;
|
||||||
|
this.input.value2input(newValue);
|
||||||
|
if(typeof error.msg === 'string') {
|
||||||
|
this.error(error.msg);
|
||||||
|
this.showForm();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (error) {
|
||||||
this.error(error);
|
this.error(error);
|
||||||
this.showForm();
|
this.showForm();
|
||||||
return;
|
return;
|
||||||
@ -504,6 +513,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
send: 'auto',
|
send: 'auto',
|
||||||
/**
|
/**
|
||||||
Function for client-side validation. If returns string - means validation not passed and string showed as error.
|
Function for client-side validation. If returns string - means validation not passed and string showed as error.
|
||||||
|
Since 1.5.1 you can modify submitted value by returning object from `validate`:
|
||||||
|
`{newValue: '...'}` or `{newValue: '...', msg: '...'}`
|
||||||
|
|
||||||
@property validate
|
@property validate
|
||||||
@type function
|
@type function
|
||||||
|
File diff suppressed because one or more lines are too long
@ -199,8 +199,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
|
|||||||
//get new value from input
|
//get new value from input
|
||||||
var newValue = this.input.input2value();
|
var newValue = this.input.input2value();
|
||||||
|
|
||||||
// validation: if validate returns string or truthy value - means error
|
//validation: if validate returns string or truthy value - means error
|
||||||
// if returns object like {newValue: '...'} => submitted value is reassigned to it
|
//if returns object like {newValue: '...'} => submitted value is reassigned to it
|
||||||
var error = this.validate(newValue);
|
var error = this.validate(newValue);
|
||||||
if ($.type(error) === 'object' && error.newValue !== undefined) {
|
if ($.type(error) === 'object' && error.newValue !== undefined) {
|
||||||
newValue = error.newValue;
|
newValue = error.newValue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user