studiokit-scaffolding-js 7.0.5-alpha.2 → 7.0.5-alpha.3.2
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.
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ConnectedModalWrappedProps } from './ConnectedModalComponent';
|
|
3
3
|
import { GuidComponentWrappedProps } from './GuidComponent';
|
|
4
|
+
/**
|
|
5
|
+
* The props that are provided to the HOC component directly from the caller, not other wrapping HOCs
|
|
6
|
+
* NOTE: if more flexibility is needed, add more props from `ReactModal.Props`
|
|
7
|
+
*/
|
|
4
8
|
export interface FullscreenModalOwnProps {
|
|
5
9
|
isOpen?: boolean;
|
|
6
10
|
/**
|
|
@@ -10,10 +14,15 @@ export interface FullscreenModalOwnProps {
|
|
|
10
14
|
closeModal?: () => void;
|
|
11
15
|
contentLabel?: string;
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
/** The props that are provided to the HOC component, either directly or from other wrapping HOCs */
|
|
18
|
+
export declare type FullscreenModalComponentProps = FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps;
|
|
19
|
+
/** The props that are provided internally from the HOC to the wrapped component. */
|
|
20
|
+
export interface FullscreenModalProvidedWrappedProps {
|
|
14
21
|
/** Function that will close the modal. */
|
|
15
22
|
closeModal: () => void;
|
|
16
23
|
}
|
|
24
|
+
/** All the props that are provided to the wrapped component. All props are passed through. */
|
|
25
|
+
export declare type FullscreenModalWrappedProps = FullscreenModalProvidedWrappedProps & Omit<FullscreenModalOwnProps, keyof 'contentLabel' | 'closeModal'>;
|
|
17
26
|
export interface FullscreenModalState {
|
|
18
27
|
isOpen: boolean;
|
|
19
28
|
}
|
|
@@ -25,34 +34,35 @@ export interface FullscreenModalState {
|
|
|
25
34
|
*
|
|
26
35
|
* @param WrappedComponent The component to wrap.
|
|
27
36
|
*/
|
|
28
|
-
export declare function configureFullscreenModalComponent<TOwnProps extends
|
|
29
|
-
new (props: TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps): {
|
|
37
|
+
export declare function configureFullscreenModalComponent<TOwnProps extends {}>(WrappedComponent: ComponentType<TOwnProps & FullscreenModalWrappedProps>): {
|
|
38
|
+
new (props: TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps): {
|
|
30
39
|
componentDidMount(): void;
|
|
31
40
|
componentWillUnmount(): void;
|
|
32
|
-
componentDidUpdate(prevProps: TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps, prevState: FullscreenModalState): void;
|
|
41
|
+
componentDidUpdate(prevProps: TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps, prevState: FullscreenModalState): void;
|
|
33
42
|
disableScroll: (e: Event) => boolean;
|
|
34
43
|
onOpen: () => void;
|
|
35
44
|
closeModal: () => void;
|
|
45
|
+
getWrappedProps: () => FullscreenModalWrappedProps;
|
|
36
46
|
render(): React.JSX.Element;
|
|
37
47
|
context: any;
|
|
38
|
-
setState<K extends "isOpen">(state: FullscreenModalState | ((prevState: Readonly<FullscreenModalState>, props: Readonly<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>) => FullscreenModalState | Pick<FullscreenModalState, K> | null) | Pick<FullscreenModalState, K> | null, callback?: (() => void) | undefined): void;
|
|
48
|
+
setState<K extends "isOpen">(state: FullscreenModalState | ((prevState: Readonly<FullscreenModalState>, props: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>) => FullscreenModalState | Pick<FullscreenModalState, K> | null) | Pick<FullscreenModalState, K> | null, callback?: (() => void) | undefined): void;
|
|
39
49
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
40
|
-
readonly props: Readonly<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps> & Readonly<{
|
|
50
|
+
readonly props: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps> & Readonly<{
|
|
41
51
|
children?: React.ReactNode;
|
|
42
52
|
}>;
|
|
43
53
|
state: Readonly<FullscreenModalState>;
|
|
44
54
|
refs: {
|
|
45
55
|
[key: string]: React.ReactInstance;
|
|
46
56
|
};
|
|
47
|
-
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextState: Readonly<FullscreenModalState>, nextContext: any): boolean;
|
|
57
|
+
shouldComponentUpdate?(nextProps: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextState: Readonly<FullscreenModalState>, nextContext: any): boolean;
|
|
48
58
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
49
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, prevState: Readonly<FullscreenModalState>): any;
|
|
59
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, prevState: Readonly<FullscreenModalState>): any;
|
|
50
60
|
componentWillMount?(): void;
|
|
51
61
|
UNSAFE_componentWillMount?(): void;
|
|
52
|
-
componentWillReceiveProps?(nextProps: Readonly<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextContext: any): void;
|
|
53
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextContext: any): void;
|
|
54
|
-
componentWillUpdate?(nextProps: Readonly<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextState: Readonly<FullscreenModalState>, nextContext: any): void;
|
|
55
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextState: Readonly<FullscreenModalState>, nextContext: any): void;
|
|
62
|
+
componentWillReceiveProps?(nextProps: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextContext: any): void;
|
|
63
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextContext: any): void;
|
|
64
|
+
componentWillUpdate?(nextProps: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextState: Readonly<FullscreenModalState>, nextContext: any): void;
|
|
65
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<TOwnProps & FullscreenModalOwnProps & ConnectedModalWrappedProps & GuidComponentWrappedProps>, nextState: Readonly<FullscreenModalState>, nextContext: any): void;
|
|
56
66
|
};
|
|
57
67
|
contextType?: React.Context<any> | undefined;
|
|
58
68
|
};
|
|
@@ -70,5 +80,5 @@ export declare function configureFullscreenModalComponent<TOwnProps extends Full
|
|
|
70
80
|
*
|
|
71
81
|
* @param WrappedComponent The component to wrap.
|
|
72
82
|
*/
|
|
73
|
-
export declare function fullscreenModalComponent<TOwnProps extends
|
|
83
|
+
export declare function fullscreenModalComponent<TOwnProps extends FullscreenModalWrappedProps>(WrappedComponent: ComponentType<TOwnProps>): ComponentType<Omit<TOwnProps, keyof FullscreenModalProvidedWrappedProps>>;
|
|
74
84
|
export default fullscreenModalComponent;
|
|
@@ -42,6 +42,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
42
42
|
__setModuleDefault(result, mod);
|
|
43
43
|
return result;
|
|
44
44
|
};
|
|
45
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
+
var t = {};
|
|
47
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
+
t[p] = s[p];
|
|
49
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
+
t[p[i]] = s[p[i]];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
45
56
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
57
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
58
|
};
|
|
@@ -82,6 +93,11 @@ function configureFullscreenModalComponent(WrappedComponent) {
|
|
|
82
93
|
isOpen: false
|
|
83
94
|
});
|
|
84
95
|
};
|
|
96
|
+
_this.getWrappedProps = function () {
|
|
97
|
+
var _a = _this.props, contentLabel = _a.contentLabel, isTopOpenFullscreenModal = _a.isTopOpenFullscreenModal, onEntering = _a.onEntering, onExited = _a.onExited, _ = _a.isOpen, closeModal = _a.closeModal, guid = _a.guid, remainingProps = __rest(_a, ["contentLabel", "isTopOpenFullscreenModal", "onEntering", "onExited", "isOpen", "closeModal", "guid"]);
|
|
98
|
+
var wrappedProps = __assign(__assign({}, remainingProps), { closeModal: _this.closeModal });
|
|
99
|
+
return wrappedProps;
|
|
100
|
+
};
|
|
85
101
|
_this.state = {
|
|
86
102
|
isOpen: props.isOpen === undefined ? true : props.isOpen
|
|
87
103
|
};
|
|
@@ -122,7 +138,8 @@ function configureFullscreenModalComponent(WrappedComponent) {
|
|
|
122
138
|
});
|
|
123
139
|
};
|
|
124
140
|
FullscreenModalComponent.prototype.render = function () {
|
|
125
|
-
var _a = this.props, contentLabel = _a.contentLabel, isTopOpenFullscreenModal = _a.isTopOpenFullscreenModal;
|
|
141
|
+
var _a = this.props, contentLabel = _a.contentLabel, isTopOpenFullscreenModal = _a.isTopOpenFullscreenModal, onEntering = _a.onEntering, onExited = _a.onExited, _ = _a.isOpen, closeModal = _a.closeModal, guid = _a.guid, remainingProps = __rest(_a, ["contentLabel", "isTopOpenFullscreenModal", "onEntering", "onExited", "isOpen", "closeModal", "guid"]);
|
|
142
|
+
var wrappedProps = __assign(__assign({}, remainingProps), { closeModal: this.closeModal });
|
|
126
143
|
var isOpen = this.state.isOpen;
|
|
127
144
|
return (react_1.default.createElement(react_modal_1.default, { isOpen: isOpen, contentLabel: contentLabel, style: {
|
|
128
145
|
content: {
|
|
@@ -147,7 +164,7 @@ function configureFullscreenModalComponent(WrappedComponent) {
|
|
|
147
164
|
},
|
|
148
165
|
// hide the rendered portal if this is not the top open fullscreen modal
|
|
149
166
|
portalClassName: "ReactModalPortal" + (!isTopOpenFullscreenModal ? ' dn' : ''), shouldCloseOnOverlayClick: false },
|
|
150
|
-
react_1.default.createElement(WrappedComponent, __assign({},
|
|
167
|
+
react_1.default.createElement(WrappedComponent, __assign({}, wrappedProps))));
|
|
151
168
|
};
|
|
152
169
|
return FullscreenModalComponent;
|
|
153
170
|
}(react_1.Component));
|
|
@@ -169,6 +186,7 @@ exports.configureFullscreenModalComponent = configureFullscreenModalComponent;
|
|
|
169
186
|
*/
|
|
170
187
|
function fullscreenModalComponent(WrappedComponent) {
|
|
171
188
|
var component = configureFullscreenModalComponent(WrappedComponent);
|
|
189
|
+
// @ts-ignore: could not match inferred type from the `connect` HOC
|
|
172
190
|
return ConnectedModalComponent_1.connectedModalComponent(component, true);
|
|
173
191
|
}
|
|
174
192
|
exports.fullscreenModalComponent = fullscreenModalComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "studiokit-scaffolding-js",
|
|
3
|
-
"version": "7.0.5-alpha.2",
|
|
3
|
+
"version": "7.0.5-alpha.3.2",
|
|
4
4
|
"description": "Common scaffolding for Studio apps at Purdue",
|
|
5
5
|
"repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
|
|
6
6
|
"license": "MIT",
|