File tree Expand file tree Collapse file tree 7 files changed +15
-17
lines changed
packages/customWidgets/signature-web Expand file tree Collapse file tree 7 files changed +15
-17
lines changed Original file line number Diff line number Diff line change 1- import { createElement , FC , PropsWithChildren } from "react" ;
1+ import { FC , PropsWithChildren } from "react" ;
22import classNames from "classnames" ;
33
44export interface AlertProps extends PropsWithChildren {
55 bootstrapStyle ?: "default" | "primary" | "success" | "info" | "warning" | "danger" ;
66 className ?: string ;
77}
88
9- export const Alert : FC < AlertProps > = ( { bootstrapStyle, className, children } ) =>
9+ export const Alert : FC < AlertProps > = ( { bootstrapStyle = "danger" , className, children } ) =>
1010 children ? < div className = { classNames ( `alert alert-${ bootstrapStyle } ` , className ) } > { children } </ div > : null ;
1111
1212Alert . displayName = "Alert" ;
13- Alert . defaultProps = { bootstrapStyle : "danger" } ;
Original file line number Diff line number Diff line change 1- import { createElement , FC } from "react" ;
1+ import { FC } from "react" ;
22
33export interface GridBackgroundProps {
44 gridCellWidth : number ;
@@ -12,7 +12,7 @@ export const Grid: FC<GridBackgroundProps> = ({
1212 gridCellHeight,
1313 gridBorderColor,
1414 gridBorderWidth,
15- showGrid
15+ showGrid = true
1616} ) => {
1717 const id = `grid${ Math . floor ( Math . random ( ) * 1000000 ) } ` ;
1818 return showGrid ? (
@@ -43,4 +43,3 @@ export const Grid: FC<GridBackgroundProps> = ({
4343} ;
4444
4545Grid . displayName = "Grid" ;
46- Grid . defaultProps = { showGrid : true } ;
Original file line number Diff line number Diff line change 1- import { createElement , PureComponent , ReactNode } from "react" ;
1+ import { PureComponent , ReactNode } from "react" ;
22
3- // @ts -ignore
3+ // @ts -expect-error signature_pad has no types
44import SignaturePad , { IOptions } from "signature_pad" ;
55import classNames from "classnames" ;
66import ReactResizeDetector from "react-resize-detector" ;
@@ -31,7 +31,7 @@ export type penOptions = "fountain" | "ballpoint" | "marker";
3131
3232export class Signature extends PureComponent < SignatureProps > {
3333 private canvasNode : HTMLCanvasElement | null = null ;
34- // @ts -expect-error
34+ // @ts -expect-error signature_pad has no types
3535 private signaturePad : SignaturePad ;
3636
3737 render ( ) : ReactNode {
@@ -48,7 +48,9 @@ export class Signature extends PureComponent<SignatureProps> {
4848 < Grid { ...this . props } />
4949 < canvas
5050 className = "widget-signature-canvas"
51- ref = { ( node : HTMLCanvasElement ) => ( this . canvasNode = node ) }
51+ ref = { ( node : HTMLCanvasElement | null ) : void => {
52+ this . canvasNode = node ;
53+ } }
5254 />
5355 < ReactResizeDetector handleWidth handleHeight onResize = { this . onResize } />
5456 </ SizeContainer >
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export const SizeContainer: FC<SizeProps> = ({
2828 height,
2929 children,
3030 style,
31- readOnly
31+ readOnly = false
3232} ) => {
3333 const styleWidth = widthUnit === "percentage" ? `${ width } %` : `${ width } px` ;
3434 return createElement (
@@ -62,7 +62,6 @@ export const SizeContainer: FC<SizeProps> = ({
6262} ;
6363
6464SizeContainer . displayName = "SizeContainer" ;
65- SizeContainer . defaultProps = { readOnly : false } ;
6665
6766const getHeight = (
6867 heightUnit : HeightUnitType ,
Original file line number Diff line number Diff line change 11import { shallow , ShallowWrapper } from "enzyme" ;
2- import { createElement , ReactChild } from "react" ;
2+ import { createElement , ReactNode } from "react" ;
33
44import { Alert , AlertProps } from "../Alert" ;
55
66describe ( "Alert" , ( ) => {
7- const renderAlert = ( props : AlertProps , message : ReactChild ) : ShallowWrapper < AlertProps , any > =>
7+ const renderAlert = ( props : AlertProps , message : ReactNode ) : ShallowWrapper < AlertProps , any > =>
88 shallow ( createElement ( Alert , props , message ) ) ;
99 const alertMessage = "This is an error" ;
1010
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ describe("Signature", () => {
4141 } ) ;
4242 const canvasInstance : any = canvas . instance ( ) ;
4343 canvasInstance . canvasNode = document . createElement ( "canvas" ) ;
44- const signaturePadOptions = spyOn ( canvasInstance , "signaturePadOptions" ) . and . callThrough ( ) ;
44+ const signaturePadOptions = jest . spyOn ( canvasInstance , "signaturePadOptions" ) ;
4545 canvasInstance . componentDidMount ( ) ;
4646 expect ( signaturePadOptions ) . toHaveBeenCalled ( ) ;
4747 } ) ;
Original file line number Diff line number Diff line change 2020 "noUnusedParameters" : true ,
2121 "allowSyntheticDefaultImports" : true ,
2222 "esModuleInterop" : true ,
23- "jsx" : " react" ,
24- "jsxFactory" : " createElement"
23+ "jsx" : " react-jsx"
2524 },
2625 "files" : [" ./node_modules/mendix-client/index.d.ts" ],
2726 "include" : [" ./src" , " ./typings" ],
You can’t perform that action at this time.
0 commit comments