@dvrd/dvr-controls 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +0 -2
- package/package.json +9 -9
- package/src/js/button/button.tsx +2 -2
- package/src/js/button/buttonController.tsx +1 -0
- package/src/js/button/outlinedButton.tsx +2 -2
- package/src/js/button/simpleButton.tsx +3 -1
- package/src/js/checkbox/checkbox.tsx +1 -0
- package/src/js/dialog/dialog.tsx +1 -0
- package/src/js/dialog/inlineDialog.tsx +2 -1
- package/src/js/events/withEvents.tsx +2 -2
- package/src/js/header/DVRHeader.tsx +2 -0
- package/src/js/info/info.tsx +1 -0
- package/src/js/input/date/dateField.tsx +1 -0
- package/src/js/input/date/datePicker/datePicker.tsx +1 -0
- package/src/js/input/date/timePicker/timePicker.tsx +1 -0
- package/src/js/input/simple/v2/simpleInputV2.tsx +4 -3
- package/src/js/input/v2/inputController_v2.tsx +3 -2
- package/src/js/label/label.tsx +2 -0
- package/src/js/loader/loaderController.tsx +1 -0
- package/src/js/navigator/navigator.tsx +37 -18
- package/src/js/pdf/element/pdfElement.tsx +2 -2
- package/src/js/popup/withBackground.tsx +2 -2
- package/src/js/select/select.tsx +2 -0
- package/src/js/select/selectController.tsx +1 -1
- package/src/js/sidebarMenu/sidebarMenu.tsx +9 -2
- package/src/js/slider/DVRSlider.tsx +1 -1
- package/src/js/snackbar/snackbar.tsx +1 -0
- package/src/js/snackbar/snackbarController.tsx +7 -5
- package/src/js/switch/switchController.tsx +1 -1
- package/src/js/topButton/topButton.tsx +1 -0
- package/src/js/util/miscUtil.ts +4 -0
- package/src/js/analytics/analyticsRouter.tsx +0 -31
package/index.ts
CHANGED
|
@@ -30,7 +30,6 @@ import InputControllerV2 from './src/js/input/v2/inputController_v2';
|
|
|
30
30
|
import WithEvents from './src/js/events/withEvents';
|
|
31
31
|
import AppNavigator from "./src/js/navigator/navigator";
|
|
32
32
|
import DVRHead from './src/js/head/DVRHead';
|
|
33
|
-
import AnalyticsRouter from './src/js/analytics/analyticsRouter';
|
|
34
33
|
import TopButton from './src/js/topButton/topButton';
|
|
35
34
|
import DVRCarouselController from './src/js/carousel/DVRCarouselController';
|
|
36
35
|
import DVRSlider from './src/js/slider/DVRSlider';
|
|
@@ -76,7 +75,6 @@ export {
|
|
|
76
75
|
WithEvents,
|
|
77
76
|
AppNavigator,
|
|
78
77
|
DVRHead,
|
|
79
|
-
AnalyticsRouter,
|
|
80
78
|
TopButton,
|
|
81
79
|
DVRCarouselController as DVRCarousel,
|
|
82
80
|
DVRSlider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvrd/dvr-controls",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Custom web controls",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {},
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@types/js-cookie": "^2.2.6",
|
|
20
|
-
"@types/lodash": "^4.14.
|
|
20
|
+
"@types/lodash": "^4.14.181",
|
|
21
21
|
"@types/node": "^14.14.34",
|
|
22
|
-
"@types/react": "^
|
|
23
|
-
"@types/react-dom": "^
|
|
24
|
-
"@types/react-router-dom": "^5.
|
|
22
|
+
"@types/react": "^18.0.5",
|
|
23
|
+
"@types/react-dom": "^18.0.0",
|
|
24
|
+
"@types/react-router-dom": "^5.3.3",
|
|
25
25
|
"@types/uuid": "^8.3.0",
|
|
26
26
|
"@types/react-color": "^3.0.6",
|
|
27
27
|
"@types/dompurify": "^2.2.3",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"js-cookie": "^2.2.1",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"moment": "^2.29.1",
|
|
33
|
-
"react": "^
|
|
34
|
-
"react-dom": "^
|
|
33
|
+
"react": "^18.0.0",
|
|
34
|
+
"react-dom": "^18.0.0",
|
|
35
35
|
"react-color": "^2.19.3",
|
|
36
|
-
"react-router-dom": "^
|
|
36
|
+
"react-router-dom": "^6.3.0",
|
|
37
37
|
"react-rnd": "^10.3.5",
|
|
38
|
-
"typescript": "^4.
|
|
38
|
+
"typescript": "^4.6.3",
|
|
39
39
|
"uuid": "^8.3.2",
|
|
40
40
|
"dompurify": "^2.3.3"
|
|
41
41
|
}
|
package/src/js/button/button.tsx
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import './style/button.scss';
|
|
6
6
|
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { PropsWithChildren } from 'react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import {convertColor, editColor, ThemeShape} from "../../..";
|
|
10
10
|
import {isNotNull, isNull} from "../util/controlUtil";
|
|
@@ -29,7 +29,7 @@ interface Props {
|
|
|
29
29
|
tabIndex?: number;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export class Button extends React.Component<Props
|
|
32
|
+
export class Button extends React.Component<PropsWithChildren<Props>> {
|
|
33
33
|
getContainerClass = (): string => {
|
|
34
34
|
const {disabled, withRipple, padding, containerClass} = this.props,
|
|
35
35
|
classes = ['buttonController'];
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import './style/outlinedButton.scss';
|
|
6
6
|
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { PropsWithChildren } from 'react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import {colorIsWhite, convertColor, editColor} from "../util/colorUtil";
|
|
10
10
|
import {isNotNull, isNull} from "../util/controlUtil";
|
|
@@ -29,7 +29,7 @@ interface ButtonProps {
|
|
|
29
29
|
tabIndex?: number;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export class OutlinedButton extends React.Component<ButtonProps
|
|
32
|
+
export class OutlinedButton extends React.Component<PropsWithChildren<ButtonProps>> {
|
|
33
33
|
getContainerClass = (): string => {
|
|
34
34
|
const {containerClass, disabled, padding} = this.props, classes: string[] = ['outlinedButtonContainer'];
|
|
35
35
|
if (disabled) classes.push('disabled');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import './style/simpleButton.scss';
|
|
6
6
|
|
|
7
|
-
import React, {CSSProperties, PureComponent} from 'react';
|
|
7
|
+
import React, {CSSProperties, PureComponent, ReactNode} from 'react';
|
|
8
8
|
import {ControlContext} from "../util/controlContext";
|
|
9
9
|
import {colorIsWhite, convertColor, editColor} from "../util/colorUtil";
|
|
10
10
|
import {ControlPadding, ElementPosition, OrnamentShape} from "../util/interfaces";
|
|
@@ -29,9 +29,11 @@ interface Props {
|
|
|
29
29
|
withRipple: boolean;
|
|
30
30
|
primary: boolean;
|
|
31
31
|
tabIndex?: number;
|
|
32
|
+
children?: ReactNode | ReactNode[] | OrnamentShape | OrnamentShape[];
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export default class SimpleButton extends PureComponent<Props> {
|
|
36
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
35
37
|
static contextType = ControlContext;
|
|
36
38
|
|
|
37
39
|
getBaseColor = (trueBase: boolean = false): string => {
|
package/src/js/dialog/dialog.tsx
CHANGED
|
@@ -25,8 +25,9 @@ interface DialogProps {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export default class InlineDialog extends React.Component<DialogProps> {
|
|
28
|
-
|
|
28
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
29
29
|
static contextType = ControlContext;
|
|
30
|
+
|
|
30
31
|
static defaultProps = {
|
|
31
32
|
title: 'Bericht van Klaverjassen',
|
|
32
33
|
actions: null,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { PropsWithChildren } from 'react';
|
|
6
6
|
import {addCustomEventListener, removeCustomEventListener} from '../util/eventUtil';
|
|
7
7
|
import {CustomAppEvent} from '../util/interfaces';
|
|
8
8
|
import {generateComponentId} from "../util/componentUtil";
|
|
@@ -12,7 +12,7 @@ interface Props {
|
|
|
12
12
|
componentName?: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export default class WithEvents extends React.PureComponent<Props
|
|
15
|
+
export default class WithEvents extends React.PureComponent<PropsWithChildren<Props>> {
|
|
16
16
|
private readonly componentName: string;
|
|
17
17
|
|
|
18
18
|
constructor(props: Props) {
|
|
@@ -62,7 +62,9 @@ enum Phase {HEADER = 'header', MENU = 'menu', CALCULATING = 'calculating'}
|
|
|
62
62
|
const RESIZE_TIMEOUT = Math.ceil(1000 / 120); // 30 fps
|
|
63
63
|
|
|
64
64
|
export default class DVRHeader extends PureComponent<Props, State> {
|
|
65
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
65
66
|
static contextType = ControlContext;
|
|
67
|
+
|
|
66
68
|
static defaultProps = {
|
|
67
69
|
forcedMenu: false,
|
|
68
70
|
containerClass: '',
|
package/src/js/info/info.tsx
CHANGED
|
@@ -57,6 +57,7 @@ interface State {
|
|
|
57
57
|
export enum PickerKey {DAY = 'day', MONTH = 'month', YEAR = 'year'}
|
|
58
58
|
|
|
59
59
|
export default class DateField extends PureComponent<Props, State> {
|
|
60
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
60
61
|
static contextType = ControlContext;
|
|
61
62
|
|
|
62
63
|
constructor(props: Props) {
|
|
@@ -21,6 +21,7 @@ interface Props {
|
|
|
21
21
|
const SCROLL_TIMEOUT = 120;
|
|
22
22
|
|
|
23
23
|
export default class TimePicker extends PureComponent<Props> {
|
|
24
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
24
25
|
static contextType = ControlContext;
|
|
25
26
|
|
|
26
27
|
private hourTimeout: number | null = null;
|
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import '../style/simpleInput.scss';
|
|
6
6
|
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import {CSSProperties, PureComponent} from 'react';
|
|
7
|
+
import React, {CSSProperties, PureComponent} from 'react';
|
|
9
8
|
import classNames from "classnames";
|
|
10
9
|
import {ControlContext} from "../../../util/controlContext";
|
|
11
10
|
import {colorIsWhite, convertColor, editColor} from "../../../util/colorUtil";
|
|
12
|
-
import {
|
|
11
|
+
import {ElementPosition, OrnamentShape} from "../../../util/interfaces";
|
|
13
12
|
import AwesomeIcon from '../../../icon/awesomeIcon';
|
|
14
13
|
import {stopPropagation} from "../../../util/controlUtil";
|
|
15
14
|
import {DVRInputProps} from "../../v2/inputController_v2";
|
|
16
15
|
|
|
17
16
|
export default class SimpleInput extends PureComponent<DVRInputProps> {
|
|
17
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
18
18
|
static contextType = ControlContext;
|
|
19
|
+
|
|
19
20
|
private input: HTMLInputElement | HTMLTextAreaElement | null = null;
|
|
20
21
|
|
|
21
22
|
private onFocus = (evt: React.FocusEvent) => {
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React, {
|
|
5
5
|
ChangeEventHandler, CSSProperties, EventHandler, FocusEventHandler, InputHTMLAttributes, KeyboardEventHandler,
|
|
6
|
-
MouseEventHandler, PureComponent, TextareaHTMLAttributes
|
|
6
|
+
MouseEventHandler, PureComponent, ReactNode, TextareaHTMLAttributes
|
|
7
7
|
} from 'react';
|
|
8
8
|
import {assert, enterPressed} from "../../util/controlUtil";
|
|
9
9
|
import SimpleInput from "../simple/v2/simpleInputV2";
|
|
10
10
|
import {ControlVariant, ErrorType, OrnamentShape} from "../../util/interfaces";
|
|
11
11
|
import { generateComponentId } from '../../../..';
|
|
12
12
|
|
|
13
|
-
type HTMLProps = Omit<InputHTMLAttributes<any>, 'onChange' | 'step'>;
|
|
13
|
+
type HTMLProps = Omit<InputHTMLAttributes<any>, 'onChange' | 'step' | 'children'>;
|
|
14
14
|
|
|
15
15
|
export interface DVRInputControllerProps extends HTMLProps {
|
|
16
16
|
// Events
|
|
@@ -44,6 +44,7 @@ export interface DVRInputControllerProps extends HTMLProps {
|
|
|
44
44
|
value?: string | number;
|
|
45
45
|
step?: number;
|
|
46
46
|
unControlled?: boolean;
|
|
47
|
+
children?: ReactNode | ReactNode[] | OrnamentShape | OrnamentShape[];
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export interface DVRInputProps extends Omit<DVRInputControllerProps, 'value' | 'onChange'> {
|
package/src/js/label/label.tsx
CHANGED
|
@@ -37,7 +37,9 @@ interface State {
|
|
|
37
37
|
* text until the number of lines is reached. Remaining text will be shown in the title.
|
|
38
38
|
*/
|
|
39
39
|
export default class Label extends React.Component<Props, State> {
|
|
40
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
40
41
|
static contextType = ControlContext;
|
|
42
|
+
|
|
41
43
|
static defaultProps = {
|
|
42
44
|
labelType: LabelType.LABEL,
|
|
43
45
|
className: '',
|
|
@@ -23,6 +23,7 @@ interface LoaderProps {
|
|
|
23
23
|
|
|
24
24
|
export default class LoaderController extends React.Component<LoaderProps> {
|
|
25
25
|
// noinspection JSUnusedGlobalSymbols
|
|
26
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
26
27
|
static contextType = ControlContext;
|
|
27
28
|
|
|
28
29
|
static defaultProps = {
|
|
@@ -3,30 +3,49 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import {RouteComponentProps, withRouter} from "react-router";
|
|
6
|
+
// import {RouteComponentProps, withRouter} from "react-router";
|
|
7
|
+
import { useNavigate } from 'react-router-dom';
|
|
8
|
+
import { useLocation } from 'react-router-dom';
|
|
7
9
|
import {debug} from '../util/miscUtil';
|
|
8
10
|
|
|
9
|
-
let navigationData: any = null;
|
|
11
|
+
// let navigationData: any = null;
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
13
|
+
export default function AppNavigator() {
|
|
14
|
+
const location = useLocation();
|
|
15
|
+
const navigate = useNavigate();
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const {location, history} = this.props;
|
|
20
|
-
const navigator = evt.target,
|
|
21
|
-
url = navigator.dataset.url + (navigator.dataset.strip === '0' ? location.search : '');
|
|
17
|
+
function onNavigate(evt: React.MouseEvent) {
|
|
18
|
+
const navigator: HTMLButtonElement = evt.target as HTMLButtonElement;
|
|
19
|
+
const url = navigator.dataset.url + (navigator.dataset.strip === '0' ? location.search : '');
|
|
22
20
|
navigator.dataset.strip = '0';
|
|
23
21
|
debug(`Navigating to ${url}`);
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
render = () => {
|
|
28
|
-
return <button id='appNavigator' style={{display: 'none'}} data-url='' data-strip='0' onClick={this.navigate}/>
|
|
22
|
+
navigate(url);
|
|
29
23
|
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<button id='appNavigator' style={{display: 'none'}} data-url='' data-strip='0' onClick={onNavigate}/>
|
|
27
|
+
)
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
// class AppNavigator extends React.Component<RouteComponentProps> {
|
|
31
|
+
// static setNavigationData = (data: any) => {
|
|
32
|
+
// navigationData = data;
|
|
33
|
+
// };
|
|
34
|
+
//
|
|
35
|
+
// static getNavigationData = (): any => navigationData;
|
|
36
|
+
//
|
|
37
|
+
// navigate = (evt: any) => {
|
|
38
|
+
// const {location, history} = this.props;
|
|
39
|
+
// const navigator = evt.target,
|
|
40
|
+
// url = navigator.dataset.url + (navigator.dataset.strip === '0' ? location.search : '');
|
|
41
|
+
// navigator.dataset.strip = '0';
|
|
42
|
+
// debug(`Navigating to ${url}`);
|
|
43
|
+
// history.push(url);
|
|
44
|
+
// };
|
|
45
|
+
//
|
|
46
|
+
// render = () => {
|
|
47
|
+
// return <button id='appNavigator' style={{display: 'none'}} data-url='' data-strip='0' onClick={this.navigate}/>
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
//
|
|
51
|
+
// export default withRouter(AppNavigator);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import './style/pdfElement.scss';
|
|
5
5
|
|
|
6
|
-
import React, {MouseEventHandler, PureComponent} from 'react';
|
|
6
|
+
import React, {MouseEventHandler, PropsWithChildren, PureComponent} from 'react';
|
|
7
7
|
import {DraggableData, HandleClasses, HandleStyles, ResizeEnable, Rnd} from 'react-rnd';
|
|
8
8
|
import {
|
|
9
9
|
CustomAppEvent, ElementPosition, IndexedObject, PDFElementDimensions, PDFElementParams, PDFElementPersist, PdfFont,
|
|
@@ -145,7 +145,7 @@ interface DraggableState {
|
|
|
145
145
|
height: number | string;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
export class PDFDraggable extends PureComponent<DraggableProps
|
|
148
|
+
export class PDFDraggable extends PureComponent<PropsWithChildren<DraggableProps>, DraggableState> {
|
|
149
149
|
static defaultProps = {
|
|
150
150
|
resizeable: true,
|
|
151
151
|
resizeHoriz: true,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import './style/withBackground.scss';
|
|
6
6
|
|
|
7
|
-
import React, {CSSProperties} from 'react';
|
|
7
|
+
import React, {CSSProperties, PropsWithChildren} from 'react';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import {escapePressed, hasHover} from "../util/controlUtil";
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ interface Props {
|
|
|
21
21
|
zIndex?: number;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export default class WithBackground extends React.Component<Props
|
|
24
|
+
export default class WithBackground extends React.Component<PropsWithChildren<Props>> {
|
|
25
25
|
static defaultProps = {
|
|
26
26
|
backgroundColor: 'rgba(0,0,0,.2)',
|
|
27
27
|
transparent: false,
|
package/src/js/select/select.tsx
CHANGED
|
@@ -62,7 +62,9 @@ interface Props {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export class Select extends React.Component<Props> {
|
|
65
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
65
66
|
static contextType = ControlContext;
|
|
67
|
+
|
|
66
68
|
getBaseColor = (allowWhite: boolean = true): string => {
|
|
67
69
|
const {baseColor} = this.props, {contrastColor} = this.context;
|
|
68
70
|
let color = convertColor(baseColor);
|
|
@@ -83,7 +83,7 @@ interface State {
|
|
|
83
83
|
|
|
84
84
|
// noinspection JSUnusedGlobalSymbols
|
|
85
85
|
export default class SelectController extends React.Component<SelectProps, State> {
|
|
86
|
-
|
|
86
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
87
87
|
static contextType = ControlContext;
|
|
88
88
|
|
|
89
89
|
static defaultProps = SelectDefaultProps;
|
|
@@ -7,7 +7,7 @@ import React, {MouseEventHandler, ReactNode, useContext, useEffect, useRef, useS
|
|
|
7
7
|
import {useLocation} from 'react-router';
|
|
8
8
|
import {SidebarItem, SideMenuMode} from "../util/interfaces";
|
|
9
9
|
import classNames from 'classnames';
|
|
10
|
-
import {AwesomeIcon, generateComponentId} from "../../../index";
|
|
10
|
+
import {AwesomeIcon, generateComponentId, isAbsoluteLink} from "../../../index";
|
|
11
11
|
import {ControlContext} from "../util/controlContext";
|
|
12
12
|
import {defer} from 'lodash';
|
|
13
13
|
|
|
@@ -67,7 +67,14 @@ export default function SidebarMenu(props: Props) {
|
|
|
67
67
|
function _onClickItem(item: SidebarItem) {
|
|
68
68
|
return function (evt: React.MouseEvent) {
|
|
69
69
|
evt.stopPropagation();
|
|
70
|
-
|
|
70
|
+
const {route} = item;
|
|
71
|
+
let _route: string | null = null;
|
|
72
|
+
if (route) {
|
|
73
|
+
if (Array.isArray(route) && route.length) _route = route[0];
|
|
74
|
+
else _route = route as string;
|
|
75
|
+
}
|
|
76
|
+
if (_route && !isAbsoluteLink(_route))
|
|
77
|
+
setActiveItem(item.id);
|
|
71
78
|
onClickItem(item)(evt);
|
|
72
79
|
}
|
|
73
80
|
}
|
|
@@ -36,7 +36,7 @@ export default class DVRSlider extends PureComponent<Props> {
|
|
|
36
36
|
labelClassName: '',
|
|
37
37
|
labelPosition: ElementPosition.RIGHT,
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
40
40
|
static contextType = ControlContext;
|
|
41
41
|
|
|
42
42
|
constructor(props: Props) {
|
|
@@ -22,6 +22,7 @@ interface ViewProps {
|
|
|
22
22
|
|
|
23
23
|
export class Snackbar extends React.Component<ViewProps> {
|
|
24
24
|
// noinspection JSUnusedGlobalSymbols
|
|
25
|
+
declare context: React.ContextType<typeof ControlContext>;
|
|
25
26
|
static contextType = ControlContext;
|
|
26
27
|
|
|
27
28
|
getBackgroundColor = (): string => {
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import {Snackbar} from "./snackbar";
|
|
7
7
|
import {CustomAppEvent, DialogConfig, Snack} from "../util/interfaces";
|
|
8
8
|
import WithEvents from '../events/withEvents';
|
|
9
|
-
import {
|
|
9
|
+
import {delay} from 'lodash';
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
containerClass: string;
|
|
@@ -94,9 +94,11 @@ export default class SnackbarController extends React.Component<Props, State> {
|
|
|
94
94
|
|
|
95
95
|
render = () => {
|
|
96
96
|
const {snack, active} = this.state, {containerClass, textClass, textColor, backgroundColor} = this.props;
|
|
97
|
-
return
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
return (
|
|
98
|
+
<WithEvents events={this.getEvents()}>
|
|
99
|
+
<Snackbar snack={snack} containerClass={containerClass} textClass={textClass} active={active}
|
|
100
|
+
onClick={this.onClick} textColor={textColor} backgroundColor={backgroundColor}/>
|
|
101
|
+
</WithEvents>
|
|
102
|
+
)
|
|
101
103
|
};
|
|
102
104
|
}
|
|
@@ -33,7 +33,7 @@ interface SwitchState {
|
|
|
33
33
|
|
|
34
34
|
// noinspection JSUnusedGlobalSymbols
|
|
35
35
|
export default class SwitchController extends React.Component<SwitchProps, SwitchState> {
|
|
36
|
-
|
|
36
|
+
declare context: React.ContextType<typeof ControlContext>
|
|
37
37
|
static contextType = ControlContext;
|
|
38
38
|
|
|
39
39
|
static defaultProps = {
|
package/src/js/util/miscUtil.ts
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Dave van Rijn Development
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import {RouteComponentProps, withRouter} from 'react-router-dom';
|
|
7
|
-
import {Location} from 'history';
|
|
8
|
-
|
|
9
|
-
class AnalyticsRouter extends React.Component<RouteComponentProps> {
|
|
10
|
-
private lastPathname: string;
|
|
11
|
-
componentDidMount = () => {
|
|
12
|
-
this.sendPageView(this.props.location);
|
|
13
|
-
this.props.history.listen(this.sendPageView);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
sendPageView = (location: Location) => {
|
|
17
|
-
if (!window.gtag) {
|
|
18
|
-
console.debug('gtag function not found.');
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (this.lastPathname === location.pathname) return;
|
|
22
|
-
this.lastPathname = location.pathname;
|
|
23
|
-
|
|
24
|
-
window.gtag('set', 'page', location.pathname)
|
|
25
|
-
window.gtag('send', 'pageview');
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
render = () => this.props.children;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default withRouter(AnalyticsRouter);
|