dtable-ui-component 6.0.23-beta1 → 6.0.24-beta
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/lib/SmallFullScreenPage/index.js +11 -1
- package/lib/utils/url.js +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
12
12
|
var _header = _interopRequireDefault(require("./header"));
|
|
13
13
|
var _body = _interopRequireDefault(require("./body"));
|
|
14
14
|
require("./index.css");
|
|
15
|
+
var _utils = require("../utils/utils");
|
|
15
16
|
const SmallFullScreenPage = _ref => {
|
|
16
17
|
let {
|
|
17
18
|
classNamePrefix,
|
|
@@ -20,7 +21,8 @@ const SmallFullScreenPage = _ref => {
|
|
|
20
21
|
zIndex,
|
|
21
22
|
children,
|
|
22
23
|
onLeftClick,
|
|
23
|
-
onRightClick
|
|
24
|
+
onRightClick,
|
|
25
|
+
historyCallback = event => event.preventDefault
|
|
24
26
|
} = _ref;
|
|
25
27
|
const [isMount, setMount] = (0, _react.useState)(false);
|
|
26
28
|
const element = (0, _react.useMemo)(() => {
|
|
@@ -30,6 +32,14 @@ const SmallFullScreenPage = _ref => {
|
|
|
30
32
|
_element.style.zIndex = zIndex;
|
|
31
33
|
return _element;
|
|
32
34
|
}, [zIndex]);
|
|
35
|
+
(0, _react.useEffect)(() => {
|
|
36
|
+
history.pushState(null, null, '#');
|
|
37
|
+
if (!(0, _utils.isFunction)(historyCallback)) return;
|
|
38
|
+
window.addEventListener('popstate', historyCallback, false);
|
|
39
|
+
return () => {
|
|
40
|
+
window.removeEventListener('popstate', historyCallback, false);
|
|
41
|
+
};
|
|
42
|
+
}, [historyCallback]);
|
|
33
43
|
(0, _react.useEffect)(() => {
|
|
34
44
|
document.body.appendChild(element);
|
|
35
45
|
setMount(true);
|
package/lib/utils/url.js
CHANGED
|
@@ -133,7 +133,7 @@ const getFileName = url => {
|
|
|
133
133
|
validUrl = validUrl.slice(0, qIndex);
|
|
134
134
|
}
|
|
135
135
|
const lastIndex = validUrl.lastIndexOf('/');
|
|
136
|
-
const name =
|
|
136
|
+
const name = validUrl.slice(lastIndex + 1);
|
|
137
137
|
return decodeURI(name);
|
|
138
138
|
};
|
|
139
139
|
exports.getFileName = getFileName;
|