@zhongguo168a/yxeditor-common 0.0.19 → 0.0.21
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 +70 -72
- package/dist/index.esm.js +179 -185
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -474,6 +474,7 @@ declare class TreeNode<T = any> {
|
|
|
474
474
|
walkPrev(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): any;
|
|
475
475
|
private _walkPrev;
|
|
476
476
|
dump(): void;
|
|
477
|
+
first(): TreeNode;
|
|
477
478
|
/**
|
|
478
479
|
* 遍历节点,查找指定编号的节点
|
|
479
480
|
*/
|
|
@@ -1006,74 +1007,6 @@ declare class Route {
|
|
|
1006
1007
|
protected _route: string;
|
|
1007
1008
|
}
|
|
1008
1009
|
|
|
1009
|
-
declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
1010
|
-
/**
|
|
1011
|
-
* 获取唯一的
|
|
1012
|
-
* @param prefab
|
|
1013
|
-
*/
|
|
1014
|
-
uniqueObject(prefab: Prefab): Node;
|
|
1015
|
-
removeObject(prefab: Prefab): void;
|
|
1016
|
-
popObject(prefab: Prefab): any;
|
|
1017
|
-
backObject(object: Node): void;
|
|
1018
|
-
protected getList(key: any): List;
|
|
1019
|
-
}
|
|
1020
|
-
declare var uidict: UIObjectDict;
|
|
1021
|
-
|
|
1022
|
-
/**
|
|
1023
|
-
* 视图管理器
|
|
1024
|
-
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
1025
|
-
*/
|
|
1026
|
-
declare class PageLayer {
|
|
1027
|
-
name: string;
|
|
1028
|
-
constructor(name: string);
|
|
1029
|
-
close(): void;
|
|
1030
|
-
/**
|
|
1031
|
-
* 当前的页面
|
|
1032
|
-
*/
|
|
1033
|
-
currentPage: Page;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
declare class PageList extends List<Page> {
|
|
1037
|
-
}
|
|
1038
|
-
declare class PageRepo extends PageList {
|
|
1039
|
-
constructor();
|
|
1040
|
-
openByString(route: string): Page;
|
|
1041
|
-
/**
|
|
1042
|
-
* 打开页面
|
|
1043
|
-
* 一个路由代表一个页面
|
|
1044
|
-
* @param route
|
|
1045
|
-
*/
|
|
1046
|
-
open(route: Route): Page;
|
|
1047
|
-
close(route: Route): void;
|
|
1048
|
-
/**
|
|
1049
|
-
* 如果页面存在,则刷新
|
|
1050
|
-
* @param route
|
|
1051
|
-
*/
|
|
1052
|
-
refresh(route: Route): void;
|
|
1053
|
-
/**
|
|
1054
|
-
* 历史记录
|
|
1055
|
-
*/
|
|
1056
|
-
getHistory(): Route[];
|
|
1057
|
-
back(): void;
|
|
1058
|
-
getByRoute(route: Route): Page;
|
|
1059
|
-
listByTags(tags: string[]): PageList;
|
|
1060
|
-
getLayerMain(): PageLayer;
|
|
1061
|
-
/**
|
|
1062
|
-
* @param name
|
|
1063
|
-
*/
|
|
1064
|
-
getLayer(name: string): PageLayer;
|
|
1065
|
-
protected getOrNewLayer(name: string): PageLayer;
|
|
1066
|
-
getController(name: string): PageController;
|
|
1067
|
-
registerController(ctrl: PageController): void;
|
|
1068
|
-
get objectDict(): UIObjectDict;
|
|
1069
|
-
protected _objectDict: UIObjectDict;
|
|
1070
|
-
protected _indexLayer: {};
|
|
1071
|
-
protected _indexRoute: {};
|
|
1072
|
-
protected _history: Route[];
|
|
1073
|
-
protected _ctrlDict: ControllerDict;
|
|
1074
|
-
}
|
|
1075
|
-
declare const pageRepo: PageRepo;
|
|
1076
|
-
|
|
1077
1010
|
declare class PageController extends Controller {
|
|
1078
1011
|
constructor(routeName: string, config?: {
|
|
1079
1012
|
layer?: string;
|
|
@@ -1106,7 +1039,6 @@ declare class PageController extends Controller {
|
|
|
1106
1039
|
protected _lastPage: Page;
|
|
1107
1040
|
protected _tags: {};
|
|
1108
1041
|
protected _layer: string;
|
|
1109
|
-
protected _pagerepo: PageRepo;
|
|
1110
1042
|
}
|
|
1111
1043
|
|
|
1112
1044
|
declare enum PageState {
|
|
@@ -1150,8 +1082,6 @@ declare class Page extends EventManager {
|
|
|
1150
1082
|
*/
|
|
1151
1083
|
wait(): Promise<this>;
|
|
1152
1084
|
toString(): string;
|
|
1153
|
-
get objectDict(): UIObjectDict;
|
|
1154
|
-
protected _objectDict: UIObjectDict;
|
|
1155
1085
|
protected _waitOpenComplete: boolean;
|
|
1156
1086
|
protected _waitCloseComplete: boolean;
|
|
1157
1087
|
get controller(): PageController;
|
|
@@ -1164,6 +1094,74 @@ declare class Page extends EventManager {
|
|
|
1164
1094
|
protected _route: Route;
|
|
1165
1095
|
}
|
|
1166
1096
|
|
|
1097
|
+
/**
|
|
1098
|
+
* 视图管理器
|
|
1099
|
+
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
1100
|
+
*/
|
|
1101
|
+
declare class PageLayer {
|
|
1102
|
+
name: string;
|
|
1103
|
+
constructor(name: string);
|
|
1104
|
+
close(): void;
|
|
1105
|
+
/**
|
|
1106
|
+
* 当前的页面
|
|
1107
|
+
*/
|
|
1108
|
+
currentPage: Page;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
1112
|
+
/**
|
|
1113
|
+
* 获取唯一的
|
|
1114
|
+
* @param prefab
|
|
1115
|
+
*/
|
|
1116
|
+
uniqueObject(prefab: Prefab): Node;
|
|
1117
|
+
removeObject(prefab: Prefab): void;
|
|
1118
|
+
popObject(prefab: Prefab): any;
|
|
1119
|
+
backObject(object: Node): void;
|
|
1120
|
+
protected getList(key: any): List;
|
|
1121
|
+
}
|
|
1122
|
+
declare var uidict: UIObjectDict;
|
|
1123
|
+
|
|
1124
|
+
declare class PageList extends List<Page> {
|
|
1125
|
+
}
|
|
1126
|
+
declare class PageRepo extends PageList {
|
|
1127
|
+
constructor();
|
|
1128
|
+
openByString(route: string): Page;
|
|
1129
|
+
/**
|
|
1130
|
+
* 打开页面
|
|
1131
|
+
* 一个路由代表一个页面
|
|
1132
|
+
* @param route
|
|
1133
|
+
*/
|
|
1134
|
+
open(route: Route): Page;
|
|
1135
|
+
close(route: Route): void;
|
|
1136
|
+
/**
|
|
1137
|
+
* 如果页面存在,则刷新
|
|
1138
|
+
* @param route
|
|
1139
|
+
*/
|
|
1140
|
+
refresh(route: Route): void;
|
|
1141
|
+
/**
|
|
1142
|
+
* 历史记录
|
|
1143
|
+
*/
|
|
1144
|
+
getHistory(): Route[];
|
|
1145
|
+
back(): void;
|
|
1146
|
+
getByRoute(route: Route): Page;
|
|
1147
|
+
listByTags(tags: string[]): PageList;
|
|
1148
|
+
getLayerMain(): PageLayer;
|
|
1149
|
+
/**
|
|
1150
|
+
* @param name
|
|
1151
|
+
*/
|
|
1152
|
+
getLayer(name: string): PageLayer;
|
|
1153
|
+
protected getOrNewLayer(name: string): PageLayer;
|
|
1154
|
+
getController(name: string): PageController;
|
|
1155
|
+
registerController(ctrl: PageController): void;
|
|
1156
|
+
get objectDict(): UIObjectDict;
|
|
1157
|
+
protected _objectDict: UIObjectDict;
|
|
1158
|
+
protected _indexLayer: {};
|
|
1159
|
+
protected _indexRoute: {};
|
|
1160
|
+
protected _history: Route[];
|
|
1161
|
+
protected _ctrlDict: ControllerDict;
|
|
1162
|
+
}
|
|
1163
|
+
declare const pagerepo: PageRepo;
|
|
1164
|
+
|
|
1167
1165
|
/**
|
|
1168
1166
|
* 事件字符串分隔符
|
|
1169
1167
|
*/
|
|
@@ -2014,5 +2012,5 @@ declare class WidgetUtil {
|
|
|
2014
2012
|
}
|
|
2015
2013
|
declare var widgetutil: WidgetUtil;
|
|
2016
2014
|
|
|
2017
|
-
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, Page, PageController, PageEvent, PageLayer, PageList, PageRepo, PageState, PathUtil, Pool, RandUtil, Route, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil,
|
|
2015
|
+
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, Page, PageController, PageEvent, PageLayer, PageList, PageRepo, PageState, PathUtil, Pool, RandUtil, Route, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, pagerepo, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uidict, uimgr, uiutil, widgetutil };
|
|
2018
2016
|
export type { CreatorFunction, DisposeFunction, IController, IError, IEventManager, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
|
package/dist/index.esm.js
CHANGED
|
@@ -2136,6 +2136,12 @@ class TreeNode {
|
|
|
2136
2136
|
return true;
|
|
2137
2137
|
});
|
|
2138
2138
|
}
|
|
2139
|
+
first() {
|
|
2140
|
+
if (this.children.length > 0) {
|
|
2141
|
+
return this.children[0];
|
|
2142
|
+
}
|
|
2143
|
+
return null;
|
|
2144
|
+
}
|
|
2139
2145
|
/**
|
|
2140
2146
|
* 遍历节点,查找指定编号的节点
|
|
2141
2147
|
*/
|
|
@@ -3469,60 +3475,6 @@ class Factory {
|
|
|
3469
3475
|
}
|
|
3470
3476
|
}
|
|
3471
3477
|
|
|
3472
|
-
class UIObjectDict extends Dictionary {
|
|
3473
|
-
/**
|
|
3474
|
-
* 获取唯一的
|
|
3475
|
-
* @param prefab
|
|
3476
|
-
*/
|
|
3477
|
-
uniqueObject(prefab) {
|
|
3478
|
-
if (!prefab) {
|
|
3479
|
-
console.warn("未设置prefab");
|
|
3480
|
-
return;
|
|
3481
|
-
}
|
|
3482
|
-
let key = prefab.data.uuid;
|
|
3483
|
-
let object = this.get(key);
|
|
3484
|
-
if (!object) {
|
|
3485
|
-
object = instantiate(prefab);
|
|
3486
|
-
this.set(key, object);
|
|
3487
|
-
}
|
|
3488
|
-
return object;
|
|
3489
|
-
}
|
|
3490
|
-
removeObject(prefab) {
|
|
3491
|
-
if (!prefab) {
|
|
3492
|
-
console.warn("未设置prefab");
|
|
3493
|
-
return;
|
|
3494
|
-
}
|
|
3495
|
-
this.delete(prefab.data.uuid);
|
|
3496
|
-
}
|
|
3497
|
-
popObject(prefab) {
|
|
3498
|
-
let object;
|
|
3499
|
-
let key = prefab.data.uuid;
|
|
3500
|
-
let list = this.getList(key);
|
|
3501
|
-
if (list.length == 0) {
|
|
3502
|
-
object = instantiate(prefab);
|
|
3503
|
-
}
|
|
3504
|
-
else {
|
|
3505
|
-
object = list.pop();
|
|
3506
|
-
}
|
|
3507
|
-
return object;
|
|
3508
|
-
}
|
|
3509
|
-
backObject(object) {
|
|
3510
|
-
// @ts-ignore
|
|
3511
|
-
let key = object.prefab.asset.uuid;
|
|
3512
|
-
let list = this.getList(key);
|
|
3513
|
-
list.push(object);
|
|
3514
|
-
}
|
|
3515
|
-
getList(key) {
|
|
3516
|
-
let list = this.get(key);
|
|
3517
|
-
if (!list) {
|
|
3518
|
-
list = new List();
|
|
3519
|
-
this.set(key, list);
|
|
3520
|
-
}
|
|
3521
|
-
return list;
|
|
3522
|
-
}
|
|
3523
|
-
}
|
|
3524
|
-
var uidict = new UIObjectDict();
|
|
3525
|
-
|
|
3526
3478
|
var PageState;
|
|
3527
3479
|
(function (PageState) {
|
|
3528
3480
|
/**
|
|
@@ -3623,14 +3575,6 @@ class Page extends EventManager {
|
|
|
3623
3575
|
toString() {
|
|
3624
3576
|
return `Page[${this.route.toString()}, ${this.id}]`;
|
|
3625
3577
|
}
|
|
3626
|
-
get objectDict() {
|
|
3627
|
-
let dict = this._objectDict;
|
|
3628
|
-
if (!dict) {
|
|
3629
|
-
dict = new UIObjectDict();
|
|
3630
|
-
this._objectDict = dict;
|
|
3631
|
-
}
|
|
3632
|
-
return dict;
|
|
3633
|
-
}
|
|
3634
3578
|
get controller() {
|
|
3635
3579
|
return this._controller;
|
|
3636
3580
|
}
|
|
@@ -3766,6 +3710,178 @@ class Route {
|
|
|
3766
3710
|
// 打开界面缓存的route对象
|
|
3767
3711
|
Route.data = {};
|
|
3768
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
|
+
class UIObjectDict extends Dictionary {
|
|
3729
|
+
/**
|
|
3730
|
+
* 获取唯一的
|
|
3731
|
+
* @param prefab
|
|
3732
|
+
*/
|
|
3733
|
+
uniqueObject(prefab) {
|
|
3734
|
+
if (!prefab) {
|
|
3735
|
+
console.warn("未设置prefab");
|
|
3736
|
+
return;
|
|
3737
|
+
}
|
|
3738
|
+
let key = prefab.data.uuid;
|
|
3739
|
+
let object = this.get(key);
|
|
3740
|
+
if (!object) {
|
|
3741
|
+
object = instantiate(prefab);
|
|
3742
|
+
this.set(key, object);
|
|
3743
|
+
}
|
|
3744
|
+
return object;
|
|
3745
|
+
}
|
|
3746
|
+
removeObject(prefab) {
|
|
3747
|
+
if (!prefab) {
|
|
3748
|
+
console.warn("未设置prefab");
|
|
3749
|
+
return;
|
|
3750
|
+
}
|
|
3751
|
+
this.delete(prefab.data.uuid);
|
|
3752
|
+
}
|
|
3753
|
+
popObject(prefab) {
|
|
3754
|
+
let object;
|
|
3755
|
+
let key = prefab.data.uuid;
|
|
3756
|
+
let list = this.getList(key);
|
|
3757
|
+
if (list.length == 0) {
|
|
3758
|
+
object = instantiate(prefab);
|
|
3759
|
+
}
|
|
3760
|
+
else {
|
|
3761
|
+
object = list.pop();
|
|
3762
|
+
}
|
|
3763
|
+
return object;
|
|
3764
|
+
}
|
|
3765
|
+
backObject(object) {
|
|
3766
|
+
// @ts-ignore
|
|
3767
|
+
let key = object.prefab.asset.uuid;
|
|
3768
|
+
let list = this.getList(key);
|
|
3769
|
+
list.push(object);
|
|
3770
|
+
}
|
|
3771
|
+
getList(key) {
|
|
3772
|
+
let list = this.get(key);
|
|
3773
|
+
if (!list) {
|
|
3774
|
+
list = new List();
|
|
3775
|
+
this.set(key, list);
|
|
3776
|
+
}
|
|
3777
|
+
return list;
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
var uidict = new UIObjectDict();
|
|
3781
|
+
|
|
3782
|
+
class PageList extends List {
|
|
3783
|
+
}
|
|
3784
|
+
class PageRepo extends PageList {
|
|
3785
|
+
constructor() {
|
|
3786
|
+
super();
|
|
3787
|
+
this._indexLayer = {};
|
|
3788
|
+
this._indexRoute = {};
|
|
3789
|
+
this._history = [];
|
|
3790
|
+
this._ctrlDict = new ControllerDict();
|
|
3791
|
+
this.onSet(this, (item) => {
|
|
3792
|
+
this._indexRoute[item.route.path] = item;
|
|
3793
|
+
});
|
|
3794
|
+
this.onDelete(this, (item) => {
|
|
3795
|
+
delete this._indexRoute[item.route.path];
|
|
3796
|
+
});
|
|
3797
|
+
}
|
|
3798
|
+
openByString(route) {
|
|
3799
|
+
return this.open(new Route(route));
|
|
3800
|
+
}
|
|
3801
|
+
/**
|
|
3802
|
+
* 打开页面
|
|
3803
|
+
* 一个路由代表一个页面
|
|
3804
|
+
* @param route
|
|
3805
|
+
*/
|
|
3806
|
+
open(route) {
|
|
3807
|
+
let controller = this.getController(route.path);
|
|
3808
|
+
if (!controller) {
|
|
3809
|
+
throw new Error("page controller no register: " + route.path);
|
|
3810
|
+
}
|
|
3811
|
+
return controller.openByRoute(route);
|
|
3812
|
+
}
|
|
3813
|
+
close(route) {
|
|
3814
|
+
let controller = this.getController(route.path);
|
|
3815
|
+
if (!controller) {
|
|
3816
|
+
throw new Error("page controller no register: " + route.path);
|
|
3817
|
+
}
|
|
3818
|
+
controller.closeByRoute(route);
|
|
3819
|
+
}
|
|
3820
|
+
/**
|
|
3821
|
+
* 如果页面存在,则刷新
|
|
3822
|
+
* @param route
|
|
3823
|
+
*/
|
|
3824
|
+
refresh(route) {
|
|
3825
|
+
let page = this.getByRoute(route);
|
|
3826
|
+
if (page) {
|
|
3827
|
+
page.controller.refresh();
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
/**
|
|
3831
|
+
* 历史记录
|
|
3832
|
+
*/
|
|
3833
|
+
getHistory() {
|
|
3834
|
+
return this._history;
|
|
3835
|
+
}
|
|
3836
|
+
back() {
|
|
3837
|
+
this.open(this._history.pop());
|
|
3838
|
+
}
|
|
3839
|
+
getByRoute(route) {
|
|
3840
|
+
return this._indexRoute[route.path];
|
|
3841
|
+
}
|
|
3842
|
+
listByTags(tags) {
|
|
3843
|
+
let list = new PageList();
|
|
3844
|
+
this.forEach((index, item) => {
|
|
3845
|
+
if (item.controller.hasTags(tags)) {
|
|
3846
|
+
list.push(item);
|
|
3847
|
+
}
|
|
3848
|
+
});
|
|
3849
|
+
return list;
|
|
3850
|
+
}
|
|
3851
|
+
getLayerMain() {
|
|
3852
|
+
return this._indexLayer["main"];
|
|
3853
|
+
}
|
|
3854
|
+
/**
|
|
3855
|
+
* @param name
|
|
3856
|
+
*/
|
|
3857
|
+
getLayer(name) {
|
|
3858
|
+
return this.getOrNewLayer(name);
|
|
3859
|
+
}
|
|
3860
|
+
getOrNewLayer(name) {
|
|
3861
|
+
let layer = this._indexLayer[name];
|
|
3862
|
+
if (!layer) {
|
|
3863
|
+
layer = new PageLayer(name);
|
|
3864
|
+
this._indexLayer[name] = layer;
|
|
3865
|
+
}
|
|
3866
|
+
return layer;
|
|
3867
|
+
}
|
|
3868
|
+
getController(name) {
|
|
3869
|
+
return this._ctrlDict.get(name);
|
|
3870
|
+
}
|
|
3871
|
+
registerController(ctrl) {
|
|
3872
|
+
this._ctrlDict.set(ctrl.name, ctrl);
|
|
3873
|
+
}
|
|
3874
|
+
get objectDict() {
|
|
3875
|
+
let dict = this._objectDict;
|
|
3876
|
+
if (!dict) {
|
|
3877
|
+
dict = new UIObjectDict();
|
|
3878
|
+
this._objectDict = dict;
|
|
3879
|
+
}
|
|
3880
|
+
return dict;
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
const pagerepo = new PageRepo();
|
|
3884
|
+
|
|
3769
3885
|
class PageController extends Controller {
|
|
3770
3886
|
constructor(routeName, config) {
|
|
3771
3887
|
super(routeName);
|
|
@@ -3802,7 +3918,6 @@ class PageController extends Controller {
|
|
|
3802
3918
|
let newpage;
|
|
3803
3919
|
let oldpage;
|
|
3804
3920
|
if (this._layer) {
|
|
3805
|
-
let pagerepo = this._pagerepo;
|
|
3806
3921
|
let layer = pagerepo.getLayer(this._layer);
|
|
3807
3922
|
oldpage = layer.currentPage;
|
|
3808
3923
|
if (oldpage) {
|
|
@@ -3840,7 +3955,6 @@ class PageController extends Controller {
|
|
|
3840
3955
|
page.dispatch(PageEvent.Opening);
|
|
3841
3956
|
//
|
|
3842
3957
|
try {
|
|
3843
|
-
let pagerepo = this._pagerepo;
|
|
3844
3958
|
pagerepo.push(page);
|
|
3845
3959
|
this.onOpening(page);
|
|
3846
3960
|
// @ts-ignore
|
|
@@ -3869,7 +3983,6 @@ class PageController extends Controller {
|
|
|
3869
3983
|
page.dispatch(PageEvent.Opened);
|
|
3870
3984
|
}
|
|
3871
3985
|
closeByRoute(route) {
|
|
3872
|
-
let pagerepo = this._pagerepo;
|
|
3873
3986
|
let lastpage;
|
|
3874
3987
|
if (this._layer) {
|
|
3875
3988
|
let layer = pagerepo.getLayer(this._layer);
|
|
@@ -3916,7 +4029,6 @@ class PageController extends Controller {
|
|
|
3916
4029
|
if (!page) {
|
|
3917
4030
|
return;
|
|
3918
4031
|
}
|
|
3919
|
-
let pagerepo = this._pagerepo;
|
|
3920
4032
|
pagerepo.remove(page);
|
|
3921
4033
|
this._lastPage = page;
|
|
3922
4034
|
// @ts-ignore
|
|
@@ -3965,124 +4077,6 @@ class PageController extends Controller {
|
|
|
3965
4077
|
}
|
|
3966
4078
|
}
|
|
3967
4079
|
|
|
3968
|
-
/**
|
|
3969
|
-
* 视图管理器
|
|
3970
|
-
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
3971
|
-
*/
|
|
3972
|
-
class PageLayer {
|
|
3973
|
-
constructor(name) {
|
|
3974
|
-
this.name = name;
|
|
3975
|
-
}
|
|
3976
|
-
close() {
|
|
3977
|
-
if (this.currentPage) {
|
|
3978
|
-
this.currentPage.controller.closeByRoute();
|
|
3979
|
-
}
|
|
3980
|
-
}
|
|
3981
|
-
}
|
|
3982
|
-
|
|
3983
|
-
class PageList extends List {
|
|
3984
|
-
}
|
|
3985
|
-
class PageRepo extends PageList {
|
|
3986
|
-
constructor() {
|
|
3987
|
-
super();
|
|
3988
|
-
this._indexLayer = {};
|
|
3989
|
-
this._indexRoute = {};
|
|
3990
|
-
this._history = [];
|
|
3991
|
-
this._ctrlDict = new ControllerDict();
|
|
3992
|
-
this.onSet(this, (item) => {
|
|
3993
|
-
this._indexRoute[item.route.path] = item;
|
|
3994
|
-
});
|
|
3995
|
-
this.onDelete(this, (item) => {
|
|
3996
|
-
delete this._indexRoute[item.route.path];
|
|
3997
|
-
});
|
|
3998
|
-
}
|
|
3999
|
-
openByString(route) {
|
|
4000
|
-
return this.open(new Route(route));
|
|
4001
|
-
}
|
|
4002
|
-
/**
|
|
4003
|
-
* 打开页面
|
|
4004
|
-
* 一个路由代表一个页面
|
|
4005
|
-
* @param route
|
|
4006
|
-
*/
|
|
4007
|
-
open(route) {
|
|
4008
|
-
let controller = this.getController(route.path);
|
|
4009
|
-
if (!controller) {
|
|
4010
|
-
throw new Error("page controller no register: " + route.path);
|
|
4011
|
-
}
|
|
4012
|
-
return controller.openByRoute(route);
|
|
4013
|
-
}
|
|
4014
|
-
close(route) {
|
|
4015
|
-
let controller = this.getController(route.path);
|
|
4016
|
-
if (!controller) {
|
|
4017
|
-
throw new Error("page controller no register: " + route.path);
|
|
4018
|
-
}
|
|
4019
|
-
controller.closeByRoute(route);
|
|
4020
|
-
}
|
|
4021
|
-
/**
|
|
4022
|
-
* 如果页面存在,则刷新
|
|
4023
|
-
* @param route
|
|
4024
|
-
*/
|
|
4025
|
-
refresh(route) {
|
|
4026
|
-
let page = this.getByRoute(route);
|
|
4027
|
-
if (page) {
|
|
4028
|
-
page.controller.refresh();
|
|
4029
|
-
}
|
|
4030
|
-
}
|
|
4031
|
-
/**
|
|
4032
|
-
* 历史记录
|
|
4033
|
-
*/
|
|
4034
|
-
getHistory() {
|
|
4035
|
-
return this._history;
|
|
4036
|
-
}
|
|
4037
|
-
back() {
|
|
4038
|
-
this.open(this._history.pop());
|
|
4039
|
-
}
|
|
4040
|
-
getByRoute(route) {
|
|
4041
|
-
return this._indexRoute[route.path];
|
|
4042
|
-
}
|
|
4043
|
-
listByTags(tags) {
|
|
4044
|
-
let list = new PageList();
|
|
4045
|
-
this.forEach((index, item) => {
|
|
4046
|
-
if (item.controller.hasTags(tags)) {
|
|
4047
|
-
list.push(item);
|
|
4048
|
-
}
|
|
4049
|
-
});
|
|
4050
|
-
return list;
|
|
4051
|
-
}
|
|
4052
|
-
getLayerMain() {
|
|
4053
|
-
return this._indexLayer["main"];
|
|
4054
|
-
}
|
|
4055
|
-
/**
|
|
4056
|
-
* @param name
|
|
4057
|
-
*/
|
|
4058
|
-
getLayer(name) {
|
|
4059
|
-
return this.getOrNewLayer(name);
|
|
4060
|
-
}
|
|
4061
|
-
getOrNewLayer(name) {
|
|
4062
|
-
let layer = this._indexLayer[name];
|
|
4063
|
-
if (!layer) {
|
|
4064
|
-
layer = new PageLayer(name);
|
|
4065
|
-
this._indexLayer[name] = layer;
|
|
4066
|
-
}
|
|
4067
|
-
return layer;
|
|
4068
|
-
}
|
|
4069
|
-
getController(name) {
|
|
4070
|
-
return this._ctrlDict.get(name);
|
|
4071
|
-
}
|
|
4072
|
-
registerController(ctrl) {
|
|
4073
|
-
this._ctrlDict.set(ctrl.name, ctrl);
|
|
4074
|
-
}
|
|
4075
|
-
get objectDict() {
|
|
4076
|
-
let dict = this._objectDict;
|
|
4077
|
-
if (!dict) {
|
|
4078
|
-
dict = new UIObjectDict();
|
|
4079
|
-
this._objectDict = dict;
|
|
4080
|
-
}
|
|
4081
|
-
return dict;
|
|
4082
|
-
}
|
|
4083
|
-
}
|
|
4084
|
-
const pageRepo = new PageRepo();
|
|
4085
|
-
|
|
4086
4080
|
class Listener {
|
|
4087
4081
|
static create(ident) {
|
|
4088
4082
|
return new Listener(ident);
|
|
@@ -6325,5 +6319,5 @@ class WidgetUtil {
|
|
|
6325
6319
|
}
|
|
6326
6320
|
var widgetutil = new WidgetUtil();
|
|
6327
6321
|
|
|
6328
|
-
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, Page, PageController, PageEvent, PageLayer, PageList, PageRepo, PageState, PathUtil, Pool, RandUtil, Route, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil,
|
|
6322
|
+
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, Page, PageController, PageEvent, PageLayer, PageList, PageRepo, PageState, PathUtil, Pool, RandUtil, Route, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, pagerepo, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uidict, uimgr, uiutil, widgetutil };
|
|
6329
6323
|
//# sourceMappingURL=index.esm.js.map
|