aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/StyleProvider.tsx29
-rw-r--r--src/client/views/nodes/FieldView.tsx1
2 files changed, 13 insertions, 17 deletions
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx
index 9cb52aacf..8a07a6bd7 100644
--- a/src/client/views/StyleProvider.tsx
+++ b/src/client/views/StyleProvider.tsx
@@ -1,6 +1,3 @@
-/* eslint-disable jsx-a11y/alt-text */
-/* eslint-disable jsx-a11y/no-static-element-interactions */
-/* eslint-disable jsx-a11y/click-events-have-key-events */
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Tooltip } from '@mui/material';
@@ -24,7 +21,7 @@ import { undoBatch, UndoManager } from '../util/UndoManager';
import { TreeSort } from './collections/TreeSort';
import { Colors } from './global/globalEnums';
import { DocumentView, DocumentViewProps } from './nodes/DocumentView';
-import { FieldViewProps } from './nodes/FieldView';
+import { FieldViewProps, StyleProviderFuncType } from './nodes/FieldView';
import { StyleProp } from './StyleProp';
import './StyleProvider.scss';
@@ -43,9 +40,9 @@ function togglePaintView(e: React.MouseEvent, doc: Opt<Doc>, props: Opt<FieldVie
}
export function styleFromLayoutString(doc: Doc, props: FieldViewProps, scale: number) {
- const style: { [key: string]: any } = {};
+ const style: { [key: string]: string } = {};
const divKeys = ['width', 'height', 'fontSize', 'transform', 'left', 'backgroundColor', 'left', 'right', 'top', 'bottom', 'pointerEvents', 'position'];
- const replacer = (match: any, expr: string) =>
+ const replacer = (match: string, expr: string) =>
// bcz: this executes a script to convert a property expression string: { script } into a value
ScriptField.MakeFunction(expr, { this: Doc.name, scale: 'number' })?.script.run({ this: doc, scale }).result?.toString() ?? '';
divKeys.forEach((prop: string) => {
@@ -72,7 +69,7 @@ export function SetFilterOpener(func: () => void) {
// a preliminary implementation of a dash style sheet for setting rendering properties of documents nested within a Tab
//
-export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & DocumentViewProps>, property: string) {
+export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & DocumentViewProps>, property: string) : StyleProviderFuncType {
const remoteDocHeader = 'author;author_date;noMargin';
const isCaption = property.includes(':caption');
const isAnchor = property.includes(':anchor');
@@ -297,8 +294,7 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps &
if (SnappingManager.ExploreMode || doc?.layout_unrendered) return isInk() ? 'visiblePainted' : 'all';
if (pointerEvents?.() === 'none') return 'none';
if (opacity() === 0) return 'none';
- if (isGroupActive?.() ) return isInk() ? 'visiblePainted': (doc?.
- isGroup )? undefined: 'all'
+ if (isGroupActive?.() ) return isInk() ? 'visiblePainted': (doc?.isGroup ) ? undefined: 'all';
if (isDocumentActive?.()) return isInk() ? 'visiblePainted' : 'all';
return undefined; // fixes problem with tree view elements getting pointer events when the tree view is not active
case StyleProp.Decorations: {
@@ -329,11 +325,12 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps &
// eslint-disable-next-line react/no-unstable-nested-components
iconProvider={() => <div className='styleProvider-filterShift'><FaFilter/></div>}
closeOnSelect
- setSelectedVal={((dv: DocumentView) => {
+ setSelectedVal={((dvValue: unknown) => {
+ const dv = dvValue as DocumentView;
dv.select(false);
SnappingManager.SetPropertiesWidth(250);
_filterOpener?.();
- }) as any // Dropdown assumes values are strings or numbers..
+ }) // Dropdown assumes values are strings or numbers..
}
size={Size.XSMALL}
width={15}
@@ -345,11 +342,9 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps &
background={showFilterIcon}
items={[ ...(dashView ? [dashView]: []), ...(docViewPath?.()??[])]
.filter(dv => StrListCast(dv?.Document.childFilters).length || StrListCast(dv?.Document.childRangeFilters).length)
- .map(dv => ({
- text: StrCast(dv?.Document.title),
- val: dv as any,
- style: {color:SnappingManager.userColor, background:SnappingManager.userBackgroundColor},
- } as IListItemProps)) }
+ .map(dv => ({ text: StrCast(dv?.Document.title),
+ val: dv as unknown,
+ style: {color:SnappingManager.userColor, background:SnappingManager.userBackgroundColor} } as IListItemProps)) }
/>
</div>
);
@@ -387,7 +382,7 @@ export function DashboardToggleButton(doc: Doc, field: string, onIcon: IconProp,
<IconButton
size={Size.XSMALL}
color={color}
- icon={<FontAwesomeIcon icon={(doc[field] ? (onIcon as any) : offIcon) as IconProp} />}
+ icon={<FontAwesomeIcon icon={doc[field] ? onIcon : offIcon} />}
onClick={undoBatch(
action((e: React.MouseEvent) => {
e.stopPropagation();
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index c77f5a136..fc59e9e26 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -26,6 +26,7 @@ export type StyleProviderFuncType = (
| Opt<FieldType>
| { clipPath: string; jsx: JSX.Element }
| JSX.Element
+ | JSX.IntrinsicElements
| null
| {
[key: string]: