1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| import { isAlive, types } from "mobx-state-tree";
|
| export const ReadOnlyControlMixin = types.model("ReadOnlyControlMixin", {}).views((self) => ({
| isReadOnly() {
| return self.result?.isReadOnly() || self.annotation?.isReadOnly();
| },
| }));
|
| export const ReadOnlyRegionMixin = types
| .model("ReadOnlyRegionMixin", {
| readonly: types.optional(types.boolean, false),
| })
| .views((self) => ({
| isReadOnly() {
| if (!isAlive(self)) {
| return false;
| }
| return (
| self.locked ||
| self.readonly ||
| self.annotation.isReadOnly() ||
| (self.parent && (self.parent.isReadOnly?.() || self.parent.result?.isReadOnly?.()))
| );
| },
| }));
|
|