@zhongguo168a/yxeditor-common 0.0.26 → 0.0.28
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/dist/index.d.ts +48 -43
- package/dist/index.esm.js +141 -140
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1007,7 +1007,7 @@ declare class Route {
|
|
|
1007
1007
|
protected _route: string;
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
|
-
declare class
|
|
1010
|
+
declare class ViewController extends Controller {
|
|
1011
1011
|
constructor(routeName: string, config?: {
|
|
1012
1012
|
layer?: string;
|
|
1013
1013
|
tags?: string[];
|
|
@@ -1015,33 +1015,38 @@ declare class PageController extends Controller {
|
|
|
1015
1015
|
});
|
|
1016
1016
|
open(...args: any[]): void;
|
|
1017
1017
|
close(...args: any[]): void;
|
|
1018
|
-
protected onOpening(
|
|
1019
|
-
protected onOpened(
|
|
1020
|
-
protected onClosing(
|
|
1021
|
-
protected onClosed(
|
|
1022
|
-
protected onRefresh(
|
|
1023
|
-
openByRoute(route: Route):
|
|
1024
|
-
private
|
|
1025
|
-
openComplete(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1018
|
+
protected onOpening(view: View): void;
|
|
1019
|
+
protected onOpened(view: View): void;
|
|
1020
|
+
protected onClosing(view: View): void;
|
|
1021
|
+
protected onClosed(view: View): void;
|
|
1022
|
+
protected onRefresh(view: View): void;
|
|
1023
|
+
openByRoute(route: Route): View;
|
|
1024
|
+
private openView;
|
|
1025
|
+
openComplete(view: View): void;
|
|
1026
|
+
/**
|
|
1027
|
+
* viewrepo中存在页面才会关闭
|
|
1028
|
+
* @param route
|
|
1029
|
+
* @returns
|
|
1030
|
+
*/
|
|
1031
|
+
closeByRoute(route?: Route): View;
|
|
1032
|
+
private closeView;
|
|
1033
|
+
closeComplete(view: View): void;
|
|
1029
1034
|
refresh(): void;
|
|
1030
1035
|
get layer(): string;
|
|
1031
1036
|
hasTags(tags: string[]): boolean;
|
|
1032
1037
|
setLayer(name: string): this;
|
|
1033
1038
|
setTags(tags: string[]): this;
|
|
1034
|
-
get
|
|
1039
|
+
get lastView(): View;
|
|
1035
1040
|
get route(): Route;
|
|
1036
1041
|
get enableHistory(): boolean;
|
|
1037
1042
|
protected _enableHistory: boolean;
|
|
1038
1043
|
protected _route: Route;
|
|
1039
|
-
protected
|
|
1044
|
+
protected _lastView: View;
|
|
1040
1045
|
protected _tags: {};
|
|
1041
1046
|
protected _layer: string;
|
|
1042
1047
|
}
|
|
1043
1048
|
|
|
1044
|
-
declare enum
|
|
1049
|
+
declare enum ViewState {
|
|
1045
1050
|
/**
|
|
1046
1051
|
* 关闭
|
|
1047
1052
|
*/
|
|
@@ -1059,15 +1064,15 @@ declare enum PageState {
|
|
|
1059
1064
|
*/
|
|
1060
1065
|
Closeing = 3
|
|
1061
1066
|
}
|
|
1062
|
-
declare enum
|
|
1067
|
+
declare enum ViewEvent {
|
|
1063
1068
|
Opening = "opening",
|
|
1064
1069
|
Opened = "opened",
|
|
1065
1070
|
Closeing = "closeing",
|
|
1066
1071
|
Closed = "closed",
|
|
1067
1072
|
Stop = "stop"
|
|
1068
1073
|
}
|
|
1069
|
-
declare class
|
|
1070
|
-
constructor(controller:
|
|
1074
|
+
declare class View extends EventManager {
|
|
1075
|
+
constructor(controller: ViewController, route: Route);
|
|
1071
1076
|
/**
|
|
1072
1077
|
* 等待打开完成指令
|
|
1073
1078
|
*/
|
|
@@ -1084,13 +1089,13 @@ declare class Page extends EventManager {
|
|
|
1084
1089
|
toString(): string;
|
|
1085
1090
|
protected _waitOpenComplete: boolean;
|
|
1086
1091
|
protected _waitCloseComplete: boolean;
|
|
1087
|
-
get controller():
|
|
1092
|
+
get controller(): ViewController;
|
|
1088
1093
|
get route(): Route;
|
|
1089
1094
|
datas: {};
|
|
1090
1095
|
tags: {};
|
|
1091
1096
|
layer: string;
|
|
1092
|
-
state:
|
|
1093
|
-
protected _controller:
|
|
1097
|
+
state: ViewState;
|
|
1098
|
+
protected _controller: ViewController;
|
|
1094
1099
|
protected _route: Route;
|
|
1095
1100
|
}
|
|
1096
1101
|
|
|
@@ -1098,14 +1103,20 @@ declare class Page extends EventManager {
|
|
|
1098
1103
|
* 视图管理器
|
|
1099
1104
|
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
1100
1105
|
*/
|
|
1101
|
-
declare class
|
|
1106
|
+
declare class ViewLayer {
|
|
1102
1107
|
name: string;
|
|
1103
1108
|
constructor(name: string);
|
|
1104
1109
|
close(): void;
|
|
1110
|
+
/**
|
|
1111
|
+
* 历史记录
|
|
1112
|
+
*/
|
|
1113
|
+
getHistory(): Route[];
|
|
1114
|
+
back(): void;
|
|
1105
1115
|
/**
|
|
1106
1116
|
* 当前的页面
|
|
1107
1117
|
*/
|
|
1108
|
-
|
|
1118
|
+
currentView: View;
|
|
1119
|
+
protected _history: Route[];
|
|
1109
1120
|
}
|
|
1110
1121
|
|
|
1111
1122
|
declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
@@ -1121,47 +1132,41 @@ declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
|
1121
1132
|
}
|
|
1122
1133
|
declare var uidict: UIObjectDict;
|
|
1123
1134
|
|
|
1124
|
-
declare class
|
|
1135
|
+
declare class ViewList extends List<View> {
|
|
1125
1136
|
}
|
|
1126
|
-
declare class
|
|
1137
|
+
declare class ViewRepo extends ViewList {
|
|
1127
1138
|
constructor();
|
|
1128
|
-
openByString(route: string):
|
|
1139
|
+
openByString(route: string): View;
|
|
1129
1140
|
/**
|
|
1130
1141
|
* 打开页面
|
|
1131
1142
|
* 一个路由代表一个页面
|
|
1132
1143
|
* @param route
|
|
1133
1144
|
*/
|
|
1134
|
-
open(route: Route):
|
|
1145
|
+
open(route: Route): View;
|
|
1135
1146
|
close(route: Route): void;
|
|
1136
1147
|
/**
|
|
1137
1148
|
* 如果页面存在,则刷新
|
|
1138
1149
|
* @param route
|
|
1139
1150
|
*/
|
|
1140
1151
|
refresh(route: Route): void;
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
back(): void;
|
|
1146
|
-
getByRoute(route: Route): Page;
|
|
1147
|
-
listByRoutePath(path: string): PageList;
|
|
1148
|
-
listByTags(tags: string[]): PageList;
|
|
1149
|
-
getLayerMain(): PageLayer;
|
|
1152
|
+
getByRoute(route: Route): View;
|
|
1153
|
+
listByRoutePath(path: string): ViewList;
|
|
1154
|
+
listByTags(tags: string[]): ViewList;
|
|
1155
|
+
getLayerMain(): ViewLayer;
|
|
1150
1156
|
/**
|
|
1151
1157
|
* @param name
|
|
1152
1158
|
*/
|
|
1153
|
-
getLayer(name: string):
|
|
1154
|
-
protected getOrNewLayer(name: string):
|
|
1155
|
-
getController(name: string):
|
|
1156
|
-
registerController(ctrl:
|
|
1159
|
+
getLayer(name: string): ViewLayer;
|
|
1160
|
+
protected getOrNewLayer(name: string): ViewLayer;
|
|
1161
|
+
getController(name: string): ViewController;
|
|
1162
|
+
registerController(ctrl: ViewController): void;
|
|
1157
1163
|
get objectDict(): UIObjectDict;
|
|
1158
1164
|
protected _objectDict: UIObjectDict;
|
|
1159
1165
|
protected _indexLayer: {};
|
|
1160
1166
|
protected _indexRoute: {};
|
|
1161
|
-
protected _history: Route[];
|
|
1162
1167
|
protected _ctrlDict: ControllerDict;
|
|
1163
1168
|
}
|
|
1164
|
-
declare const
|
|
1169
|
+
declare const viewrepo: ViewRepo;
|
|
1165
1170
|
|
|
1166
1171
|
/**
|
|
1167
1172
|
* 事件字符串分隔符
|
|
@@ -2025,5 +2030,5 @@ declare class WidgetUtil {
|
|
|
2025
2030
|
}
|
|
2026
2031
|
declare var widgetutil: WidgetUtil;
|
|
2027
2032
|
|
|
2028
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventItem, EventManager, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapUtil, MathUtil, Model, NetUtil,
|
|
2033
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventItem, EventManager, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, View, ViewController, ViewEvent, ViewLayer, ViewList, ViewRepo, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uidict, uimgr, uiutil, viewrepo, widgetutil };
|
|
2029
2034
|
export type { CreatorFunction, DisposeFunction, IController, IError, IEventManager, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
|
package/dist/index.esm.js
CHANGED
|
@@ -3475,39 +3475,39 @@ class Factory {
|
|
|
3475
3475
|
}
|
|
3476
3476
|
}
|
|
3477
3477
|
|
|
3478
|
-
var
|
|
3479
|
-
(function (
|
|
3478
|
+
var ViewState;
|
|
3479
|
+
(function (ViewState) {
|
|
3480
3480
|
/**
|
|
3481
3481
|
* 关闭
|
|
3482
3482
|
*/
|
|
3483
|
-
|
|
3483
|
+
ViewState[ViewState["Closed"] = 0] = "Closed";
|
|
3484
3484
|
/**
|
|
3485
3485
|
* 正在打开
|
|
3486
3486
|
*/
|
|
3487
|
-
|
|
3487
|
+
ViewState[ViewState["Opening"] = 1] = "Opening";
|
|
3488
3488
|
/**
|
|
3489
3489
|
* 已打开
|
|
3490
3490
|
*/
|
|
3491
|
-
|
|
3491
|
+
ViewState[ViewState["Opened"] = 2] = "Opened";
|
|
3492
3492
|
/**
|
|
3493
3493
|
* 正在关闭
|
|
3494
3494
|
*/
|
|
3495
|
-
|
|
3496
|
-
})(
|
|
3497
|
-
var
|
|
3498
|
-
(function (
|
|
3495
|
+
ViewState[ViewState["Closeing"] = 3] = "Closeing";
|
|
3496
|
+
})(ViewState || (ViewState = {}));
|
|
3497
|
+
var ViewEvent;
|
|
3498
|
+
(function (ViewEvent) {
|
|
3499
3499
|
// 正在打开
|
|
3500
|
-
|
|
3500
|
+
ViewEvent["Opening"] = "opening";
|
|
3501
3501
|
// 已打开
|
|
3502
|
-
|
|
3502
|
+
ViewEvent["Opened"] = "opened";
|
|
3503
3503
|
// 正在打开
|
|
3504
|
-
|
|
3504
|
+
ViewEvent["Closeing"] = "closeing";
|
|
3505
3505
|
// 已关闭
|
|
3506
|
-
|
|
3506
|
+
ViewEvent["Closed"] = "closed";
|
|
3507
3507
|
// 停止
|
|
3508
|
-
|
|
3509
|
-
})(
|
|
3510
|
-
class
|
|
3508
|
+
ViewEvent["Stop"] = "stop";
|
|
3509
|
+
})(ViewEvent || (ViewEvent = {}));
|
|
3510
|
+
class View extends EventManager {
|
|
3511
3511
|
constructor(controller, route) {
|
|
3512
3512
|
super();
|
|
3513
3513
|
this._waitOpenComplete = false;
|
|
@@ -3543,7 +3543,7 @@ class Page extends EventManager {
|
|
|
3543
3543
|
*/
|
|
3544
3544
|
wait() {
|
|
3545
3545
|
switch (this.state) {
|
|
3546
|
-
case
|
|
3546
|
+
case ViewState.Opening:
|
|
3547
3547
|
return new Promise((resolve, reject) => {
|
|
3548
3548
|
let opened = () => {
|
|
3549
3549
|
this.off("opened", this, opened);
|
|
@@ -3558,7 +3558,7 @@ class Page extends EventManager {
|
|
|
3558
3558
|
this.on("opened", this, opened);
|
|
3559
3559
|
this.on("canceled", this, canceled);
|
|
3560
3560
|
});
|
|
3561
|
-
case
|
|
3561
|
+
case ViewState.Closeing:
|
|
3562
3562
|
return new Promise((resolve, reject) => {
|
|
3563
3563
|
let opened = () => {
|
|
3564
3564
|
this.off("closed", this, opened);
|
|
@@ -3573,7 +3573,7 @@ class Page extends EventManager {
|
|
|
3573
3573
|
}
|
|
3574
3574
|
}
|
|
3575
3575
|
toString() {
|
|
3576
|
-
return `
|
|
3576
|
+
return `View[${this.route.toString()}, ${this.id}]`;
|
|
3577
3577
|
}
|
|
3578
3578
|
get controller() {
|
|
3579
3579
|
return this._controller;
|
|
@@ -3710,21 +3710,6 @@ class Route {
|
|
|
3710
3710
|
// 打开界面缓存的route对象
|
|
3711
3711
|
Route.data = {};
|
|
3712
3712
|
|
|
3713
|
-
/**
|
|
3714
|
-
* 视图管理器
|
|
3715
|
-
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
3716
|
-
*/
|
|
3717
|
-
class PageLayer {
|
|
3718
|
-
constructor(name) {
|
|
3719
|
-
this.name = name;
|
|
3720
|
-
}
|
|
3721
|
-
close() {
|
|
3722
|
-
if (this.currentPage) {
|
|
3723
|
-
this.currentPage.controller.closeByRoute();
|
|
3724
|
-
}
|
|
3725
|
-
}
|
|
3726
|
-
}
|
|
3727
|
-
|
|
3728
3713
|
class UIObjectDict extends Dictionary {
|
|
3729
3714
|
/**
|
|
3730
3715
|
* 获取唯一的
|
|
@@ -3779,14 +3764,38 @@ class UIObjectDict extends Dictionary {
|
|
|
3779
3764
|
}
|
|
3780
3765
|
var uidict = new UIObjectDict();
|
|
3781
3766
|
|
|
3782
|
-
|
|
3767
|
+
/**
|
|
3768
|
+
* 视图管理器
|
|
3769
|
+
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
3770
|
+
*/
|
|
3771
|
+
class ViewLayer {
|
|
3772
|
+
constructor(name) {
|
|
3773
|
+
this.name = name;
|
|
3774
|
+
this._history = [];
|
|
3775
|
+
}
|
|
3776
|
+
close() {
|
|
3777
|
+
if (this.currentView) {
|
|
3778
|
+
this.currentView.controller.closeByRoute();
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
/**
|
|
3782
|
+
* 历史记录
|
|
3783
|
+
*/
|
|
3784
|
+
getHistory() {
|
|
3785
|
+
return this._history;
|
|
3786
|
+
}
|
|
3787
|
+
back() {
|
|
3788
|
+
viewrepo.open(this._history.pop());
|
|
3789
|
+
}
|
|
3783
3790
|
}
|
|
3784
|
-
|
|
3791
|
+
|
|
3792
|
+
class ViewList extends List {
|
|
3793
|
+
}
|
|
3794
|
+
class ViewRepo extends ViewList {
|
|
3785
3795
|
constructor() {
|
|
3786
3796
|
super();
|
|
3787
3797
|
this._indexLayer = {};
|
|
3788
3798
|
this._indexRoute = {};
|
|
3789
|
-
this._history = [];
|
|
3790
3799
|
this._ctrlDict = new ControllerDict();
|
|
3791
3800
|
this.onSet(this, (item) => {
|
|
3792
3801
|
this._indexRoute[item.route.key] = item;
|
|
@@ -3806,14 +3815,14 @@ class PageRepo extends PageList {
|
|
|
3806
3815
|
open(route) {
|
|
3807
3816
|
let controller = this.getController(route.path);
|
|
3808
3817
|
if (!controller) {
|
|
3809
|
-
throw new Error("
|
|
3818
|
+
throw new Error("view controller no register: " + route.path);
|
|
3810
3819
|
}
|
|
3811
3820
|
return controller.openByRoute(route);
|
|
3812
3821
|
}
|
|
3813
3822
|
close(route) {
|
|
3814
3823
|
let controller = this.getController(route.path);
|
|
3815
3824
|
if (!controller) {
|
|
3816
|
-
throw new Error("
|
|
3825
|
+
throw new Error("view controller no register: " + route.path);
|
|
3817
3826
|
}
|
|
3818
3827
|
controller.closeByRoute(route);
|
|
3819
3828
|
}
|
|
@@ -3822,25 +3831,16 @@ class PageRepo extends PageList {
|
|
|
3822
3831
|
* @param route
|
|
3823
3832
|
*/
|
|
3824
3833
|
refresh(route) {
|
|
3825
|
-
let
|
|
3826
|
-
if (
|
|
3827
|
-
|
|
3834
|
+
let view = this.getByRoute(route);
|
|
3835
|
+
if (view) {
|
|
3836
|
+
view.controller.refresh();
|
|
3828
3837
|
}
|
|
3829
3838
|
}
|
|
3830
|
-
/**
|
|
3831
|
-
* 历史记录
|
|
3832
|
-
*/
|
|
3833
|
-
getHistory() {
|
|
3834
|
-
return this._history;
|
|
3835
|
-
}
|
|
3836
|
-
back() {
|
|
3837
|
-
this.open(this._history.pop());
|
|
3838
|
-
}
|
|
3839
3839
|
getByRoute(route) {
|
|
3840
3840
|
return this._indexRoute[route.key];
|
|
3841
3841
|
}
|
|
3842
3842
|
listByRoutePath(path) {
|
|
3843
|
-
let list = new
|
|
3843
|
+
let list = new ViewList();
|
|
3844
3844
|
this.forEach((index, item) => {
|
|
3845
3845
|
if (item.controller.route.path == path) {
|
|
3846
3846
|
list.push(item);
|
|
@@ -3849,7 +3849,7 @@ class PageRepo extends PageList {
|
|
|
3849
3849
|
return list;
|
|
3850
3850
|
}
|
|
3851
3851
|
listByTags(tags) {
|
|
3852
|
-
let list = new
|
|
3852
|
+
let list = new ViewList();
|
|
3853
3853
|
this.forEach((index, item) => {
|
|
3854
3854
|
if (item.controller.hasTags(tags)) {
|
|
3855
3855
|
list.push(item);
|
|
@@ -3869,7 +3869,7 @@ class PageRepo extends PageList {
|
|
|
3869
3869
|
getOrNewLayer(name) {
|
|
3870
3870
|
let layer = this._indexLayer[name];
|
|
3871
3871
|
if (!layer) {
|
|
3872
|
-
layer = new
|
|
3872
|
+
layer = new ViewLayer(name);
|
|
3873
3873
|
this._indexLayer[name] = layer;
|
|
3874
3874
|
}
|
|
3875
3875
|
return layer;
|
|
@@ -3889,9 +3889,9 @@ class PageRepo extends PageList {
|
|
|
3889
3889
|
return dict;
|
|
3890
3890
|
}
|
|
3891
3891
|
}
|
|
3892
|
-
const
|
|
3892
|
+
const viewrepo = new ViewRepo();
|
|
3893
3893
|
|
|
3894
|
-
class
|
|
3894
|
+
class ViewController extends Controller {
|
|
3895
3895
|
constructor(routeName, config) {
|
|
3896
3896
|
super(routeName);
|
|
3897
3897
|
this._enableHistory = false;
|
|
@@ -3913,144 +3913,145 @@ class PageController extends Controller {
|
|
|
3913
3913
|
}
|
|
3914
3914
|
close(...args) {
|
|
3915
3915
|
}
|
|
3916
|
-
onOpening(
|
|
3916
|
+
onOpening(view) {
|
|
3917
3917
|
}
|
|
3918
|
-
onOpened(
|
|
3918
|
+
onOpened(view) {
|
|
3919
3919
|
}
|
|
3920
|
-
onClosing(
|
|
3920
|
+
onClosing(view) {
|
|
3921
3921
|
}
|
|
3922
|
-
onClosed(
|
|
3922
|
+
onClosed(view) {
|
|
3923
3923
|
}
|
|
3924
|
-
onRefresh(
|
|
3924
|
+
onRefresh(view) {
|
|
3925
3925
|
}
|
|
3926
3926
|
openByRoute(route) {
|
|
3927
|
-
let
|
|
3928
|
-
let
|
|
3927
|
+
let newview;
|
|
3928
|
+
let oldview;
|
|
3929
3929
|
if (this._layer) {
|
|
3930
|
-
let layer =
|
|
3931
|
-
|
|
3932
|
-
if (
|
|
3933
|
-
let currentRoute =
|
|
3930
|
+
let layer = viewrepo.getLayer(this._layer);
|
|
3931
|
+
oldview = layer.currentView;
|
|
3932
|
+
if (oldview) {
|
|
3933
|
+
let currentRoute = oldview.route;
|
|
3934
3934
|
if (currentRoute.key == route.key) {
|
|
3935
|
-
return
|
|
3935
|
+
return oldview;
|
|
3936
3936
|
}
|
|
3937
3937
|
// 关闭
|
|
3938
|
-
let currentCtrl =
|
|
3939
|
-
currentCtrl.
|
|
3938
|
+
let currentCtrl = oldview.controller;
|
|
3939
|
+
currentCtrl.closeView(oldview);
|
|
3940
3940
|
if (currentCtrl._enableHistory) {
|
|
3941
|
-
|
|
3941
|
+
layer.getHistory().push(oldview.route);
|
|
3942
3942
|
}
|
|
3943
3943
|
}
|
|
3944
|
-
|
|
3945
|
-
layer.
|
|
3944
|
+
newview = new View(this, route);
|
|
3945
|
+
layer.currentView = newview;
|
|
3946
3946
|
}
|
|
3947
3947
|
else {
|
|
3948
|
-
|
|
3948
|
+
newview = new View(this, route);
|
|
3949
3949
|
}
|
|
3950
3950
|
//
|
|
3951
|
-
this.
|
|
3951
|
+
this.openView(newview);
|
|
3952
3952
|
//
|
|
3953
|
-
return
|
|
3953
|
+
return newview;
|
|
3954
3954
|
}
|
|
3955
|
-
|
|
3956
|
-
if (!
|
|
3955
|
+
openView(view) {
|
|
3956
|
+
if (!view) {
|
|
3957
3957
|
return;
|
|
3958
3958
|
}
|
|
3959
|
-
if (
|
|
3959
|
+
if (view.state != ViewState.Closed) {
|
|
3960
3960
|
return;
|
|
3961
3961
|
}
|
|
3962
|
-
this.
|
|
3963
|
-
|
|
3964
|
-
|
|
3962
|
+
this._lastView = view;
|
|
3963
|
+
view.state = ViewState.Opening;
|
|
3964
|
+
view.dispatch(ViewEvent.Opening);
|
|
3965
3965
|
//
|
|
3966
|
-
try {
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
}
|
|
3984
|
-
}
|
|
3985
|
-
openComplete(page) {
|
|
3986
|
-
if (!page) {
|
|
3966
|
+
// try {
|
|
3967
|
+
viewrepo.push(view);
|
|
3968
|
+
this.onOpening(view);
|
|
3969
|
+
// @ts-ignore
|
|
3970
|
+
if (!view._waitOpenComplete) {
|
|
3971
|
+
// 没有被打断,打开完成
|
|
3972
|
+
this.openComplete(view);
|
|
3973
|
+
}
|
|
3974
|
+
// } catch (e) {
|
|
3975
|
+
// console.error(`open view ${view.route.key}`)
|
|
3976
|
+
// console.error(e.stack);
|
|
3977
|
+
// //
|
|
3978
|
+
// this.closeView(view);
|
|
3979
|
+
// }
|
|
3980
|
+
}
|
|
3981
|
+
openComplete(view) {
|
|
3982
|
+
if (!view) {
|
|
3987
3983
|
return;
|
|
3988
3984
|
}
|
|
3989
|
-
this.
|
|
3990
|
-
|
|
3991
|
-
this.onOpened(
|
|
3992
|
-
|
|
3985
|
+
this._lastView = view;
|
|
3986
|
+
view.state = ViewState.Opened;
|
|
3987
|
+
this.onOpened(view);
|
|
3988
|
+
view.dispatch(ViewEvent.Opened);
|
|
3993
3989
|
}
|
|
3990
|
+
/**
|
|
3991
|
+
* viewrepo中存在页面才会关闭
|
|
3992
|
+
* @param route
|
|
3993
|
+
* @returns
|
|
3994
|
+
*/
|
|
3994
3995
|
closeByRoute(route) {
|
|
3995
|
-
let
|
|
3996
|
+
let lastview;
|
|
3996
3997
|
if (this._layer) {
|
|
3997
|
-
let layer =
|
|
3998
|
-
|
|
3999
|
-
layer.
|
|
3998
|
+
let layer = viewrepo.getLayer(this._layer);
|
|
3999
|
+
lastview = layer.currentView;
|
|
4000
|
+
layer.currentView = null;
|
|
4001
|
+
if (this._enableHistory) {
|
|
4002
|
+
// 清空历史记录
|
|
4003
|
+
layer.getHistory().length = 0;
|
|
4004
|
+
}
|
|
4000
4005
|
}
|
|
4001
4006
|
else {
|
|
4002
|
-
|
|
4003
|
-
}
|
|
4004
|
-
this.closePage(lastpage);
|
|
4005
|
-
if (this._enableHistory) {
|
|
4006
|
-
// 清空历史记录
|
|
4007
|
-
pagerepo.getHistory().length = 0;
|
|
4007
|
+
lastview = viewrepo.getByRoute(route);
|
|
4008
4008
|
}
|
|
4009
|
-
|
|
4009
|
+
this.closeView(lastview);
|
|
4010
|
+
return lastview;
|
|
4010
4011
|
}
|
|
4011
|
-
|
|
4012
|
-
if (!
|
|
4012
|
+
closeView(view) {
|
|
4013
|
+
if (!view) {
|
|
4013
4014
|
return;
|
|
4014
4015
|
}
|
|
4015
|
-
if (
|
|
4016
|
+
if (view.state == ViewState.Closed) {
|
|
4016
4017
|
return;
|
|
4017
4018
|
}
|
|
4018
|
-
this.
|
|
4019
|
-
|
|
4020
|
-
|
|
4019
|
+
this._lastView = view;
|
|
4020
|
+
view.state = ViewState.Closeing;
|
|
4021
|
+
view.dispatch(ViewEvent.Closeing);
|
|
4021
4022
|
try {
|
|
4022
|
-
this.onClosing(
|
|
4023
|
+
this.onClosing(view);
|
|
4023
4024
|
// @ts-ignore
|
|
4024
|
-
if (!
|
|
4025
|
+
if (!view._waitCloseComplete) {
|
|
4025
4026
|
// 没有被打断,关闭完成
|
|
4026
|
-
this.closeComplete(
|
|
4027
|
+
this.closeComplete(view);
|
|
4027
4028
|
}
|
|
4028
4029
|
else {
|
|
4029
4030
|
// 被打断了,等待完成1
|
|
4030
4031
|
}
|
|
4031
4032
|
}
|
|
4032
4033
|
catch (e) {
|
|
4033
|
-
console.error(`close
|
|
4034
|
+
console.error(`close view ${view.route.key}`);
|
|
4034
4035
|
console.error(e.stack);
|
|
4035
4036
|
}
|
|
4036
4037
|
}
|
|
4037
|
-
closeComplete(
|
|
4038
|
-
if (!
|
|
4038
|
+
closeComplete(view) {
|
|
4039
|
+
if (!view) {
|
|
4039
4040
|
return;
|
|
4040
4041
|
}
|
|
4041
|
-
|
|
4042
|
-
this.
|
|
4042
|
+
viewrepo.remove(view);
|
|
4043
|
+
this._lastView = view;
|
|
4043
4044
|
// @ts-ignore
|
|
4044
|
-
let objectDict =
|
|
4045
|
+
let objectDict = view._objectDict;
|
|
4045
4046
|
if (objectDict) {
|
|
4046
4047
|
objectDict.clear();
|
|
4047
4048
|
}
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
this.onClosed(
|
|
4049
|
+
view.state = ViewState.Closed;
|
|
4050
|
+
view.dispatch(ViewEvent.Closed);
|
|
4051
|
+
this.onClosed(view);
|
|
4051
4052
|
}
|
|
4052
4053
|
refresh() {
|
|
4053
|
-
this.onRefresh(this.
|
|
4054
|
+
this.onRefresh(this._lastView);
|
|
4054
4055
|
}
|
|
4055
4056
|
get layer() {
|
|
4056
4057
|
return this._layer;
|
|
@@ -4075,8 +4076,8 @@ class PageController extends Controller {
|
|
|
4075
4076
|
this._tags = tags;
|
|
4076
4077
|
return this;
|
|
4077
4078
|
}
|
|
4078
|
-
get
|
|
4079
|
-
return this.
|
|
4079
|
+
get lastView() {
|
|
4080
|
+
return this._lastView;
|
|
4080
4081
|
}
|
|
4081
4082
|
get route() {
|
|
4082
4083
|
return this._route;
|
|
@@ -6359,5 +6360,5 @@ class WidgetUtil {
|
|
|
6359
6360
|
}
|
|
6360
6361
|
var widgetutil = new WidgetUtil();
|
|
6361
6362
|
|
|
6362
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventItem, EventManager, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapUtil, MathUtil, Model, NetUtil,
|
|
6363
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventItem, EventManager, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, View, ViewController, ViewEvent, ViewLayer, ViewList, ViewRepo, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uidict, uimgr, uiutil, viewrepo, widgetutil };
|
|
6363
6364
|
//# sourceMappingURL=index.esm.js.map
|