aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package-lock.json42
-rw-r--r--package.json2
-rw-r--r--src/client/views/StyleProvider.tsx29
-rw-r--r--src/client/views/nodes/FieldView.tsx1
4 files changed, 44 insertions, 30 deletions
diff --git a/package-lock.json b/package-lock.json
index 0187d7952..ae5f01daa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -220,6 +220,7 @@
"styled-components": "^6.1.1",
"supercluster": "^8.0.1",
"textarea-caret": "^3.1.0",
+ "textfit": "^2.4.0",
"tough-cookie": "^4.1.3",
"tslint": "^6.1.3",
"tslint-loader": "^3.5.4",
@@ -283,6 +284,7 @@
"@types/request": "^2.48.12",
"@types/request-promise": "^4.1.51",
"@types/shelljs": "^0.8.15",
+ "@types/textfit": "^2.4.4",
"@types/uuid": "^10.0.0",
"@types/valid-url": "^1.0.7",
"@types/webpack": "^5.28.5",
@@ -9824,6 +9826,15 @@
"@types/geojson": "*"
}
},
+ "node_modules/@types/textfit": {
+ "version": "2.4.4",
+ "resolved": "https://registry.npmjs.org/@types/textfit/-/textfit-2.4.4.tgz",
+ "integrity": "sha512-AYlNcJ5j/WspQfbHIhoF0Wo63F5+REnX/VPFSH5unUUuwRcr6IoXxZki3vYhG4DRVUQe51AsFYyRxml5u+qaAg==",
+ "dev": true,
+ "dependencies": {
+ "@types/jquery": "*"
+ }
+ },
"node_modules/@types/tough-cookie": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
@@ -13560,6 +13571,19 @@
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
+ "node_modules/browndash-components/node_modules/npm/node_modules/node-gyp/node_modules/readable-stream": {
+ "version": "3.6.2",
+ "inBundle": true,
+ "license": "MIT",
+ "dependencies": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/browndash-components/node_modules/npm/node_modules/node-gyp/node_modules/signal-exit": {
"version": "3.0.7",
"inBundle": true,
@@ -14005,19 +14029,6 @@
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
- "node_modules/browndash-components/node_modules/npm/node_modules/readable-stream": {
- "version": "3.6.2",
- "inBundle": true,
- "license": "MIT",
- "dependencies": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- },
- "engines": {
- "node": ">= 6"
- }
- },
"node_modules/browndash-components/node_modules/npm/node_modules/retry": {
"version": "0.12.0",
"inBundle": true,
@@ -39503,6 +39514,11 @@
"resolved": "https://registry.npmjs.org/textarea-caret/-/textarea-caret-3.1.0.tgz",
"integrity": "sha512-cXAvzO9pP5CGa6NKx0WYHl+8CHKZs8byMkt3PCJBCmq2a34YA9pO1NrQET5pzeqnBjBdToF5No4rrmkDUgQC2Q=="
},
+ "node_modules/textfit": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/textfit/-/textfit-2.4.0.tgz",
+ "integrity": "sha512-/x4aoY5+/tJmu+iwpBH1yw75TFp86M6X15SvaaY/Eep7YySQYtqdOifEtfvVyMwzl7SZ+G4RQw00FD9g5R6i1Q=="
+ },
"node_modules/thingies": {
"version": "1.21.0",
"resolved": "https://registry.npmjs.org/thingies/-/thingies-1.21.0.tgz",
diff --git a/package.json b/package.json
index 56800edfc..d58bf3e9f 100644
--- a/package.json
+++ b/package.json
@@ -63,6 +63,7 @@
"@types/request": "^2.48.12",
"@types/request-promise": "^4.1.51",
"@types/shelljs": "^0.8.15",
+ "@types/textfit": "^2.4.4",
"@types/uuid": "^10.0.0",
"@types/valid-url": "^1.0.7",
"@types/webpack": "^5.28.5",
@@ -305,6 +306,7 @@
"styled-components": "^6.1.1",
"supercluster": "^8.0.1",
"textarea-caret": "^3.1.0",
+ "textfit": "^2.4.0",
"tough-cookie": "^4.1.3",
"tslint": "^6.1.3",
"tslint-loader": "^3.5.4",
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]: