@ringcentral/juno 1.11.2 → 1.11.3-beta.5620-d9154e6b
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/README.md +0 -10
- package/components/Dialog/Dialog.d.ts +17 -4
- package/components/Dialog/Dialog.js +21 -8
- package/components/Dialog/DialogActions/DialogActions.d.ts +15 -5
- package/components/Dialog/DialogActions/DialogActions.js +13 -7
- package/components/Dialog/DialogActions/styles/DialogActionsStyle.js +20 -8
- package/components/Dialog/DialogActions/utils/DialogActionsUtils.d.ts +2 -2
- package/components/Dialog/DialogActions/utils/DialogActionsUtils.js +2 -5
- package/components/Dialog/DialogContent/DialogContent.d.ts +4 -4
- package/components/Dialog/DialogContent/DialogContent.js +5 -6
- package/components/Dialog/DialogContent/styles/DialogContentStyle.js +2 -4
- package/components/Dialog/DialogContent/utils/DialogContentUtils.d.ts +1 -2
- package/components/Dialog/DialogContent/utils/DialogContentUtils.js +6 -6
- package/components/Dialog/DialogContentText/DialogContentText.d.ts +4 -3
- package/components/Dialog/DialogContentText/DialogContentText.js +9 -8
- package/components/Dialog/DialogContentText/styles/DialogContentTextStyle.js +4 -2
- package/components/Dialog/DialogTitle/DialogTitle.d.ts +4 -4
- package/components/Dialog/DialogTitle/DialogTitle.js +6 -7
- package/components/Dialog/DialogTitle/styles/DialogTitleStyle.js +4 -5
- package/components/Dialog/DialogTitle/utils/DialogTitleUtils.d.ts +4 -2
- package/components/Dialog/DialogTitle/utils/DialogTitleUtils.js +6 -5
- package/components/Dialog/utils/DialogContext.d.ts +15 -0
- package/components/Dialog/utils/DialogContext.js +33 -0
- package/components/Dialog/utils/index.d.ts +1 -0
- package/components/Dialog/utils/index.js +1 -0
- package/components/Downshift/Downshift.d.ts +23 -2
- package/components/Downshift/Downshift.js +11 -8
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +6 -4
- package/components/Downshift/SuggestionList/SuggestionList.js +17 -10
- package/components/Downshift/SuggestionList/utils/SuggestionListUtils.d.ts +1 -1
- package/components/Downshift/SuggestionList/utils/SuggestionListUtils.js +1 -1
- package/components/Downshift/utils/useDownshift.d.ts +3 -2
- package/components/Downshift/utils/useDownshift.js +7 -3
- package/components/Downshift/utils/useDownshiftGroup.d.ts +6 -4
- package/components/Downshift/utils/useDownshiftGroup.js +31 -9
- package/components/Forms/Picker/DatePicker/Calendar.js +5 -4
- package/components/Forms/Picker/DatePicker/DatePickerHeader.js +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.d.ts +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.js +1 -1
- package/components/Forms/Switch/styles/SwitchStyle.js +1 -1
- package/components/Icon/assets/icon-add-reactions.svg +5 -1
- package/components/Icon/assets/icon-connect.svg +5 -0
- package/components/Icon/assets/icon-customize-tabs.svg +5 -0
- package/components/Icon/icon-symbol.d.ts +1 -1
- package/components/Icon/icon-symbol.js +1 -1
- package/components/List/ListItem/ListItem.js +0 -1
- package/components/List/ListItem/styles/ListItemStyle.js +1 -1
- package/components/PopupBox/PopupBox.d.ts +2 -2
- package/components/PopupBox/PopupBox.js +8 -10
- package/components/PortalHost/Connectable/Connectable.d.ts +11 -0
- package/components/PortalHost/Connectable/Connectable.js +50 -0
- package/components/PortalHost/Connectable/ThrottleScheduler.d.ts +8 -0
- package/components/PortalHost/Connectable/ThrottleScheduler.js +27 -0
- package/components/PortalHost/Connectable/index.d.ts +3 -0
- package/components/PortalHost/Connectable/index.js +8 -0
- package/components/PortalHost/Connectable/types.d.ts +7 -0
- package/components/PortalHost/Connectable/types.js +3 -0
- package/components/PortalHost/PortalHost.d.ts +7 -0
- package/components/PortalHost/PortalHost.js +44 -0
- package/components/PortalHost/PortalManager/PortalManager.d.ts +65 -0
- package/components/PortalHost/PortalManager/PortalManager.js +274 -0
- package/components/PortalHost/PortalManager/PortalStore.d.ts +20 -0
- package/components/PortalHost/PortalManager/PortalStore.js +134 -0
- package/components/PortalHost/PortalManager/index.d.ts +4 -0
- package/components/PortalHost/PortalManager/index.js +9 -0
- package/components/PortalHost/PortalManager/types.d.ts +86 -0
- package/components/PortalHost/PortalManager/types.js +3 -0
- package/components/PortalHost/PortalManager/utils.d.ts +8 -0
- package/components/PortalHost/PortalManager/utils.js +19 -0
- package/components/PortalHost/PortalRenderer.d.ts +10 -0
- package/components/PortalHost/PortalRenderer.js +43 -0
- package/components/PortalHost/context/PortalIDContext.d.ts +5 -0
- package/components/PortalHost/context/PortalIDContext.js +5 -0
- package/components/PortalHost/context/PortalManagerContext.d.ts +6 -0
- package/components/PortalHost/context/PortalManagerContext.js +5 -0
- package/components/PortalHost/context/index.d.ts +2 -0
- package/components/PortalHost/context/index.js +7 -0
- package/components/PortalHost/index.d.ts +4 -0
- package/components/PortalHost/index.js +9 -0
- package/components/PortalHost/utils/index.d.ts +2 -0
- package/components/PortalHost/utils/index.js +7 -0
- package/components/PortalHost/utils/usePortalManagerWithID.d.ts +8 -0
- package/components/PortalHost/utils/usePortalManagerWithID.js +12 -0
- package/components/PortalHost/utils/useUnmountPortalHandler.d.ts +5 -0
- package/components/PortalHost/utils/useUnmountPortalHandler.js +16 -0
- package/components/Snackbar/Snackbar.js +4 -2
- package/components/Virtuoso/utils/useHighlightScroll.d.ts +2 -1
- package/components/Virtuoso/utils/useHighlightScroll.js +4 -2
- package/components/index.d.ts +2 -1
- package/components/index.js +2 -1
- package/es6/components/Dialog/Dialog.js +22 -10
- package/es6/components/Dialog/DialogActions/DialogActions.js +11 -5
- package/es6/components/Dialog/DialogActions/styles/DialogActionsStyle.js +19 -7
- package/es6/components/Dialog/DialogActions/utils/DialogActionsUtils.js +2 -5
- package/es6/components/Dialog/DialogContent/DialogContent.js +3 -4
- package/es6/components/Dialog/DialogContent/styles/DialogContentStyle.js +3 -5
- package/es6/components/Dialog/DialogContent/utils/DialogContentUtils.js +6 -6
- package/es6/components/Dialog/DialogContentText/DialogContentText.js +7 -6
- package/es6/components/Dialog/DialogContentText/styles/DialogContentTextStyle.js +4 -2
- package/es6/components/Dialog/DialogTitle/DialogTitle.js +5 -6
- package/es6/components/Dialog/DialogTitle/styles/DialogTitleStyle.js +4 -5
- package/es6/components/Dialog/DialogTitle/utils/DialogTitleUtils.js +6 -5
- package/es6/components/Dialog/utils/DialogContext.js +31 -0
- package/es6/components/Dialog/utils/index.js +1 -0
- package/es6/components/Downshift/Downshift.js +11 -8
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +17 -10
- package/es6/components/Downshift/SuggestionList/utils/SuggestionListUtils.js +1 -1
- package/es6/components/Downshift/utils/useDownshift.js +7 -3
- package/es6/components/Downshift/utils/useDownshiftGroup.js +33 -11
- package/es6/components/Forms/Picker/DatePicker/Calendar.js +6 -5
- package/es6/components/Forms/Picker/DatePicker/DatePickerHeader.js +1 -1
- package/es6/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.js +2 -2
- package/es6/components/Forms/Switch/styles/SwitchStyle.js +1 -1
- package/es6/components/Icon/assets/icon-add-reactions.svg +5 -1
- package/es6/components/Icon/assets/icon-connect.svg +5 -0
- package/es6/components/Icon/assets/icon-customize-tabs.svg +5 -0
- package/es6/components/Icon/icon-symbol.js +1 -1
- package/es6/components/List/ListItem/ListItem.js +0 -1
- package/es6/components/List/ListItem/styles/ListItemStyle.js +1 -1
- package/es6/components/PopupBox/PopupBox.js +8 -10
- package/es6/components/PortalHost/Connectable/Connectable.js +48 -0
- package/es6/components/PortalHost/Connectable/ThrottleScheduler.js +25 -0
- package/es6/components/PortalHost/Connectable/index.js +3 -0
- package/es6/components/PortalHost/Connectable/types.js +1 -0
- package/es6/components/PortalHost/PortalHost.js +35 -0
- package/es6/components/PortalHost/PortalManager/PortalManager.js +272 -0
- package/es6/components/PortalHost/PortalManager/PortalStore.js +132 -0
- package/es6/components/PortalHost/PortalManager/index.js +4 -0
- package/es6/components/PortalHost/PortalManager/types.js +1 -0
- package/es6/components/PortalHost/PortalManager/utils.js +17 -0
- package/es6/components/PortalHost/PortalRenderer.js +34 -0
- package/es6/components/PortalHost/context/PortalIDContext.js +3 -0
- package/es6/components/PortalHost/context/PortalManagerContext.js +3 -0
- package/es6/components/PortalHost/context/index.js +2 -0
- package/es6/components/PortalHost/index.js +4 -0
- package/es6/components/PortalHost/utils/index.js +2 -0
- package/es6/components/PortalHost/utils/usePortalManagerWithID.js +10 -0
- package/es6/components/PortalHost/utils/useUnmountPortalHandler.js +14 -0
- package/es6/components/Snackbar/Snackbar.js +4 -2
- package/es6/components/Virtuoso/utils/useHighlightScroll.js +4 -2
- package/es6/components/index.js +2 -1
- package/es6/icon/AddReactions.js +3 -1
- package/es6/icon/Connect.js +17 -0
- package/es6/icon/CustomizeTabs.js +17 -0
- package/es6/icon/index.js +2 -1
- package/es6/icons/icon-add-reactions.svg +5 -1
- package/es6/icons/icon-connect.svg +5 -0
- package/es6/icons/icon-customize-tabs.svg +5 -0
- package/icon/AddReactions.js +3 -1
- package/icon/{MenuFax.d.ts → Connect.d.ts} +2 -2
- package/icon/{MenuFax.js → Connect.js} +5 -5
- package/icon/CustomizeTabs.d.ts +3 -0
- package/icon/CustomizeTabs.js +26 -0
- package/icon/index.d.ts +2 -1
- package/icon/index.js +4 -2
- package/icons/icon-add-reactions.svg +5 -1
- package/icons/icon-connect.svg +5 -0
- package/icons/icon-customize-tabs.svg +5 -0
- package/package.json +1 -1
- package/components/Icon/assets/icon-menu-fax.svg +0 -5
- package/es6/components/Icon/assets/icon-menu-fax.svg +0 -5
- package/es6/icon/MenuFax.js +0 -17
- package/es6/icons/icon-menu-fax.svg +0 -5
- package/icons/icon-menu-fax.svg +0 -5
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UniqID, PortalDescriptor } from './types';
|
|
2
|
+
import { Connectable } from '../Connectable';
|
|
3
|
+
export declare class PortalStore<D extends {}> extends Connectable<PortalDescriptor<D>[]> {
|
|
4
|
+
private readonly _portalMap;
|
|
5
|
+
private _batchMode;
|
|
6
|
+
get size(): number;
|
|
7
|
+
get lastPortal(): PortalDescriptor<D, {}, any> | undefined;
|
|
8
|
+
get portals(): IterableIterator<PortalDescriptor<D, {}, any>>;
|
|
9
|
+
addOrUpdate(portal: PortalDescriptor<D>): void;
|
|
10
|
+
delete(id: UniqID): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
has(id: UniqID): boolean;
|
|
13
|
+
get(id: UniqID): PortalDescriptor<D, {}, any> | undefined;
|
|
14
|
+
batch(handle: (store: PortalStore<D>) => void): void;
|
|
15
|
+
/**
|
|
16
|
+
* just notify portal host rerender view
|
|
17
|
+
*/
|
|
18
|
+
forceEmit(): void;
|
|
19
|
+
private _emitChanges;
|
|
20
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __values = (this && this.__values) || function(o) {
|
|
16
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
17
|
+
if (m) return m.call(o);
|
|
18
|
+
if (o && typeof o.length === "number") return {
|
|
19
|
+
next: function () {
|
|
20
|
+
if (o && i >= o.length) o = void 0;
|
|
21
|
+
return { value: o && o[i++], done: !o };
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
25
|
+
};
|
|
26
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
27
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
28
|
+
if (!m) return o;
|
|
29
|
+
var i = m.call(o), r, ar = [], e;
|
|
30
|
+
try {
|
|
31
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
32
|
+
}
|
|
33
|
+
catch (error) { e = { error: error }; }
|
|
34
|
+
finally {
|
|
35
|
+
try {
|
|
36
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
37
|
+
}
|
|
38
|
+
finally { if (e) throw e.error; }
|
|
39
|
+
}
|
|
40
|
+
return ar;
|
|
41
|
+
};
|
|
42
|
+
var __spread = (this && this.__spread) || function () {
|
|
43
|
+
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
|
44
|
+
return ar;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
var Connectable_1 = require("../Connectable");
|
|
48
|
+
var PortalStore = /** @class */ (function (_super) {
|
|
49
|
+
__extends(PortalStore, _super);
|
|
50
|
+
function PortalStore() {
|
|
51
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
52
|
+
_this._portalMap = new Map();
|
|
53
|
+
_this._batchMode = false;
|
|
54
|
+
return _this;
|
|
55
|
+
}
|
|
56
|
+
Object.defineProperty(PortalStore.prototype, "size", {
|
|
57
|
+
get: function () {
|
|
58
|
+
return this._portalMap.size;
|
|
59
|
+
},
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(PortalStore.prototype, "lastPortal", {
|
|
64
|
+
get: function () {
|
|
65
|
+
var e_1, _a;
|
|
66
|
+
var lastPortal;
|
|
67
|
+
try {
|
|
68
|
+
for (var _b = __values(this.portals), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
69
|
+
var portal = _c.value;
|
|
70
|
+
lastPortal = portal;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
74
|
+
finally {
|
|
75
|
+
try {
|
|
76
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
77
|
+
}
|
|
78
|
+
finally { if (e_1) throw e_1.error; }
|
|
79
|
+
}
|
|
80
|
+
return lastPortal;
|
|
81
|
+
},
|
|
82
|
+
enumerable: true,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(PortalStore.prototype, "portals", {
|
|
86
|
+
get: function () {
|
|
87
|
+
return this._portalMap.values();
|
|
88
|
+
},
|
|
89
|
+
enumerable: true,
|
|
90
|
+
configurable: true
|
|
91
|
+
});
|
|
92
|
+
PortalStore.prototype.addOrUpdate = function (portal) {
|
|
93
|
+
this._portalMap.set(portal.id, portal);
|
|
94
|
+
if (!this._batchMode)
|
|
95
|
+
this._emitChanges();
|
|
96
|
+
};
|
|
97
|
+
PortalStore.prototype.delete = function (id) {
|
|
98
|
+
this._portalMap.delete(id);
|
|
99
|
+
if (!this._batchMode)
|
|
100
|
+
this._emitChanges();
|
|
101
|
+
};
|
|
102
|
+
PortalStore.prototype.clear = function () {
|
|
103
|
+
this._portalMap.clear();
|
|
104
|
+
if (!this._batchMode)
|
|
105
|
+
this._emitChanges();
|
|
106
|
+
};
|
|
107
|
+
PortalStore.prototype.has = function (id) {
|
|
108
|
+
return this._portalMap.has(id);
|
|
109
|
+
};
|
|
110
|
+
PortalStore.prototype.get = function (id) {
|
|
111
|
+
return this._portalMap.get(id);
|
|
112
|
+
};
|
|
113
|
+
PortalStore.prototype.batch = function (handle) {
|
|
114
|
+
this._batchMode = true;
|
|
115
|
+
try {
|
|
116
|
+
handle(this);
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
this._batchMode = false;
|
|
120
|
+
this._emitChanges();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* just notify portal host rerender view
|
|
125
|
+
*/
|
|
126
|
+
PortalStore.prototype.forceEmit = function () {
|
|
127
|
+
this._emitChanges();
|
|
128
|
+
};
|
|
129
|
+
PortalStore.prototype._emitChanges = function () {
|
|
130
|
+
this.emit(__spread(this.portals));
|
|
131
|
+
};
|
|
132
|
+
return PortalStore;
|
|
133
|
+
}(Connectable_1.Connectable));
|
|
134
|
+
exports.PortalStore = PortalStore;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
__export(require("./PortalManager"));
|
|
7
|
+
__export(require("./PortalStore"));
|
|
8
|
+
__export(require("./types"));
|
|
9
|
+
__export(require("./utils"));
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ComponentType, Key } from 'react';
|
|
2
|
+
export declare type PortalDescriptor<D extends {} = {}, P extends {} = {}, F = any> = {
|
|
3
|
+
readonly id: UniqID;
|
|
4
|
+
readonly Component: ComponentType;
|
|
5
|
+
/**
|
|
6
|
+
* lifecycle hook
|
|
7
|
+
*/
|
|
8
|
+
readonly onMounted: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* lifecycle hook
|
|
11
|
+
*/
|
|
12
|
+
readonly onUnmounted: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* pass to component. component can call this fn to close self
|
|
15
|
+
*/
|
|
16
|
+
readonly onClose: (feedback: any) => void;
|
|
17
|
+
/**
|
|
18
|
+
* mutable object
|
|
19
|
+
*/
|
|
20
|
+
readonly portalController: PortalController<P, F, D>;
|
|
21
|
+
props?: {};
|
|
22
|
+
/**
|
|
23
|
+
* pass to component.
|
|
24
|
+
*/
|
|
25
|
+
open: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare type createPortalDescriptorProps<P extends {}, F, D extends {}> = {
|
|
28
|
+
id: UniqID;
|
|
29
|
+
Component: ComponentType<ControlledProps<P, F>>;
|
|
30
|
+
props?: UncontrolledProps<P>;
|
|
31
|
+
data?: D;
|
|
32
|
+
};
|
|
33
|
+
export interface PortalController<P extends {} = {}, F = any, D extends {} = {}> {
|
|
34
|
+
id: UniqID;
|
|
35
|
+
/**
|
|
36
|
+
* resolve after portal mounted
|
|
37
|
+
*/
|
|
38
|
+
onOpened: Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* resolve after portal unmounted
|
|
41
|
+
*/
|
|
42
|
+
onClosed: Promise<F | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* close portal
|
|
45
|
+
* @param feedback onClosed will resolve this feedback value
|
|
46
|
+
*/
|
|
47
|
+
close(feedback?: F): void;
|
|
48
|
+
/**
|
|
49
|
+
* update props
|
|
50
|
+
* @param newProps will cover old props
|
|
51
|
+
*/
|
|
52
|
+
updateProps: (newProps: UncontrolledProps<P>) => void;
|
|
53
|
+
/**
|
|
54
|
+
* check if it's opened
|
|
55
|
+
*/
|
|
56
|
+
readonly isOpened: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* check if it's on top
|
|
59
|
+
*/
|
|
60
|
+
readonly isTop: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* custom data
|
|
63
|
+
*/
|
|
64
|
+
readonly data?: D;
|
|
65
|
+
}
|
|
66
|
+
export declare type ControlledProps<P extends {} = {}, F = undefined> = P & {
|
|
67
|
+
onClose: (feedback?: F) => void;
|
|
68
|
+
open: boolean;
|
|
69
|
+
};
|
|
70
|
+
export declare type UncontrolledProps<P extends {}> = Omit<P, 'onClose' | 'open'>;
|
|
71
|
+
export declare type PortalOptions<P, D> = {
|
|
72
|
+
/**
|
|
73
|
+
* props without 'onClose' and 'open'
|
|
74
|
+
*/
|
|
75
|
+
props?: UncontrolledProps<P>;
|
|
76
|
+
/**
|
|
77
|
+
* manager will generate id if no provide id
|
|
78
|
+
*/
|
|
79
|
+
id?: UniqID;
|
|
80
|
+
/**
|
|
81
|
+
* custom data
|
|
82
|
+
*/
|
|
83
|
+
data?: D;
|
|
84
|
+
};
|
|
85
|
+
export declare type UniqID = Key;
|
|
86
|
+
export declare const UnmountSymbol: unique symbol;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UniqID } from './types';
|
|
2
|
+
declare type ResolveFn<T> = (value: T | PromiseLike<T>) => void;
|
|
3
|
+
export declare const createPromise: <T>() => [Promise<T>, ResolveFn<T>];
|
|
4
|
+
export declare class UniqIdUtil {
|
|
5
|
+
private _currentNumber;
|
|
6
|
+
get(): UniqID;
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPromise = function () {
|
|
4
|
+
var resolvePromise = null;
|
|
5
|
+
var promise = new Promise(function (resolve) {
|
|
6
|
+
resolvePromise = resolve;
|
|
7
|
+
});
|
|
8
|
+
return [promise, resolvePromise];
|
|
9
|
+
};
|
|
10
|
+
var UniqIdUtil = /** @class */ (function () {
|
|
11
|
+
function UniqIdUtil() {
|
|
12
|
+
this._currentNumber = 0;
|
|
13
|
+
}
|
|
14
|
+
UniqIdUtil.prototype.get = function () {
|
|
15
|
+
return String(this._currentNumber++);
|
|
16
|
+
};
|
|
17
|
+
return UniqIdUtil;
|
|
18
|
+
}());
|
|
19
|
+
exports.UniqIdUtil = UniqIdUtil;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { PortalDescriptor } from './PortalManager';
|
|
3
|
+
declare type RcPortalRendererProps = {
|
|
4
|
+
portalDescriptor: PortalDescriptor;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* private, do not use this directly
|
|
8
|
+
*/
|
|
9
|
+
declare const RcPortalRenderer: FunctionComponent<RcPortalRendererProps>;
|
|
10
|
+
export { RcPortalRenderer, RcPortalRendererProps };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
14
|
+
if (mod && mod.__esModule) return mod;
|
|
15
|
+
var result = {};
|
|
16
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
17
|
+
result["default"] = mod;
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
var react_1 = __importStar(require("react"));
|
|
22
|
+
var context_1 = require("./context");
|
|
23
|
+
/**
|
|
24
|
+
* private, do not use this directly
|
|
25
|
+
*/
|
|
26
|
+
var RcPortalRenderer = function (_a) {
|
|
27
|
+
var portalDescriptor = _a.portalDescriptor;
|
|
28
|
+
var Component = portalDescriptor.Component, _props = portalDescriptor.props, onMounted = portalDescriptor.onMounted, onUnmounted = portalDescriptor.onUnmounted, onClose = portalDescriptor.onClose, open = portalDescriptor.open, id = portalDescriptor.id;
|
|
29
|
+
react_1.useEffect(function () {
|
|
30
|
+
onMounted();
|
|
31
|
+
return function () { return onUnmounted(); };
|
|
32
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
+
}, []);
|
|
34
|
+
var element = react_1.useMemo(function () {
|
|
35
|
+
// onClose, open must be covered
|
|
36
|
+
var props = __assign(__assign({}, _props), { onClose: onClose, open: open });
|
|
37
|
+
return react_1.default.createElement(Component, __assign({}, props));
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
+
}, [_props, open]);
|
|
40
|
+
return react_1.default.createElement(context_1.PortalIDProvider, { value: id }, element);
|
|
41
|
+
};
|
|
42
|
+
exports.RcPortalRenderer = RcPortalRenderer;
|
|
43
|
+
RcPortalRenderer.displayName = 'RcPortalRenderer';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="styled-jsx" />
|
|
3
|
+
/// <reference types="@emotion/core" />
|
|
4
|
+
export declare const PortalIDContext: import("react").Context<string | number | undefined>;
|
|
5
|
+
export declare const PortalIDProvider: import("react").Provider<string | number | undefined>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="styled-jsx" />
|
|
3
|
+
/// <reference types="@emotion/core" />
|
|
4
|
+
import { PortalManager } from '../PortalManager';
|
|
5
|
+
export declare const PortalManagerContext: import("react").Context<PortalManager<{}> | undefined>;
|
|
6
|
+
export declare const PortalManagerProvider: import("react").Provider<PortalManager<{}> | undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
__export(require("./Connectable"));
|
|
7
|
+
__export(require("./PortalHost"));
|
|
8
|
+
__export(require("./PortalManager"));
|
|
9
|
+
__export(require("./utils"));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
__export(require("./usePortalManagerWithID"));
|
|
7
|
+
__export(require("./useUnmountPortalHandler"));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/// <reference types="styled-jsx" />
|
|
3
|
+
/// <reference types="@emotion/core" />
|
|
4
|
+
import { PortalManager } from '../PortalManager';
|
|
5
|
+
export declare const usePortalManagerWithID: <M extends PortalManager<{}> = PortalManager<{}>>() => {
|
|
6
|
+
manager: M;
|
|
7
|
+
id: import("react").ReactText;
|
|
8
|
+
} | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
var context_1 = require("../context");
|
|
5
|
+
exports.usePortalManagerWithID = function () {
|
|
6
|
+
var manager = react_1.useContext(context_1.PortalManagerContext);
|
|
7
|
+
var id = react_1.useContext(context_1.PortalIDContext);
|
|
8
|
+
if (manager && id !== undefined) {
|
|
9
|
+
return { manager: manager, id: id };
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
};
|