diff options
Diffstat (limited to 'src/fields')
| -rw-r--r-- | src/fields/BasicField.ts | 2 | ||||
| -rw-r--r-- | src/fields/Document.ts | 3 | ||||
| -rw-r--r-- | src/fields/Key.ts | 23 | ||||
| -rw-r--r-- | src/fields/KeyStore.ts | 24 | ||||
| -rw-r--r-- | src/fields/ListField.ts | 2 | ||||
| -rw-r--r-- | src/fields/NumberField.ts | 2 |
6 files changed, 29 insertions, 27 deletions
diff --git a/src/fields/BasicField.ts b/src/fields/BasicField.ts index 6326a90ad..15eb067a0 100644 --- a/src/fields/BasicField.ts +++ b/src/fields/BasicField.ts @@ -19,7 +19,7 @@ export abstract class BasicField<T> extends Field { } @observable - private data: T; + protected data: T; @computed get Data(): T { diff --git a/src/fields/Document.ts b/src/fields/Document.ts index 0d233c295..fce316b17 100644 --- a/src/fields/Document.ts +++ b/src/fields/Document.ts @@ -1,5 +1,6 @@ import { Field, Cast, Opt, FieldWaiting, FIELD_ID, FieldValue } from "./Field" -import { Key, KeyStore } from "./Key" +import { Key } from "./Key" +import { KeyStore } from "./KeyStore"; import { NumberField } from "./NumberField"; import { ObservableMap, computed, action, observable } from "mobx"; import { TextField } from "./TextField"; diff --git a/src/fields/Key.ts b/src/fields/Key.ts index 51d8e093c..d3958df2d 100644 --- a/src/fields/Key.ts +++ b/src/fields/Key.ts @@ -48,27 +48,4 @@ export class Key extends Field { _id: this.Id } } -} - -export namespace KeyStore { - export const Prototype = new Key("Prototype"); - export const X = new Key("X"); - export const Y = new Key("Y"); - export const Title = new Key("Title"); - export const Author = new Key("Author"); - export const PanX = new Key("PanX"); - export const PanY = new Key("PanY"); - export const Scale = new Key("Scale"); - export const Width = new Key("Width"); - export const Height = new Key("Height"); - export const ZIndex = new Key("ZIndex"); - export const Data = new Key("Data"); - export const Layout = new Key("Layout"); - export const LayoutKeys = new Key("LayoutKeys"); - export const LayoutFields = new Key("LayoutFields"); - export const ColumnsKey = new Key("SchemaColumns"); - - export function Get(name: string): Key { - return new Key(name) - } }
\ No newline at end of file diff --git a/src/fields/KeyStore.ts b/src/fields/KeyStore.ts new file mode 100644 index 000000000..1e0b12729 --- /dev/null +++ b/src/fields/KeyStore.ts @@ -0,0 +1,24 @@ +import { Key } from "./Key"; + +export namespace KeyStore { + export const Prototype = new Key("Prototype"); + export const X = new Key("X"); + export const Y = new Key("Y"); + export const Title = new Key("Title"); + export const Author = new Key("Author"); + export const PanX = new Key("PanX"); + export const PanY = new Key("PanY"); + export const Scale = new Key("Scale"); + export const Width = new Key("Width"); + export const Height = new Key("Height"); + export const ZIndex = new Key("ZIndex"); + export const Data = new Key("Data"); + export const Layout = new Key("Layout"); + export const LayoutKeys = new Key("LayoutKeys"); + export const LayoutFields = new Key("LayoutFields"); + export const ColumnsKey = new Key("SchemaColumns"); + + export function Get(name: string): Key { + return new Key(name) + } +} diff --git a/src/fields/ListField.ts b/src/fields/ListField.ts index a46ce813d..1357dc445 100644 --- a/src/fields/ListField.ts +++ b/src/fields/ListField.ts @@ -45,7 +45,7 @@ export class ListField<T extends Field> extends BasicField<T[]> { init(callback: (field: Field) => any) { Server.GetFields(this._proxies, action((fields: { [index: string]: Field }) => { if (!this.arraysEqual(this._proxies, this.Data.map(field => field.Id))) { - this.Data = this._proxies.map(id => fields[id] as T) + this.data = this._proxies.map(id => fields[id] as T) observe(this.Data, () => { this.updateProxies() Server.UpdateField(this); diff --git a/src/fields/NumberField.ts b/src/fields/NumberField.ts index 6571695de..29e285201 100644 --- a/src/fields/NumberField.ts +++ b/src/fields/NumberField.ts @@ -4,7 +4,7 @@ import { FIELD_ID } from "./Field"; export class NumberField extends BasicField<number> { constructor(data: number = 0, id: FIELD_ID = undefined, save: boolean = true) { - super(data, false, id); + super(data, save, id); } ToScriptString(): string { |
