mirror of
https://github.com/ONLYOFFICE/sdkjs-forms.git
synced 2026-03-31 10:23:35 +08:00
[de] Add method to check if we can fill in with the current role
This commit is contained in:
@ -561,6 +561,24 @@
|
||||
{
|
||||
this.onUndoRedo();
|
||||
};
|
||||
OForm.prototype.canFillRole = function(roleName)
|
||||
{
|
||||
let role = this.getRole(roleName);
|
||||
if (!role || role.isFilled())
|
||||
return false;
|
||||
|
||||
let weight = role.getWeight();
|
||||
for (let i = 0; i < this.Roles.length; ++i)
|
||||
{
|
||||
if (this.Roles[i] === role || this.Roles[i].isFilled())
|
||||
continue;
|
||||
|
||||
if (this.Roles[i].getWeight() < weight)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private area
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -598,5 +616,6 @@
|
||||
OForm.prototype['asc_moveDownRole'] = OForm.prototype.moveDownRole;
|
||||
OForm.prototype['asc_haveRole'] = OForm.prototype.haveRole;
|
||||
OForm.prototype['asc_getRole'] = OForm.prototype.getRoleSettings;
|
||||
OForm.prototype['asc_canFillRole'] = OForm.prototype.canFillRole;
|
||||
|
||||
})(window);
|
||||
|
||||
Reference in New Issue
Block a user