X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=roojs-bootstrap-debug.js;h=7d035af4ca4b75ddf4212eae97c9ad1118b3f24c;hb=e48ce1c5e71b3d18391128ea45810effc0d036b0;hp=c032bc9856243765f9d7731bbda88328c9e52012;hpb=f0c24857d3fade101dcf96c446de04d079f43b05;p=roojs1
diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js
index c032bc9856..7d035af4ca 100644
--- a/roojs-bootstrap-debug.js
+++ b/roojs-bootstrap-debug.js
@@ -2679,7 +2679,10 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, {
},
setHeaderText: function(html)
{
- this.headerContainerEl.dom.innerHTML = html;
+ this.header = html;
+ if (this.headerContainerEl) {
+ this.headerContainerEl.dom.innerHTML = html;
+ }
}
@@ -10493,7 +10496,14 @@ Roo.bootstrap.Input = function(config){
* @param {Roo.form.Field} this
* @param {Roo.EventObject} e The event Object
*/
- keyup : true
+ keyup : true,
+ /**
+ * @event paste
+ * Fires after the user pastes into input
+ * @param {Roo.form.Field} this
+ * @param {Roo.EventObject} e The event Object
+ */
+ paste : true
});
};
@@ -10996,6 +11006,7 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component, {
this.inputEl().on("blur", this.onBlur, this);
this.inputEl().relayEvent('keyup', this);
+ this.inputEl().relayEvent('paste', this);
this.indicator = this.indicatorEl();
@@ -12496,11 +12507,29 @@ Roo.bootstrap.CardUploader = function(config){
this.fileCollection = new Roo.util.MixedCollection(false,function(r) {
return r.data.id
- });
-
+ });
+ this.addEvents({
+ // raw events
+ /**
+ * @event preview
+ * When a image is clicked on - and needs to display a slideshow or similar..
+ * @param {Roo.bootstrap.Card} this
+ * @param {Object} The image information data
+ *
+ */
+ 'preview' : true,
+ /**
+ * @event download
+ * When a the download link is clicked
+ * @param {Roo.bootstrap.Card} this
+ * @param {Object} The image information data contains
+ */
+ 'download' : true
+
+ });
};
-
+
Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
@@ -12528,6 +12557,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
{
tag: 'input',
type : 'hidden',
+ name : this.name,
value : this.value,
cls : 'd-none form-control'
},
@@ -12659,14 +12689,34 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
id : Roo.bootstrap.CardUploader.ID--,
is_uploaded : false,
src : url,
+ srcfile : file,
title : file.name,
mimetype : file.type,
preview : false,
is_deleted : 0
- })
+ });
},
+ /**
+ * addCard - add an Attachment to the uploader
+ * @param data - the data about the image to upload
+ *
+ * {
+ id : 123
+ title : "Title of file",
+ is_uploaded : false,
+ src : "http://.....",
+ srcfile : { the File upload object },
+ mimetype : file.type,
+ preview : false,
+ is_deleted : 0
+ .. any other data...
+ }
+ *
+ *
+ */
+
addCard : function (data)
{
// hidden input element?
@@ -12678,7 +12728,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
{
xns : Roo.bootstrap,
xtype : 'CardFooter',
- items: [
+ items: [
{
xns : Roo.bootstrap,
xtype : 'Element',
@@ -12689,13 +12739,14 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
xns : Roo.bootstrap,
xtype : 'Button',
html : String.format("{0}", data.title),
- cls : 'col-11 text-left',
+ cls : 'col-10 text-left',
size: 'sm',
weight: 'link',
fa : 'download',
listeners : {
click : function() {
- this.downloadCard(data.id)
+
+ t.fireEvent( "download", t, data );
}
}
},
@@ -12703,10 +12754,10 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
{
xns : Roo.bootstrap,
xtype : 'Button',
-
+ style: 'max-height: 28px; ',
size : 'sm',
weight: 'danger',
- cls : 'col-1',
+ cls : 'col-2',
fa : 'times',
listeners : {
click : function() {
@@ -12721,7 +12772,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
}
];
-
+
var cn = this.addxtype(
{
@@ -12737,12 +12788,14 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
items : footer,
initEvents : function() {
Roo.bootstrap.Card.prototype.initEvents.call(this);
+ var card = this;
this.imgEl = this.el.select('.card-img-top').first();
if (this.imgEl) {
- this.imgEl.on('click', function() { t.previewCard( data.id); }, this);
+ this.imgEl.on('click', function() { t.fireEvent( "preview", t, data ); }, this);
this.imgEl.set({ 'pointer' : 'cursor' });
}
+ this.getCardFooter().addClass('p-1');
}
@@ -12752,7 +12805,21 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
// dont' really need ot update items.
// this.items.push(cn);
this.fileCollection.add(cn);
- this.updateInput();
+
+ if (!data.srcfile) {
+ this.updateInput();
+ return;
+ }
+
+ var _t = this;
+ var reader = new FileReader();
+ reader.addEventListener("load", function() {
+ data.srcdata = reader.result;
+ _t.updateInput();
+ });
+ reader.readAsDataURL(data.srcfile);
+
+
},
removeCard : function(id)
@@ -12761,16 +12828,20 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
var card = this.fileCollection.get(id);
card.data.is_deleted = 1;
card.data.src = ''; /// delete the source - so it reduces size of not uploaded images etc.
- this.fileCollection.remove(card);
+ //this.fileCollection.remove(card);
//this.items = this.items.filter(function(e) { return e != card });
// dont' really need ot update items.
card.el.dom.parentNode.removeChild(card.el.dom);
+ this.updateInput();
+
},
reset: function()
{
this.fileCollection.each(function(card) {
- card.el.dom.parentNode.removeChild(card.el.dom);
+ if (card.el.dom && card.el.dom.parentNode) {
+ card.el.dom.parentNode.removeChild(card.el.dom);
+ }
});
this.fileCollection.clear();
this.updateInput();
@@ -12778,12 +12849,15 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, {
updateInput : function()
{
- var data = [];
+ var data = [];
this.fileCollection.each(function(e) {
data.push(e.data);
+
});
-
this.inputEl().dom.value = JSON.stringify(data);
+
+
+
}
@@ -19659,7 +19733,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, {
maskEl : false, // the mask element
headerEl : false,
contentEl : false,
-
+ alignEl : false, // when show is called with an element - this get's stored.
getChildContainer : function()
{
@@ -19785,10 +19859,12 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, {
Roo.bootstrap.Popover.register(this);
}
-
+ this.arrowEl = this.el.select('.arrow',true).first();
this.headerEl.setVisibilityMode(Roo.Element.DISPLAY); // probably not needed as it's default in BS4
this.el.enableDisplayMode('block');
this.el.hide();
+
+
if (this.over === false && !this.parent()) {
return;
}
@@ -19811,7 +19887,6 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, {
on_el.on(eventOut, this.leave, this);
}
}, this);
-
},
@@ -19859,12 +19934,14 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, {
},
/**
* Show the popover
- * @param {Roo.Element|string|false} - element to align and point to.
+ * @param {Roo.Element|string|Boolean} - element to align and point to. (set align to [ pos, offset ])
+ * @param {string} (left|right|top|bottom) position
*/
- show : function (on_el)
+ show : function (on_el, placement)
{
-
+ this.placement = typeof(placement) == 'undefined' ? this.placement : placement;
on_el = on_el || false; // default to false
+
if (!on_el) {
if (this.parent() && (this.over == 'parent' || (this.over === false))) {
on_el = this.parent().el;
@@ -19874,53 +19951,27 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, {
}
+ this.alignEl = Roo.get( on_el );
+
if (!this.el) {
this.render(document.body);
}
- this.el.removeClass([
- 'fade','top','bottom', 'left', 'right','in',
- 'bs-popover-top','bs-popover-bottom', 'bs-popover-left', 'bs-popover-right'
- ]);
+
if (this.title === false) {
this.headerEl.hide();
}
-
- var placement = typeof this.placement == 'function' ?
- this.placement.call(this, this.el, on_el) :
- this.placement;
-
- /*
- var autoToken = /\s?auto?\s?/i; /// not sure how this was supposed to work? right auto ? what?
-
- // I think 'auto right' - but
-
- var autoPlace = autoToken.test(placement);
- if (autoPlace) {
- placement = placement.replace(autoToken, '') || 'top';
- }
- */
-
-
+
this.el.show();
- this.el.dom.style.display='block';
-
- //this.el.appendTo(on_el);
-
- var p = this.getPosition();
- var box = this.el.getBox();
-
-
- var align = Roo.bootstrap.Popover.alignment[placement];
- this.el.addClass(align[2]);
-
-// Roo.log(align);
-
- if (on_el) {
- this.el.alignTo(on_el, align[0],align[1]);
+ this.el.dom.style.display = 'block';
+
+
+ if (this.alignEl) {
+ this.updatePosition(this.placement, true);
+
} else {
// this is usually just done by the builder = to show the popoup in the middle of the scren.
var es = this.el.getSize();
@@ -19936,10 +19987,7 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, {
this.el.addClass('in');
-
- if (this.el.hasClass('fade')) {
- // fade it?
- }
+
this.hoverState = 'in';
@@ -19950,12 +19998,96 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component, {
this.maskEl.addClass('show');
}
this.el.setStyle('z-index', Roo.bootstrap.Popover.zIndex++);
-
+
+ this.fireEvent('show', this);
+ },
+ /**
+ * fire this manually after loading a grid in the table for example
+ * @param {string} (left|right|top|bottom) where to try and put it (use false to use the last one)
+ * @param {Boolean} try and move it if we cant get right position.
+ */
+ updatePosition : function(placement, try_move)
+ {
+ // allow for calling with no parameters
+ placement = placement ? placement : this.placement;
+ try_move = typeof(try_move) == 'undefined' ? true : try_move;
- this.fireEvent('show', this);
+ this.el.removeClass([
+ 'fade','top','bottom', 'left', 'right','in',
+ 'bs-popover-top','bs-popover-bottom', 'bs-popover-left', 'bs-popover-right'
+ ]);
+ this.el.addClass(placement + ' bs-popover-' + placement);
+
+ if (!this.alignEl ) {
+ return false;
+ }
+ switch (placement) {
+ case 'right':
+ var exact = this.el.getAlignToXY(this.alignEl, 'tl-tr', [10,0]);
+ var offset = this.el.getAlignToXY(this.alignEl, 'tl-tr?',[10,0]);
+ if (!try_move || exact.equals(offset) || exact[0] == offset[0] ) {
+ //normal display... or moved up/down.
+ this.el.setXY(offset);
+ var xy = this.alignEl.getAnchorXY('tr', false);
+ xy[0]+=2;xy[1]+=5;
+ this.arrowEl.setXY(xy);
+ return true;
+ }
+ // continue through...
+ return this.updatePosition('left', false);
+
+
+ case 'left':
+ var exact = this.el.getAlignToXY(this.alignEl, 'tr-tl', [-10,0]);
+ var offset = this.el.getAlignToXY(this.alignEl, 'tr-tl?',[-10,0]);
+ if (!try_move || exact.equals(offset) || exact[0] == offset[0] ) {
+ //normal display... or moved up/down.
+ this.el.setXY(offset);
+ var xy = this.alignEl.getAnchorXY('tl', false);
+ xy[0]-=10;xy[1]+=5; // << fix me
+ this.arrowEl.setXY(xy);
+ return true;
+ }
+ // call self...
+ return this.updatePosition('right', false);
+
+ case 'top':
+ var exact = this.el.getAlignToXY(this.alignEl, 'b-t', [0,-10]);
+ var offset = this.el.getAlignToXY(this.alignEl, 'b-t?',[0,-10]);
+ if (!try_move || exact.equals(offset) || exact[1] == offset[1] ) {
+ //normal display... or moved up/down.
+ this.el.setXY(offset);
+ var xy = this.alignEl.getAnchorXY('t', false);
+ xy[1]-=10; // << fix me
+ this.arrowEl.setXY(xy);
+ return true;
+ }
+ // fall through
+ return this.updatePosition('bottom', false);
+
+ case 'bottom':
+ var exact = this.el.getAlignToXY(this.alignEl, 't-b', [0,10]);
+ var offset = this.el.getAlignToXY(this.alignEl, 't-b?',[0,10]);
+ if (!try_move || exact.equals(offset) || exact[1] == offset[1] ) {
+ //normal display... or moved up/down.
+ this.el.setXY(offset);
+ var xy = this.alignEl.getAnchorXY('b', false);
+ xy[1]+=2; // << fix me
+ this.arrowEl.setXY(xy);
+ return true;
+ }
+ // fall through
+ return this.updatePosition('top', false);
+
+
+ }
+
+
+ return false;
},
+
hide : function()
{
this.el.setXY([0,0]);
@@ -21522,8 +21654,8 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, {
//Roo.log(className);
if (className.indexOf('day') > -1 && className.indexOf('disabled') < 0 ){
var day = parseInt(html, 10) || 1;
- var year = this.viewDate.getUTCFullYear(),
- month = this.viewDate.getUTCMonth();
+ var year = (this.viewDate || new Date()).getUTCFullYear(),
+ month = (this.viewDate || new Date()).getUTCMonth();
if (className.indexOf('old') > -1) {
if(month === 0 ){
@@ -21962,13 +22094,20 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
* valid according to {@link Date#parseDate} (defaults to 'H:i').
*/
format : "H:i",
-
+
+ getAutoCreate : function()
+ {
+ this.after = '';
+ return Roo.bootstrap.TimeField.superclass.getAutoCreate.call(this);
+
+
+ },
onRender: function(ct, position)
{
Roo.bootstrap.TimeField.superclass.onRender.call(this, ct, position);
- this.el.select('>.input-group', true).first().createChild(Roo.bootstrap.TimeField.template);
+ this.pickerEl = Roo.get(document.body).createChild(Roo.bootstrap.TimeField.template);
this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
@@ -21983,10 +22122,10 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
this.fillTime();
this.update();
- this.pop.select('span.hours-up', true).first().on('click', this.onIncrementHours, this);
- this.pop.select('span.hours-down', true).first().on('click', this.onDecrementHours, this);
- this.pop.select('span.minutes-up', true).first().on('click', this.onIncrementMinutes, this);
- this.pop.select('span.minutes-down', true).first().on('click', this.onDecrementMinutes, this);
+ this.pop.select('.hours-up', true).first().on('click', this.onIncrementHours, this);
+ this.pop.select('.hours-down', true).first().on('click', this.onDecrementHours, this);
+ this.pop.select('.minutes-up', true).first().on('click', this.onIncrementMinutes, this);
+ this.pop.select('.minutes-down', true).first().on('click', this.onDecrementMinutes, this);
this.pop.select('button.period', true).first().on('click', this.onTogglePeriod, this);
this.pop.select('button.ok', true).first().on('click', this.setTime, this);
@@ -22030,7 +22169,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
picker : function()
{
- return this.el.select('.datepicker', true).first();
+ return this.pickerEl;
},
fillTime: function()
@@ -22051,8 +22190,8 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
cls: 'btn',
cn: [
{
- tag: 'span',
- cls: 'hours-up glyphicon glyphicon-chevron-up'
+ tag: 'i',
+ cls: 'hours-up fa fas fa-chevron-up'
}
]
}
@@ -22071,8 +22210,8 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
cls: 'btn',
cn: [
{
- tag: 'span',
- cls: 'minutes-up glyphicon glyphicon-chevron-up'
+ tag: 'i',
+ cls: 'minutes-up fa fas fa-chevron-up'
}
]
}
@@ -22145,7 +22284,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
cn: [
{
tag: 'span',
- cls: 'hours-down glyphicon glyphicon-chevron-down'
+ cls: 'hours-down fa fas fa-chevron-down'
}
]
}
@@ -22165,7 +22304,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
cn: [
{
tag: 'span',
- cls: 'minutes-down glyphicon glyphicon-chevron-down'
+ cls: 'minutes-down fa fas fa-chevron-down'
}
]
}
@@ -22238,21 +22377,27 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
cls.pop();
cls.push('left');
}
-
+ //this.picker().setXY(20000,20000);
this.picker().addClass(cls.join('-'));
var _this = this;
Roo.each(cls, function(c){
if(c == 'bottom'){
- _this.picker().setTop(_this.inputEl().getHeight());
+ (function() {
+ //
+ }).defer(200);
+ _this.picker().alignTo(_this.inputEl(), "tr-br", [0, 10], false);
+ //_this.picker().setTop(_this.inputEl().getHeight());
return;
}
if(c == 'top'){
- _this.picker().setTop(0 - _this.picker().getHeight());
+ _this.picker().alignTo(_this.inputEl(), "br-tr", [0, 10], false);
+
+ //_this.picker().setTop(0 - _this.picker().getHeight());
return;
}
-
+ /*
if(c == 'left'){
_this.picker().setLeft(_this.inputEl().getLeft() + _this.inputEl().getWidth() - _this.el.getLeft() - _this.picker().getWidth());
return;
@@ -22261,6 +22406,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
_this.picker().setLeft(_this.inputEl().getLeft() - _this.el.getLeft());
return;
}
+ */
});
},
@@ -22348,48 +22494,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input, {
});
-
-Roo.apply(Roo.bootstrap.TimeField, {
-
- content : {
- tag: 'tbody',
- cn: [
- {
- tag: 'tr',
- cn: [
- {
- tag: 'td',
- colspan: '7'
- }
- ]
- }
- ]
- },
-
- footer : {
- tag: 'tfoot',
- cn: [
- {
- tag: 'tr',
- cn: [
- {
- tag: 'th',
- colspan: '7',
- cls: '',
- cn: [
- {
- tag: 'button',
- cls: 'btn btn-info ok',
- html: 'OK'
- }
- ]
- }
-
- ]
- }
- ]
- }
-});
+
Roo.apply(Roo.bootstrap.TimeField, {
@@ -22405,8 +22510,43 @@ Roo.apply(Roo.bootstrap.TimeField, {
tag: 'table',
cls: 'table-condensed',
cn:[
- Roo.bootstrap.TimeField.content,
- Roo.bootstrap.TimeField.footer
+ {
+ tag: 'tbody',
+ cn: [
+ {
+ tag: 'tr',
+ cn: [
+ {
+ tag: 'td',
+ colspan: '7'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ tag: 'tfoot',
+ cn: [
+ {
+ tag: 'tr',
+ cn: [
+ {
+ tag: 'th',
+ colspan: '7',
+ cls: '',
+ cn: [
+ {
+ tag: 'button',
+ cls: 'btn btn-info ok',
+ html: 'OK'
+ }
+ ]
+ }
+
+ ]
+ }
+ ]
+ }
]
}
]
@@ -25697,8 +25837,8 @@ Roo.HtmlEditorCore.cblack= [
Roo.HtmlEditorCore.swapCodes =[
- [ 8211, "--" ],
- [ 8212, "--" ],
+ [ 8211, "–" ],
+ [ 8212, "—" ],
[ 8216, "'" ],
[ 8217, "'" ],
[ 8220, '"' ],
@@ -27296,7 +27436,7 @@ Roo.extend(Roo.bootstrap.PagingToolbar, Roo.bootstrap.NavSimplebar, {
// private
onLoad : function(ds, r, o)
{
- this.cursor = o.params.start ? o.params.start : 0;
+ this.cursor = o.params && o.params.start ? o.params.start : 0;
var d = this.getPageData(),
ap = d.activePage,