@vnejs/plugins.view.coralina.history 0.1.0 → 0.1.1
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/const/params.js +7 -0
- package/index.js +2 -1
- package/modules/controller.js +1 -3
- package/modules/view.js +7 -5
- package/package.json +1 -1
- package/view/index.jsx +16 -35
package/const/params.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const ZINDEX = 2000;
|
|
2
|
+
export const TRANSITION = 300;
|
|
3
|
+
export const LOC_LABEL = "history";
|
|
4
|
+
|
|
5
|
+
export const VIEW_PROPS = {
|
|
6
|
+
screen: { isDisableAutoread: true, isIgnoreOnScreenshot: true, withBackgroundBlur: true, withBackgroundDark: true, zIndex: ZINDEX, transition: TRANSITION },
|
|
7
|
+
};
|
package/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { regPlugin } from "@vnejs/shared";
|
|
2
2
|
|
|
3
3
|
import { SUBSCRIBE_EVENTS } from "./const/events";
|
|
4
|
+
import * as params from "./const/params";
|
|
4
5
|
|
|
5
6
|
import { HistoryController } from "./modules/controller";
|
|
6
7
|
import { HistoryView } from "./modules/view";
|
|
7
8
|
|
|
8
|
-
regPlugin("HISTORY_VIEW", { events: SUBSCRIBE_EVENTS }, [HistoryController, HistoryView]);
|
|
9
|
+
regPlugin("HISTORY_VIEW", { events: SUBSCRIBE_EVENTS, params }, [HistoryController, HistoryView]);
|
package/modules/controller.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ModuleController } from "@vnejs/module.components";
|
|
2
2
|
|
|
3
|
-
import { ZINDEX } from "../view";
|
|
4
|
-
|
|
5
3
|
export class HistoryController extends ModuleController {
|
|
6
4
|
name = "history.controller";
|
|
7
5
|
|
|
@@ -16,7 +14,7 @@ export class HistoryController extends ModuleController {
|
|
|
16
14
|
[this.CONST.CONTROLS.BUTTONS.ARROW_BOTTOM]: this.incCurrentItem,
|
|
17
15
|
[this.CONST.CONTROLS.BUTTONS.ACCEPT]: () => this.emit(this.EVENTS.HISTORY_VIEW.ACCEPT),
|
|
18
16
|
};
|
|
19
|
-
controlsIndex = ZINDEX;
|
|
17
|
+
controlsIndex = this.PARAMS.HISTORY_VIEW.ZINDEX;
|
|
20
18
|
|
|
21
19
|
subscribe = () => {
|
|
22
20
|
this.on(this.EVENTS.HISTORY_VIEW.SHOW, this.onShow);
|
package/modules/view.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ModuleView } from "@vnejs/module.components";
|
|
2
2
|
|
|
3
|
-
import { render
|
|
3
|
+
import { render } from "../view";
|
|
4
4
|
|
|
5
5
|
export class HistoryView extends ModuleView {
|
|
6
6
|
name = "history.view";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
|
|
8
|
+
locLabel = this.PARAMS.HISTORY_VIEW.LOC_LABEL;
|
|
9
|
+
animationTime = this.PARAMS.HISTORY_VIEW.TRANSITION;
|
|
10
10
|
updateEvent = this.EVENTS.HISTORY_VIEW.UPDATE;
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
renderFunc = render;
|
|
13
|
+
updateHandler = this.onUpdateStoreComponent;
|
|
12
14
|
}
|
package/package.json
CHANGED
package/view/index.jsx
CHANGED
|
@@ -1,45 +1,26 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
|
|
4
4
|
import { Screen } from "@vnejs/uis.base";
|
|
5
5
|
|
|
6
6
|
import { HistoryClose, HistoryLines } from "./components";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const History = ({ store, onMount, ...props } = {}) => {
|
|
9
|
+
const [{ isShow = false, isForce = false, locs = {}, history = [], historyLocs = [], currentItem = null }, setState] = useState({});
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
useEffect(() => store.subscribe(setState), []);
|
|
12
|
+
useEffect(() => void onMount(), []);
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const propsScreen = useMemo(() => ({ ...props.PARAMS.HISTORY_VIEW.VIEW_PROPS.screen, isShow, isForce }), [isShow, isForce]);
|
|
15
|
+
const propsLines = useMemo(() => ({ ...props, isShow, history, historyLocs, currentItem }), [isShow, history, historyLocs, currentItem]);
|
|
16
|
+
const propsClose = useMemo(() => ({ ...props, locs }), [locs]);
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
isIgnoreOnScreenshot={true}
|
|
25
|
-
withBlur={true}
|
|
26
|
-
withDark={true}
|
|
27
|
-
>
|
|
28
|
-
<HistoryLines
|
|
29
|
-
{...this.props}
|
|
30
|
-
isShow={isShow}
|
|
31
|
-
history={history}
|
|
32
|
-
historyLocs={historyLocs}
|
|
33
|
-
currentItem={currentItem}
|
|
34
|
-
/>
|
|
18
|
+
return (
|
|
19
|
+
<Screen {...propsScreen}>
|
|
20
|
+
<HistoryLines {...propsLines} />
|
|
21
|
+
<HistoryClose {...propsClose} />
|
|
22
|
+
</Screen>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
{...this.props}
|
|
38
|
-
locs={locs}
|
|
39
|
-
/>
|
|
40
|
-
</Screen>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const render = (props, root, resolve) => ReactDOM.render(<History {...props} />, root, resolve);
|
|
26
|
+
export const render = (props, root) => ReactDOM.render(<History {...props} />, root);
|