mirror of
https://github.com/ONLYOFFICE/sdkjs-forms.git
synced 2026-02-10 18:05:42 +08:00
Merge branch release/v9.1.0 into master
This commit is contained in:
2
api.js
2
api.js
@ -669,6 +669,8 @@ window["AscOForm"] = window.AscOForm = AscOForm;
|
||||
let formManager = logicDocument.GetFormsManager();
|
||||
let keyGenerator = formManager.GetKeyGenerator();
|
||||
|
||||
form.SetFormRequired(formManager.IsRadioGroupRequired(groupKey));
|
||||
|
||||
let formPr = form.GetFormPr().Copy();
|
||||
if (!formPr)
|
||||
return;
|
||||
|
||||
@ -175,7 +175,6 @@
|
||||
|
||||
let fields = fieldGroup.getAllFields();
|
||||
|
||||
|
||||
let delegateIndex = this.getRoleIndex(delegateName);
|
||||
|
||||
// На самом деле можно убрать эту проверку, но тогда мы просто удалим группу по умолчнию и заново её добавим
|
||||
@ -243,6 +242,38 @@
|
||||
|
||||
delegateFieldGroup.addUser(delegateUserMaster);
|
||||
this.Format.addFieldGroup(delegateFieldGroup);
|
||||
|
||||
if (!this.getDefaultRole() && delegateUserMaster)
|
||||
this.Format.setDefaultUser(delegateUserMaster);
|
||||
}
|
||||
|
||||
if (!this.getDefaultRole())
|
||||
{
|
||||
let delegateUserMaster;
|
||||
if (-1 === delegateIndex || delegateIndex === roleIndex)
|
||||
{
|
||||
this.updateRoles();
|
||||
if (this.Roles.length <= 0)
|
||||
{
|
||||
let defaultGroup = new AscOForm.CFieldGroup();
|
||||
defaultGroup.setWeight(this.Format.getMaxWeight() + 1);
|
||||
this.Format.addFieldGroup(defaultGroup);
|
||||
defaultGroup.addUser(this.Format.getDefaultUserMaster());
|
||||
delegateUserMaster = this.Format.getDefaultUserMaster();
|
||||
delegateUserMaster.initDefaultUser();
|
||||
}
|
||||
else
|
||||
{
|
||||
delegateUserMaster = this.Roles[0].getUserMaster();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delegateUserMaster = this.Roles[delegateIndex].getUserMaster();
|
||||
}
|
||||
|
||||
if (delegateUserMaster)
|
||||
this.Format.setDefaultUser(delegateUserMaster);
|
||||
}
|
||||
|
||||
this.NeedRedraw = true;
|
||||
@ -658,6 +689,14 @@
|
||||
}
|
||||
return true;
|
||||
};
|
||||
OForm.prototype.isFinal = function()
|
||||
{
|
||||
return this.Format.isFinal();
|
||||
};
|
||||
OForm.prototype.setFinal = function(isFinal)
|
||||
{
|
||||
return this.Format.setFinal(isFinal);
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private area
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -684,6 +723,15 @@
|
||||
logicDocument.UpdateInterface();
|
||||
logicDocument.FinalizeAction();
|
||||
};
|
||||
OForm.prototype.sendEvent = function()
|
||||
{
|
||||
let logicDocument = this.getDocument();
|
||||
let api;
|
||||
if (!logicDocument || !(api = logicDocument.GetApi()))
|
||||
return;
|
||||
|
||||
api.sendEvent.apply(api, arguments);
|
||||
};
|
||||
//--------------------------------------------------------export----------------------------------------------------
|
||||
AscOForm.OForm = OForm;
|
||||
//---------------------------------------------interface export-----------------------------------------------------
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
this.Type = null;
|
||||
this.Application = null;
|
||||
this.DocumentId = null;
|
||||
this.Final = false;
|
||||
this.FieldGroups = [];
|
||||
|
||||
// Массивы всех имеющихся пользователей и полей
|
||||
@ -153,6 +154,19 @@
|
||||
{
|
||||
return this.DocumentId;
|
||||
};
|
||||
CDocument.prototype.setFinal = function(isFinal)
|
||||
{
|
||||
if (this.Final === isFinal)
|
||||
return;
|
||||
|
||||
AscCommon.History.Add(new AscDFH.CChangesOFormDocumentFinal(this, this.Final, isFinal));
|
||||
this.Final = isFinal;
|
||||
this.onChangeFinal();
|
||||
};
|
||||
CDocument.prototype.isFinal = function()
|
||||
{
|
||||
return this.Final;
|
||||
};
|
||||
CDocument.prototype.addFieldGroup = function(fieldGroup)
|
||||
{
|
||||
if (-1 !== this.FieldGroups.indexOf(fieldGroup))
|
||||
@ -303,6 +317,9 @@
|
||||
case "description":
|
||||
this.setDescription(reader.GetTextDecodeXml());
|
||||
break;
|
||||
case "final":
|
||||
this.setFinal(reader.GetTextBool());
|
||||
break
|
||||
case "type":
|
||||
this.setType(reader.GetTextDecodeXml());
|
||||
break;
|
||||
@ -357,6 +374,9 @@
|
||||
if (application)
|
||||
writer.WriteXmlNodeWithText("application", application);
|
||||
|
||||
if (this.isFinal())
|
||||
writer.WriteXmlNodeWithText("final", "1");
|
||||
|
||||
let documentId = this.getDocumentId();
|
||||
if (documentId)
|
||||
writer.WriteXmlNodeWithText("id", documentId);
|
||||
@ -625,6 +645,13 @@
|
||||
this.removeFieldMasterByIndex(fieldIndex);
|
||||
}
|
||||
};
|
||||
CDocument.prototype.onChangeFinal = function()
|
||||
{
|
||||
if (!this.OForm)
|
||||
return;
|
||||
|
||||
this.OForm.sendEvent("asc_onOFormChangeFinal", this.isFinal());
|
||||
};
|
||||
|
||||
//--------------------------------------------------------export----------------------------------------------------
|
||||
AscOForm.CDocument = CDocument;
|
||||
|
||||
@ -134,6 +134,10 @@
|
||||
{
|
||||
return this.Role ? this.Role : "";
|
||||
};
|
||||
CUserMaster.prototype.isNoRole = function()
|
||||
{
|
||||
return (this === AscOForm.getNoRole());
|
||||
};
|
||||
CUserMaster.prototype.setColor = function(r, g, b)
|
||||
{
|
||||
let newColor = undefined !== r && null !== r ? new AscWord.CDocumentColor(r, g, b) : undefined;
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
window['AscDFH'].historyitem_OForm_Document_UserMaster = window['AscDFH'].historyitem_type_OForm_Document | 9;
|
||||
window['AscDFH'].historyitem_OForm_Document_FieldMaster = window['AscDFH'].historyitem_type_OForm_Document | 10;
|
||||
window['AscDFH'].historyitem_OForm_Document_DefaultUser = window['AscDFH'].historyitem_type_OForm_Document | 11;
|
||||
window['AscDFH'].historyitem_OForm_Document_Final = window['AscDFH'].historyitem_type_OForm_Document | 12;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@ -326,4 +327,25 @@
|
||||
);
|
||||
window['AscDFH'].CChangesOFormDocumentDefaultUser = CChangesOFormDocumentDefaultUser;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {window['AscDFH'].CChangesBaseBoolProperty}
|
||||
*/
|
||||
function CChangesOFormDocumentFinal(Class, Old, New)
|
||||
{
|
||||
window['AscDFH'].CChangesBaseBoolProperty.call(this, Class, Old, New);
|
||||
}
|
||||
window['AscDFH'].InheritPropertyChange(
|
||||
CChangesOFormDocumentFinal,
|
||||
window['AscDFH'].CChangesBaseBoolProperty,
|
||||
window['AscDFH'].historyitem_OForm_Document_Final,
|
||||
function(value)
|
||||
{
|
||||
this.Class.Final = value;
|
||||
this.Class.onChangeFinal();
|
||||
},
|
||||
false
|
||||
);
|
||||
window['AscDFH'].CChangesOFormDocumentFinal = CChangesOFormDocumentFinal;
|
||||
|
||||
})(window);
|
||||
|
||||
Reference in New Issue
Block a user