aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FieldView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/FieldView.tsx')
-rw-r--r--src/client/views/nodes/FieldView.tsx30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index b9c3528d3..c6ebf7d4a 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -1,10 +1,11 @@
/* eslint-disable react/no-unused-prop-types */
/* eslint-disable react/require-default-props */
+import { Property } from 'csstype';
import { computed } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { DateField } from '../../../fields/DateField';
-import { Doc, Field, Opt } from '../../../fields/Doc';
+import { Doc, Field, FieldType, Opt } from '../../../fields/Doc';
import { List } from '../../../fields/List';
import { ScriptField } from '../../../fields/ScriptField';
import { WebField } from '../../../fields/URLField';
@@ -18,7 +19,26 @@ import { OpenWhere } from './OpenWhere';
export type FocusFuncType = (doc: Doc, options: FocusViewOptions) => Opt<number>;
// eslint-disable-next-line no-use-before-define
-export type StyleProviderFuncType = (doc: Opt<Doc>, props: Opt<FieldViewProps>, property: string) => any;
+export type StyleProviderFuncType = (
+ doc: Opt<Doc>,
+ props: Opt<FieldViewProps>,
+ property: string
+) =>
+ | Opt<FieldType>
+ | { clipPath: string; jsx: JSX.Element }
+ | JSX.Element
+ | JSX.IntrinsicElements
+ | null
+ | {
+ [key: string]:
+ | {
+ color: string;
+ icon: JSX.Element | string;
+ }
+ | undefined;
+ }
+ | { highlightStyle: string; highlightColor: string; highlightIndex: number; highlightStroke: boolean }
+ | undefined;
//
// these properties get assigned through the render() method of the DocumentView when it creates this node.
// However, that only happens because the properties are "defined" in the markup for the field view.
@@ -30,7 +50,7 @@ export interface FieldViewSharedProps {
LayoutTemplateString?: string;
LayoutTemplate?: () => Opt<Doc>;
renderDepth: number;
- scriptContext?: any; // can be assigned anything and will be passed as 'scriptContext' to any OnClick script that executes on this document
+ scriptContext?: unknown; // can be assigned anything and will be passed as 'scriptContext' to any OnClick script that executes on this document
xPadding?: number;
yPadding?: number;
dontRegisterView?: boolean;
@@ -45,7 +65,7 @@ export interface FieldViewSharedProps {
containerViewPath?: () => DocumentView[];
fitContentsToBox?: () => boolean; // used by freeformview to fit its contents to its panel. corresponds to _freeform_fitContentsToBox property on a Document
isGroupActive?: () => string | undefined; // is this document part of a group that is active
- setContentViewBox?: (view: ViewBoxInterface<any>) => any; // called by rendered field's viewBox so that DocumentView can make direct calls to the viewBox
+ setContentViewBox?: (view: ViewBoxInterface<FieldViewProps>) => void; // called by rendered field's viewBox so that DocumentView can make direct calls to the viewBox
PanelWidth: () => number;
PanelHeight: () => number;
isDocumentActive?: () => boolean | undefined; // whether a document should handle pointer events
@@ -77,7 +97,7 @@ export interface FieldViewSharedProps {
bringToFront?: (doc: Doc, sendToBack?: boolean) => void;
waitForDoubleClickToClick?: () => 'never' | 'always' | undefined;
defaultDoubleClick?: () => 'default' | 'ignore' | undefined;
- pointerEvents?: () => Opt<string>;
+ pointerEvents?: () => Opt<Property.PointerEvents>;
suppressSetHeight?: boolean;
}