Compare commits

..

No commits in common. "3d3b8ba6e126a5089a858cd62b98673e60801fe4" and "b12ce258eb83620aa0dae546f146d381b9d61093" have entirely different histories.

3 changed files with 22 additions and 22 deletions

View File

@ -37,7 +37,7 @@ interface Props {
} }
export const DrawPDFFields = (props: Props) => { export const DrawPDFFields = (props: Props) => {
const { selectedFiles, selectedTool, onDrawFieldsChange, users } = props const { selectedFiles, selectedTool } = props
const [pdfFiles, setPdfFiles] = useState<PdfFile[]>([]) const [pdfFiles, setPdfFiles] = useState<PdfFile[]>([])
const [parsingPdf, setParsingPdf] = useState<boolean>(false) const [parsingPdf, setParsingPdf] = useState<boolean>(false)
@ -67,8 +67,8 @@ export const DrawPDFFields = (props: Props) => {
}, [selectedFiles]) }, [selectedFiles])
useEffect(() => { useEffect(() => {
if (pdfFiles) onDrawFieldsChange(pdfFiles) if (pdfFiles) props.onDrawFieldsChange(pdfFiles)
}, [onDrawFieldsChange, pdfFiles]) }, [pdfFiles, props])
/** /**
* Drawing events * Drawing events
@ -96,7 +96,7 @@ export const DrawPDFFields = (props: Props) => {
* @param page PdfPage where press happened * @param page PdfPage where press happened
*/ */
const onMouseDown = ( const onMouseDown = (
event: React.MouseEvent<HTMLDivElement>, event: React.MouseEvent<HTMLDivElement, MouseEvent>,
page: PdfPage page: PdfPage
) => { ) => {
// Proceed only if left click // Proceed only if left click
@ -149,7 +149,7 @@ export const DrawPDFFields = (props: Props) => {
* @param page PdfPage where moving is happening * @param page PdfPage where moving is happening
*/ */
const onMouseMove = ( const onMouseMove = (
event: React.MouseEvent<HTMLDivElement>, event: React.MouseEvent<HTMLDivElement, MouseEvent>,
page: PdfPage page: PdfPage
) => { ) => {
if (mouseState.clicked && selectedTool) { if (mouseState.clicked && selectedTool) {
@ -188,7 +188,9 @@ export const DrawPDFFields = (props: Props) => {
* @param event Mouse event * @param event Mouse event
* @param drawnField Which we are moving * @param drawnField Which we are moving
*/ */
const onDrawnFieldMouseDown = (event: React.MouseEvent<HTMLDivElement>) => { const onDrawnFieldMouseDown = (
event: React.MouseEvent<HTMLDivElement, MouseEvent>
) => {
event.stopPropagation() event.stopPropagation()
// Proceed only if left click // Proceed only if left click
@ -212,7 +214,7 @@ export const DrawPDFFields = (props: Props) => {
* @param drawnField which we are moving * @param drawnField which we are moving
*/ */
const onDrawnFieldMouseMove = ( const onDrawnFieldMouseMove = (
event: React.MouseEvent<HTMLDivElement>, event: React.MouseEvent<HTMLDivElement, MouseEvent>,
drawnField: DrawnField drawnField: DrawnField
) => { ) => {
if (mouseState.dragging) { if (mouseState.dragging) {
@ -248,7 +250,7 @@ export const DrawPDFFields = (props: Props) => {
* @param drawnField which we are resizing * @param drawnField which we are resizing
*/ */
const onResizeHandleMouseDown = ( const onResizeHandleMouseDown = (
event: React.MouseEvent<HTMLSpanElement> event: React.MouseEvent<HTMLSpanElement, MouseEvent>
) => { ) => {
// Proceed only if left click // Proceed only if left click
if (event.button !== 0) return if (event.button !== 0) return
@ -266,7 +268,7 @@ export const DrawPDFFields = (props: Props) => {
* @param drawnField which we are resizing * @param drawnField which we are resizing
*/ */
const onResizeHandleMouseMove = ( const onResizeHandleMouseMove = (
event: React.MouseEvent<HTMLSpanElement>, event: React.MouseEvent<HTMLSpanElement, MouseEvent>,
drawnField: DrawnField drawnField: DrawnField
) => { ) => {
if (mouseState.resizing) { if (mouseState.resizing) {
@ -296,7 +298,7 @@ export const DrawPDFFields = (props: Props) => {
* @param drawnFileIndex drawn file index * @param drawnFileIndex drawn file index
*/ */
const onRemoveHandleMouseDown = ( const onRemoveHandleMouseDown = (
event: React.MouseEvent<HTMLSpanElement>, event: React.MouseEvent<HTMLSpanElement, MouseEvent>,
pdfFileIndex: number, pdfFileIndex: number,
pdfPageIndex: number, pdfPageIndex: number,
drawnFileIndex: number drawnFileIndex: number
@ -315,7 +317,7 @@ export const DrawPDFFields = (props: Props) => {
* @param event Mouse event * @param event Mouse event
*/ */
const onUserSelectHandleMouseDown = ( const onUserSelectHandleMouseDown = (
event: React.MouseEvent<HTMLDivElement> event: React.MouseEvent<HTMLDivElement, MouseEvent>
) => { ) => {
event.stopPropagation() event.stopPropagation()
} }
@ -327,8 +329,8 @@ export const DrawPDFFields = (props: Props) => {
* event.target will be used * event.target will be used
*/ */
const getMouseCoordinates = ( const getMouseCoordinates = (
event: React.MouseEvent<HTMLElement>, event: React.MouseEvent<HTMLElement, MouseEvent>,
customTarget?: HTMLElement customTarget?: HTMLElement | null
) => { ) => {
const target = customTarget ? customTarget : event.currentTarget const target = customTarget ? customTarget : event.currentTarget
const rect = target.getBoundingClientRect() const rect = target.getBoundingClientRect()
@ -417,7 +419,7 @@ export const DrawPDFFields = (props: Props) => {
labelId="counterparts" labelId="counterparts"
label="Counterparts" label="Counterparts"
> >
{users {props.users
.filter((u) => u.role === UserRole.signer) .filter((u) => u.role === UserRole.signer)
.map((user, index) => { .map((user, index) => {
let displayValue = truncate( let displayValue = truncate(

View File

@ -7,17 +7,15 @@ import {
isCurrentUserMarksComplete, isCurrentUserMarksComplete,
isCurrentValueLast isCurrentValueLast
} from '../../utils' } from '../../utils'
import React, { useState } from 'react' import { useState } from 'react'
interface MarkFormFieldProps { interface MarkFormFieldProps {
currentUserMarks: CurrentUserMark[] handleSubmit: (event: any) => void
handleCurrentUserMarkChange: (mark: CurrentUserMark) => void handleSelectedMarkValueChange: (event: any) => void
handleSelectedMarkValueChange: (
event: React.ChangeEvent<HTMLInputElement>
) => void
handleSubmit: (event: React.FormEvent<HTMLFormElement>) => void
selectedMark: CurrentUserMark selectedMark: CurrentUserMark
selectedMarkValue: string selectedMarkValue: string
currentUserMarks: CurrentUserMark[]
handleCurrentUserMarkChange: (mark: CurrentUserMark) => void
} }
/** /**

View File

@ -1,4 +1,4 @@
import { MarkType } from './drawing' import { MarkType } from "./drawing";
export interface CurrentUserMark { export interface CurrentUserMark {
id: number id: number