aboutsummaryrefslogtreecommitdiff
path: root/src/fields/SchemaHeaderField.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-05-17 14:55:36 -0400
committerbobzel <zzzman@gmail.com>2024-05-17 14:55:36 -0400
commit0b451af28e5aef6b749da61e8a9fcd0a840789ac (patch)
treebdee4e28ee4715b69299a8da1b615c70b6adc445 /src/fields/SchemaHeaderField.ts
parent8c1b420a143e4b72ec551277887c211ca6ca003b (diff)
parent38a382a03675d6a50ec7de75f05025efd093f570 (diff)
merged with new master
Diffstat (limited to 'src/fields/SchemaHeaderField.ts')
-rw-r--r--src/fields/SchemaHeaderField.ts25
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);
});