namespace SmartFormsFields { export class rednaoimage extends sfFormElementBase{ GetValueString() { } private IsDynamicField=true; constructor(options:any,serverOptions:any) { super(options,serverOptions); if(this.IsNew) { this.Options.ClassName='rednaoimage'; this.Options.Label="Image"; this.Options.ImageWidth=''; this.Options.ImageHeight=''; this.Options.ImageUrl=smartFormsPath+'images/sflogo.jpg'; this.Options.CustomCSS=''; } } StoresInformation(): boolean { return false; } HandleRefresh(propertyName: string,previousValue:any): boolean { if(propertyName=='ImageUrl') { var newImage=this.Options.ImageUrl; if(newImage!=previousValue&&newImage!=null) { let $control=this.JQueryElement.find('.redNaoControls'); let $previousImage=$control.find('.rednaoImageImg'); let $loading=rnJQuery(``); $control.append($loading); $previousImage.velocity({'opacity':.5},300,"easeInExp"); $loading.velocity({'opacity':1},300,"easeInExp"); let $newImage=rnJQuery(``); $newImage.load(()=>{ var newImageWidth=$newImage.width(); var newImageHeight=$newImage.height(); var oldImageWidth=$previousImage.width(); var oldImageHeight=$previousImage.height(); $loading.velocity({'opacity':0},300,"easeInExp",()=>{$loading.remove();}); $previousImage.velocity({'opacity':0},300,"easeInExp",()=>{ $newImage.css('position','static'); $previousImage.remove(); $newImage.css('width',oldImageWidth); $newImage.css('height',oldImageHeight); $newImage.addClass('rednaoImageImg'); $newImage.velocity({'opacity':1,width:newImageWidth,height:newImageHeight},300,"easeInExp"); }); }); $control.append($newImage); } return true; } return false; } SetData(data: any) { } IsValid(): boolean { return true; } GenerationCompleted($element: any) { if(this.Options.ImageWidth) this.JQueryElement.find('.rednaoImageImg').css('width',this.Options.ImageWidth); if(this.Options.ImageHeight) this.JQueryElement.find('.rednaoImageImg').css('height',this.Options.ImageHeight); } GenerateInlineElement():string { if(this.Options.Label!='') { return '
'+ '
'+ ``+ '
'; }else{ return '
'+ ``+ '
' } } CreateProperties() { this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"ImageUrl","Image Url",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"ImageWidth","Image Width",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"ImageHeight","Image Height",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CustomCSSProperty(this,this.Options) ])); } } }