//>>built
define("mill/jssupport/form/_FormContentSup","dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/topic dojo/Deferred dojo/DeferredList dojo/when dijit/_CssStateMixin mill/jssupport/base mill/mill".split(" "),function(t,g,q,C,r,u,v,w,h,x){return mill.registerAlias("office.form._FormContentSup",t("mill.jssupport.form._FormContentSup",[w],{buildFormMap:null,_formQuery:null,_batchDone:null,_deferredActionQuery:null,_deferredActionHandler:null,onBatchDone:function(){var b=new r;b.resolve();return b.promise},
_batch:function(){var b=new r;this._deferredActionHandler||(this._deferredActionHandler=new r);h.deferredActionQuery&&this._deferredActionQuery||this._deferredActionHandler.isResolved()||this._deferredActionHandler.resolve();if(this._batchDone)return b.resolve(),b.promise;this.set("readOnly",!0);var a=g.hitch(this,function(){if(!this.formQuery().length)return this.set("readOnly",!1),b.resolve(),b.promise;this._formQuery=this.formQuery();x.batch({handler:h.mainHandler,language:h.locale,queries:this._formQuery}).then(function(l){this.buildForm();
var d=l.documentElement.childNodes,k=function(c){c++;this._formQuery.length>c?n(c):g.isFunction(this.onBatchDone)?this.onBatchDone().then(function(){this._batchDone=!0;this.set("readOnly",!1);b.resolve()}.bind(this)):(this._batchDone=!0,this.set("readOnly",!1),b.resolve())}.bind(this),n=g.hitch(this,function(c){this._formQuery[c]&&this._formQuery[c].load?v(this._formQuery[c].load(d[c]?d[c].childNodes:[]),g.hitch(this,function(){k(c)})):k(c)});0<d.length&&n(0)}.bind(this),g.hitch(this,function(l){this.loadingNode.innerHTML=
l.message;b.reject(l)}))});(new u([h.getMaxDocCopySize(),h.getOptionsValue(),this._deferredActionHandler])).then(function(){h.rtti?h.rtti.load().then(a):a()});return b.promise},getVisibleListParameters:function(){var b=h.rtti.get("TClass",null,this.executeClassName);b=b?h.rtti.getRoutine(null,this.executeMethodName,b.ID):null;return q.filter(b?h.rtti.listParameters(b.ID):[],function(a){return"scPublic"===h.rtti.get("TEnumerationItem",a.Scope).Name})},buildForm:function(){h.rtti&&q.forEach(this.getVisibleListParameters(),
g.hitch(this,function(b){var a=this.buildFormMap&&this.buildFormMap[b.Name]?this.buildFormMap[b.Name]:null,l=a&&a.storeDomain?h.rtti.getDomain(null,a.storeDomain):h.rtti.getDomain(b.Domain),d={name:b.Name,text:b.Description+("TBooleanDomain"!==l.handle?";:":""),required:l.Required};a&&a.placeHolder&&g.mixin(d,{placeHolder:a.placeHolder});if(!(this.buildFormMap&&g.isArray(this.buildFormMap.skipParameter)&&0<=q.indexOf(this.buildFormMap.skipParameter,b.Name))){var k=this,n=a?a.storeQuery||null:null,
c,e,p=a&&a.Group?a.Group:b.Group;p&&(p=this.getField(p))&&p.addChild&&(k=p);try{switch(l.handle){case "TClassDomain":var f=a&&a.widgetConstructor?a.widgetConstructor:office.form.FilteringSelectField;(e=(c=new f(d)).controlNode)&&this.registerWidget(e)&&k.addChild(c);var y=a?a.domainContext||null:null,z=a&&a.storeBatchRequest&&a.storeBatchRequest.length?a.storeBatchRequest:null,A=a&&"boolean"===typeof a.storeDoTranslate?a.storeDoTranslate:null,B=a&&"boolean"===typeof a.clientFiltering?a.clientFiltering:
null;a&&a.searchAttrObject&&this.setWidgetAttr(b.Name,"searchAttrObject",a.searchAttrObject);f=null;a&&a.jsonStore&&(f=g.isFunction(a.jsonStore)?a.jsonStore.call():a.jsonStore);var m=null;a&&a.fetchProperties&&(m=a.fetchProperties);this.setWidgetAttr(b.Name,"store",f?f:h.rtti.domainStore(l,y,n,z,A,B));null!==m&&this.setWidgetAttr(b.Name,"fetchProperties",m);break;case "TEnumerationDomain":(e=(c=new office.form.FilteringSelectField(d)).controlNode)&&this.registerWidget(e)&&k.addChild(c);this.setWidgetAttr(b.Name,
"searchAttrObject","Description");this.setWidgetAttr(b.Name,"store",h.rtti.domainStore(l,null,n));break;case "TStringDomain":f=a&&a.widgetConstructor?a.widgetConstructor:office.form.TextField;f===office.form.TextField&&g.mixin(d,{maxLength:l.Length});c=new f(d);if(e=c.controlNode||c)this.registerWidget(e),k.addChild(c);a&&a.validator&&(m=a.validator,e.set("validator",m()));break;case "TIntegerDomain":f=a&&a.widgetConstructor?a.widgetConstructor:office.form.TextField;f===office.form.TextField&&g.mixin(d,
{regExp:"^\\d+$",invalidMessage:"Office.ItegerInvalidMessage"});(e=(c=new f(d)).controlNode)&&this.registerWidget(e)&&k.addChild(c);break;case "TInt64Domain":f=a&&a.widgetConstructor?a.widgetConstructor:office.form.TextField;f===office.form.TextField&&g.mixin(d,{regExp:"^\\d+$",invalidMessage:"Office.ItegerInvalidMessage"});(e=(c=new f(d)).controlNode)&&this.registerWidget(e)&&k.addChild(c);break;case "TDateDomain":f=a&&a.widgetConstructor?a.widgetConstructor:office.form.TextField;g.mixin(d,{invalidMessage:a&&
a.invalidMessage?a.invalidMessage:"Office.InvalidDate"})&&(e=(c=new f(d)).controlNode)&&this.registerWidget(e)&&k.addChild(c);f===office.form.CalendarField&&a&&a.store&&e.set("store",a.store);a&&a.validator?(m=a.validator,e.set("validator",m())):this.setWidgetAttr(b.Name,"validator",this.dateValidator());break;case "TTimeDomain":f=a&&a.widgetConstructor?a.widgetConstructor:office.form.TextField;g.mixin(d,{invalidMessage:a&&a.invalidMessage?a.invalidMessage:"Office.InvalidTime"})&&(e=(c=new f(d)).controlNode)&&
this.registerWidget(e)&&k.addChild(c);a&&a.validator?(m=a.validator,e.set("validator",m())):this.setWidgetAttr(b.Name,"validator",this.timeValidator());break;case "TBlobDomain":f=a&&a.widgetConstructor?a.widgetConstructor:office.form.FileAttachmentField;f===office.form.FileUploaderField&&g.mixin(d,{name:b.Name+"Uploader",fileInputName:b.Name});a&&a.attachmentType&&g.mixin(d,{attachmentType:a.attachmentType});a&&a.fileExtension&&g.mixin(d,{extension:a.fileExtension});a&&a.fileAccept&&g.mixin(d,{accept:a.fileAccept});
a&&a.maxSize&&g.mixin(d,{maxSize:a.maxSize});(e=(c=new f(d)).controlNode)&&this.registerWidget(e)&&k.addChild(c);break;case "TExternalDataDomain":f=a&&a.widgetConstructor?a.widgetConstructor:office.form.UploaderField;a&&a.autoUpload&&g.mixin(d,{autoUpload:a.autoUpload});(e=(c=new f(d)).controlNode)&&this.registerWidget(e)&&k.addChild(c);break;case "TBooleanDomain":f=a&&a.widgetConstructor?a.widgetConstructor:b.Group&&b.Group===b.Name?office.form.ToggleContainer:office.form.CheckBoxField,f===office.form.ToggleContainer&&
b.Tab&&g.mixin(d,{header:b.Tab}),g.mixin(d,{doubleColumn:a&&"boolean"===typeof a.doubleColumn?a.doubleColumn:!1})&&(e=(c=new f(d)).controlNode)&&this.registerWidget(e)&&k.addChild(c),f===office.form.FilteringSelectField&&(a&&a.searchAttrObject&&this.setWidgetAttr(b.Name,"searchAttrObject",a.searchAttrObject),n=null,a&&a.jsonStore&&(n=g.isFunction(a.jsonStore)?a.jsonStore.call():a.jsonStore),this.setWidgetAttr(b.Name,"store",n))}e&&a&&(a.onChange&&e.set("onChange",a.onChange),g.isFunction(a.startup)&&
a.startup())}catch(D){}0<=q.indexOf(["TStringDomain","TIntegerDomain","TDateDomain"],l.handle)&&c&&d&&d.text&&(b=d.text.split(";")[0]+".Example",a=h.queryString,(h.getLocalization(b)||a&&"true"===a.show_resource_idents)&&c.set("dataExample",d.text.split(";")[0]+".Example"));e&&k!==this&&k.addWidget(e)}}))},formQuery:function(){return[]},scrollSpyNextStep:function(b,a,l){this._layoutScrollSpyItem&&(this._layoutScrollSpyItem.set("preCompleted",!0),b&&a&&(this._layoutScrollSpyItem.set("completed",!0),
(b=b._layoutScrollSpyItem)&&a.then(g.hitch(b,function(){this.set("preCompleted",!0);l&&this.onClick()}))))}}))});