diff options
author | bobzel <zzzman@gmail.com> | 2024-05-19 00:05:18 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-05-19 00:05:18 -0400 |
commit | 38742d5f491ed5232a381da63e126b609cf14aad (patch) | |
tree | a723b0c9dfffa717b70df383d21fb3b14567308f /src/fields/SchemaHeaderField.ts | |
parent | a3784cd3ab990d8016b1168eb0cbf7e9a2f22301 (diff) | |
parent | 0b451af28e5aef6b749da61e8a9fcd0a840789ac (diff) |
Merge branch 'restoringEslint' into aisosa-starter
Diffstat (limited to 'src/fields/SchemaHeaderField.ts')
-rw-r--r-- | src/fields/SchemaHeaderField.ts | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/fields/SchemaHeaderField.ts b/src/fields/SchemaHeaderField.ts index fb4dc4e5b..0a8dd1d9e 100644 --- a/src/fields/SchemaHeaderField.ts +++ b/src/fields/SchemaHeaderField.ts @@ -1,9 +1,19 @@ +import { primitive, serializable } from 'serializr'; +import { ScriptingGlobals, scriptingGlobal } from '../client/util/ScriptingGlobals'; import { Deserializable } from '../client/util/SerializationHelper'; -import { serializable, primitive } from 'serializr'; +import { Copy, FieldChanged, ToJavascriptString, ToScriptString, ToString } from './FieldSymbols'; import { ObjectField } from './ObjectField'; -import { Copy, ToScriptString, ToString, FieldChanged, ToJavascriptString } from './FieldSymbols'; -import { scriptingGlobal, ScriptingGlobals } from '../client/util/ScriptingGlobals'; -import { ColumnType } from '../client/views/collections/collectionSchema/CollectionSchemaView'; + +export enum ColumnType { + Number, + String, + Boolean, + Date, + Image, + RTF, + Enumeration, + Any, +} export const PastelSchemaPalette = new Map<string, string>([ // ["pink1", "#FFB4E8"], @@ -69,13 +79,14 @@ export class SchemaHeaderField extends ObjectField { @serializable(primitive()) desc: boolean | undefined; // boolean determines sort order, undefined when no sort + // eslint-disable-next-line default-param-last constructor(heading: string = '', color: string = RandomPastel(), type?: ColumnType, width?: number, desc?: boolean, collapsed?: boolean) { super(); this.heading = heading; this.color = color; - this.type = type ? type : 0; - this.width = width ? width : -1; + this.type = type ?? 0; + this.width = width ?? -1; this.desc = desc; this.collapsed = collapsed; } @@ -124,6 +135,8 @@ export class SchemaHeaderField extends ObjectField { return `SchemaHeaderField`; } } + +// eslint-disable-next-line prefer-arrow-callback ScriptingGlobals.add(function schemaHeaderField(heading: string, color: string, type: number, width: number, desc?: boolean, collapsed?: boolean) { return new SchemaHeaderField(heading, color, type, width, desc, collapsed); }); |