mirror of
https://github.com/ONLYOFFICE/sdkjs-forms.git
synced 2026-03-31 10:23:35 +08:00
[oform] Add an event when current role is filled in
This commit is contained in:
@ -100,6 +100,10 @@
|
||||
{
|
||||
this.CurrentUser = null;
|
||||
};
|
||||
OForm.prototype.getCurrentRole = function()
|
||||
{
|
||||
return this.CurrentUser ? this.CurrentUser.getRole() : null;
|
||||
};
|
||||
OForm.prototype.getCurrentUserMaster = function()
|
||||
{
|
||||
return this.CurrentUser;
|
||||
@ -444,6 +448,21 @@
|
||||
{
|
||||
this.NeedUpdateRoles = true;
|
||||
};
|
||||
OForm.prototype.onChangeFieldGroupFilled = function(fieldGroup)
|
||||
{
|
||||
if (!this.Document)
|
||||
return;
|
||||
|
||||
for (let i = 0; i < this.Roles.length; ++i)
|
||||
{
|
||||
let role = this.Roles[i];
|
||||
if (fieldGroup === role.getFieldGroup())
|
||||
{
|
||||
this.Document.sendEvent("asc_onOFormRoleFilled", role.getRole(), fieldGroup.isFilled());
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
OForm.prototype.onChangeRoleColor = function()
|
||||
{
|
||||
this.NeedRedraw = true;
|
||||
@ -579,13 +598,13 @@
|
||||
|
||||
return true;
|
||||
};
|
||||
OForm.prototype.setRoleFilled = function(roleName)
|
||||
OForm.prototype.setRoleFilled = function(roleName, isFilled)
|
||||
{
|
||||
let role = this.getRole(roleName);
|
||||
if (!role)
|
||||
return;
|
||||
|
||||
role.setFilled(true);
|
||||
role.setFilled(isFilled);
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private area
|
||||
|
||||
@ -568,6 +568,13 @@
|
||||
|
||||
this.OForm.onChangeRoles();
|
||||
};
|
||||
CDocument.prototype.onChangeFieldGroup = function(fieldGroup)
|
||||
{
|
||||
if (!this.OForm)
|
||||
return;
|
||||
|
||||
this.OForm.onChangeFieldGroupFilled(fieldGroup);
|
||||
};
|
||||
CDocument.prototype.onChangeUserMaster = function(userMaster)
|
||||
{
|
||||
if (!this.OForm)
|
||||
|
||||
@ -163,6 +163,13 @@
|
||||
|
||||
this.Parent.onChangeFieldGroup(this);
|
||||
};
|
||||
CFieldGroup.prototype.onChangeFilled = function()
|
||||
{
|
||||
if (!this.Parent)
|
||||
return;
|
||||
|
||||
this.Parent.onChangeFieldGroupFilled(this);
|
||||
};
|
||||
CFieldGroup.prototype.getAllFields = function()
|
||||
{
|
||||
let fields = [];
|
||||
|
||||
Reference in New Issue
Block a user