@zhongguo168a/yxeditor-common 0.0.26 → 0.0.27
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 +43 -43
- package/dist/index.esm.js +127 -127
- 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,33 @@ 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
|
-
closeByRoute(route?: Route):
|
|
1027
|
-
private
|
|
1028
|
-
closeComplete(
|
|
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
|
+
closeByRoute(route?: Route): View;
|
|
1027
|
+
private closeView;
|
|
1028
|
+
closeComplete(view: View): void;
|
|
1029
1029
|
refresh(): void;
|
|
1030
1030
|
get layer(): string;
|
|
1031
1031
|
hasTags(tags: string[]): boolean;
|
|
1032
1032
|
setLayer(name: string): this;
|
|
1033
1033
|
setTags(tags: string[]): this;
|
|
1034
|
-
get
|
|
1034
|
+
get lastView(): View;
|
|
1035
1035
|
get route(): Route;
|
|
1036
1036
|
get enableHistory(): boolean;
|
|
1037
1037
|
protected _enableHistory: boolean;
|
|
1038
1038
|
protected _route: Route;
|
|
1039
|
-
protected
|
|
1039
|
+
protected _lastView: View;
|
|
1040
1040
|
protected _tags: {};
|
|
1041
1041
|
protected _layer: string;
|
|
1042
1042
|
}
|
|
1043
1043
|
|
|
1044
|
-
declare enum
|
|
1044
|
+
declare enum ViewState {
|
|
1045
1045
|
/**
|
|
1046
1046
|
* 关闭
|
|
1047
1047
|
*/
|
|
@@ -1059,15 +1059,15 @@ declare enum PageState {
|
|
|
1059
1059
|
*/
|
|
1060
1060
|
Closeing = 3
|
|
1061
1061
|
}
|
|
1062
|
-
declare enum
|
|
1062
|
+
declare enum ViewEvent {
|
|
1063
1063
|
Opening = "opening",
|
|
1064
1064
|
Opened = "opened",
|
|
1065
1065
|
Closeing = "closeing",
|
|
1066
1066
|
Closed = "closed",
|
|
1067
1067
|
Stop = "stop"
|
|
1068
1068
|
}
|
|
1069
|
-
declare class
|
|
1070
|
-
constructor(controller:
|
|
1069
|
+
declare class View extends EventManager {
|
|
1070
|
+
constructor(controller: ViewController, route: Route);
|
|
1071
1071
|
/**
|
|
1072
1072
|
* 等待打开完成指令
|
|
1073
1073
|
*/
|
|
@@ -1084,13 +1084,13 @@ declare class Page extends EventManager {
|
|
|
1084
1084
|
toString(): string;
|
|
1085
1085
|
protected _waitOpenComplete: boolean;
|
|
1086
1086
|
protected _waitCloseComplete: boolean;
|
|
1087
|
-
get controller():
|
|
1087
|
+
get controller(): ViewController;
|
|
1088
1088
|
get route(): Route;
|
|
1089
1089
|
datas: {};
|
|
1090
1090
|
tags: {};
|
|
1091
1091
|
layer: string;
|
|
1092
|
-
state:
|
|
1093
|
-
protected _controller:
|
|
1092
|
+
state: ViewState;
|
|
1093
|
+
protected _controller: ViewController;
|
|
1094
1094
|
protected _route: Route;
|
|
1095
1095
|
}
|
|
1096
1096
|
|
|
@@ -1098,14 +1098,20 @@ declare class Page extends EventManager {
|
|
|
1098
1098
|
* 视图管理器
|
|
1099
1099
|
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
1100
1100
|
*/
|
|
1101
|
-
declare class
|
|
1101
|
+
declare class ViewLayer {
|
|
1102
1102
|
name: string;
|
|
1103
1103
|
constructor(name: string);
|
|
1104
1104
|
close(): void;
|
|
1105
|
+
/**
|
|
1106
|
+
* 历史记录
|
|
1107
|
+
*/
|
|
1108
|
+
getHistory(): Route[];
|
|
1109
|
+
back(): void;
|
|
1105
1110
|
/**
|
|
1106
1111
|
* 当前的页面
|
|
1107
1112
|
*/
|
|
1108
|
-
|
|
1113
|
+
currentView: View;
|
|
1114
|
+
protected _history: Route[];
|
|
1109
1115
|
}
|
|
1110
1116
|
|
|
1111
1117
|
declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
@@ -1121,47 +1127,41 @@ declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
|
1121
1127
|
}
|
|
1122
1128
|
declare var uidict: UIObjectDict;
|
|
1123
1129
|
|
|
1124
|
-
declare class
|
|
1130
|
+
declare class ViewList extends List<View> {
|
|
1125
1131
|
}
|
|
1126
|
-
declare class
|
|
1132
|
+
declare class ViewRepo extends ViewList {
|
|
1127
1133
|
constructor();
|
|
1128
|
-
openByString(route: string):
|
|
1134
|
+
openByString(route: string): View;
|
|
1129
1135
|
/**
|
|
1130
1136
|
* 打开页面
|
|
1131
1137
|
* 一个路由代表一个页面
|
|
1132
1138
|
* @param route
|
|
1133
1139
|
*/
|
|
1134
|
-
open(route: Route):
|
|
1140
|
+
open(route: Route): View;
|
|
1135
1141
|
close(route: Route): void;
|
|
1136
1142
|
/**
|
|
1137
1143
|
* 如果页面存在,则刷新
|
|
1138
1144
|
* @param route
|
|
1139
1145
|
*/
|
|
1140
1146
|
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;
|
|
1147
|
+
getByRoute(route: Route): View;
|
|
1148
|
+
listByRoutePath(path: string): ViewList;
|
|
1149
|
+
listByTags(tags: string[]): ViewList;
|
|
1150
|
+
getLayerMain(): ViewLayer;
|
|
1150
1151
|
/**
|
|
1151
1152
|
* @param name
|
|
1152
1153
|
*/
|
|
1153
|
-
getLayer(name: string):
|
|
1154
|
-
protected getOrNewLayer(name: string):
|
|
1155
|
-
getController(name: string):
|
|
1156
|
-
registerController(ctrl:
|
|
1154
|
+
getLayer(name: string): ViewLayer;
|
|
1155
|
+
protected getOrNewLayer(name: string): ViewLayer;
|
|
1156
|
+
getController(name: string): ViewController;
|
|
1157
|
+
registerController(ctrl: ViewController): void;
|
|
1157
1158
|
get objectDict(): UIObjectDict;
|
|
1158
1159
|
protected _objectDict: UIObjectDict;
|
|
1159
1160
|
protected _indexLayer: {};
|
|
1160
1161
|
protected _indexRoute: {};
|
|
1161
|
-
protected _history: Route[];
|
|
1162
1162
|
protected _ctrlDict: ControllerDict;
|
|
1163
1163
|
}
|
|
1164
|
-
declare const
|
|
1164
|
+
declare const viewrepo: ViewRepo;
|
|
1165
1165
|
|
|
1166
1166
|
/**
|
|
1167
1167
|
* 事件字符串分隔符
|
|
@@ -2025,5 +2025,5 @@ declare class WidgetUtil {
|
|
|
2025
2025
|
}
|
|
2026
2026
|
declare var widgetutil: WidgetUtil;
|
|
2027
2027
|
|
|
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,
|
|
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, 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
2029
|
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
|
+
}
|
|
3790
|
+
}
|
|
3791
|
+
|
|
3792
|
+
class ViewList extends List {
|
|
3783
3793
|
}
|
|
3784
|
-
class
|
|
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,144 @@ 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
3966
|
try {
|
|
3967
|
-
|
|
3968
|
-
this.onOpening(
|
|
3967
|
+
viewrepo.push(view);
|
|
3968
|
+
this.onOpening(view);
|
|
3969
3969
|
// @ts-ignore
|
|
3970
|
-
if (!
|
|
3970
|
+
if (!view._waitOpenComplete) {
|
|
3971
3971
|
// 没有被打断,打开完成
|
|
3972
|
-
this.openComplete(
|
|
3972
|
+
this.openComplete(view);
|
|
3973
3973
|
}
|
|
3974
3974
|
else {
|
|
3975
3975
|
// 被打断了,等待完成1
|
|
3976
3976
|
}
|
|
3977
3977
|
}
|
|
3978
3978
|
catch (e) {
|
|
3979
|
-
console.error(`open
|
|
3979
|
+
console.error(`open view ${view.route.key}`);
|
|
3980
3980
|
console.error(e.stack);
|
|
3981
3981
|
//
|
|
3982
|
-
this.
|
|
3982
|
+
this.closeView(view);
|
|
3983
3983
|
}
|
|
3984
3984
|
}
|
|
3985
|
-
openComplete(
|
|
3986
|
-
if (!
|
|
3985
|
+
openComplete(view) {
|
|
3986
|
+
if (!view) {
|
|
3987
3987
|
return;
|
|
3988
3988
|
}
|
|
3989
|
-
this.
|
|
3990
|
-
|
|
3991
|
-
this.onOpened(
|
|
3992
|
-
|
|
3989
|
+
this._lastView = view;
|
|
3990
|
+
view.state = ViewState.Opened;
|
|
3991
|
+
this.onOpened(view);
|
|
3992
|
+
view.dispatch(ViewEvent.Opened);
|
|
3993
3993
|
}
|
|
3994
3994
|
closeByRoute(route) {
|
|
3995
|
-
let
|
|
3995
|
+
let lastview;
|
|
3996
3996
|
if (this._layer) {
|
|
3997
|
-
let layer =
|
|
3998
|
-
|
|
3999
|
-
layer.
|
|
3997
|
+
let layer = viewrepo.getLayer(this._layer);
|
|
3998
|
+
lastview = layer.currentView;
|
|
3999
|
+
layer.currentView = null;
|
|
4000
|
+
if (this._enableHistory) {
|
|
4001
|
+
// 清空历史记录
|
|
4002
|
+
layer.getHistory().length = 0;
|
|
4003
|
+
}
|
|
4000
4004
|
}
|
|
4001
4005
|
else {
|
|
4002
|
-
|
|
4003
|
-
}
|
|
4004
|
-
this.closePage(lastpage);
|
|
4005
|
-
if (this._enableHistory) {
|
|
4006
|
-
// 清空历史记录
|
|
4007
|
-
pagerepo.getHistory().length = 0;
|
|
4006
|
+
lastview = viewrepo.getByRoute(route);
|
|
4008
4007
|
}
|
|
4009
|
-
|
|
4008
|
+
this.closeView(lastview);
|
|
4009
|
+
return lastview;
|
|
4010
4010
|
}
|
|
4011
|
-
|
|
4012
|
-
if (!
|
|
4011
|
+
closeView(view) {
|
|
4012
|
+
if (!view) {
|
|
4013
4013
|
return;
|
|
4014
4014
|
}
|
|
4015
|
-
if (
|
|
4015
|
+
if (view.state == ViewState.Closed) {
|
|
4016
4016
|
return;
|
|
4017
4017
|
}
|
|
4018
|
-
this.
|
|
4019
|
-
|
|
4020
|
-
|
|
4018
|
+
this._lastView = view;
|
|
4019
|
+
view.state = ViewState.Closeing;
|
|
4020
|
+
view.dispatch(ViewEvent.Closeing);
|
|
4021
4021
|
try {
|
|
4022
|
-
this.onClosing(
|
|
4022
|
+
this.onClosing(view);
|
|
4023
4023
|
// @ts-ignore
|
|
4024
|
-
if (!
|
|
4024
|
+
if (!view._waitCloseComplete) {
|
|
4025
4025
|
// 没有被打断,关闭完成
|
|
4026
|
-
this.closeComplete(
|
|
4026
|
+
this.closeComplete(view);
|
|
4027
4027
|
}
|
|
4028
4028
|
else {
|
|
4029
4029
|
// 被打断了,等待完成1
|
|
4030
4030
|
}
|
|
4031
4031
|
}
|
|
4032
4032
|
catch (e) {
|
|
4033
|
-
console.error(`close
|
|
4033
|
+
console.error(`close view ${view.route.key}`);
|
|
4034
4034
|
console.error(e.stack);
|
|
4035
4035
|
}
|
|
4036
4036
|
}
|
|
4037
|
-
closeComplete(
|
|
4038
|
-
if (!
|
|
4037
|
+
closeComplete(view) {
|
|
4038
|
+
if (!view) {
|
|
4039
4039
|
return;
|
|
4040
4040
|
}
|
|
4041
|
-
|
|
4042
|
-
this.
|
|
4041
|
+
viewrepo.remove(view);
|
|
4042
|
+
this._lastView = view;
|
|
4043
4043
|
// @ts-ignore
|
|
4044
|
-
let objectDict =
|
|
4044
|
+
let objectDict = view._objectDict;
|
|
4045
4045
|
if (objectDict) {
|
|
4046
4046
|
objectDict.clear();
|
|
4047
4047
|
}
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
this.onClosed(
|
|
4048
|
+
view.state = ViewState.Closed;
|
|
4049
|
+
view.dispatch(ViewEvent.Closed);
|
|
4050
|
+
this.onClosed(view);
|
|
4051
4051
|
}
|
|
4052
4052
|
refresh() {
|
|
4053
|
-
this.onRefresh(this.
|
|
4053
|
+
this.onRefresh(this._lastView);
|
|
4054
4054
|
}
|
|
4055
4055
|
get layer() {
|
|
4056
4056
|
return this._layer;
|
|
@@ -4075,8 +4075,8 @@ class PageController extends Controller {
|
|
|
4075
4075
|
this._tags = tags;
|
|
4076
4076
|
return this;
|
|
4077
4077
|
}
|
|
4078
|
-
get
|
|
4079
|
-
return this.
|
|
4078
|
+
get lastView() {
|
|
4079
|
+
return this._lastView;
|
|
4080
4080
|
}
|
|
4081
4081
|
get route() {
|
|
4082
4082
|
return this._route;
|
|
@@ -6359,5 +6359,5 @@ class WidgetUtil {
|
|
|
6359
6359
|
}
|
|
6360
6360
|
var widgetutil = new WidgetUtil();
|
|
6361
6361
|
|
|
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,
|
|
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, 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
6363
|
//# sourceMappingURL=index.esm.js.map
|