@zhongguo168a/yxeditor-common 0.0.86 → 0.0.87
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 +86 -24
- package/dist/index.esm.js +151 -158
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -778,10 +778,10 @@ declare class Dictionary<K = string, V = any> {
|
|
|
778
778
|
groupByKey(keyCreator: (key: K, val: V) => string, ITEM_CLASS?: any): {
|
|
779
779
|
[key: string]: any;
|
|
780
780
|
};
|
|
781
|
-
countByKeyList(keyCreator: (key:
|
|
781
|
+
countByKeyList(keyCreator: (key: K, val: V) => string[]): {
|
|
782
782
|
[key: string]: number;
|
|
783
783
|
};
|
|
784
|
-
countByKey(keyCreator: (key:
|
|
784
|
+
countByKey(keyCreator: (key: K, val: V) => string): {
|
|
785
785
|
[key: string]: number;
|
|
786
786
|
};
|
|
787
787
|
protected size: number;
|
|
@@ -1283,14 +1283,94 @@ declare class ViewHistory extends RouteList {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
declare const viewhistorys: ViewHistory;
|
|
1285
1285
|
|
|
1286
|
+
declare class ViewModel extends EventDispatcher {
|
|
1287
|
+
/**
|
|
1288
|
+
* 视图模型的名称
|
|
1289
|
+
* @param name
|
|
1290
|
+
*/
|
|
1291
|
+
constructor(name: string);
|
|
1292
|
+
/**
|
|
1293
|
+
* 视图模型的编号
|
|
1294
|
+
* 默认为视图模型的类型,表示该模型在应用中唯一
|
|
1295
|
+
* 如果应用中,存在多个
|
|
1296
|
+
* @returns
|
|
1297
|
+
*/
|
|
1298
|
+
getIdent(): string;
|
|
1299
|
+
/**
|
|
1300
|
+
*
|
|
1301
|
+
* @param asset 通过此方法创建的节点,自动添加 RouteComponent 到节点上
|
|
1302
|
+
*/
|
|
1303
|
+
createNode(asset: Prefab): void;
|
|
1304
|
+
/**
|
|
1305
|
+
* 使用route的视图模型,可以实现通过路由,操作视图
|
|
1306
|
+
* @param route
|
|
1307
|
+
* @param controller
|
|
1308
|
+
*/
|
|
1309
|
+
useRoute(route: Route, controller: RouteController): void;
|
|
1310
|
+
open(): void;
|
|
1311
|
+
close(): void;
|
|
1312
|
+
refresh(): void;
|
|
1313
|
+
stop(reason?: LinkError): void;
|
|
1314
|
+
/**
|
|
1315
|
+
* 等待发送的结果
|
|
1316
|
+
* 如果返回 null,表示主动取消 [cancel]
|
|
1317
|
+
*/
|
|
1318
|
+
wait(): Promise<this>;
|
|
1319
|
+
toString(): string;
|
|
1320
|
+
/**
|
|
1321
|
+
* 等待打开完成指令
|
|
1322
|
+
*/
|
|
1323
|
+
waitOpenComplete(): void;
|
|
1324
|
+
openComplete(): void;
|
|
1325
|
+
waitCloseComplete(): void;
|
|
1326
|
+
closeComplete(): void;
|
|
1327
|
+
protected _waitOpenComplete: boolean;
|
|
1328
|
+
protected _waitCloseComplete: boolean;
|
|
1329
|
+
get reason(): LinkError;
|
|
1330
|
+
node: Node;
|
|
1331
|
+
datas: MapObject;
|
|
1332
|
+
tags: MapObject;
|
|
1333
|
+
enableHistory: boolean;
|
|
1334
|
+
layer: string;
|
|
1335
|
+
state: ViewState;
|
|
1336
|
+
protected _controller: RouteController;
|
|
1337
|
+
protected _route: Route;
|
|
1338
|
+
protected _reason: LinkError;
|
|
1339
|
+
protected onOpen(): void;
|
|
1340
|
+
protected onOpened(): void;
|
|
1341
|
+
protected onClose(): void;
|
|
1342
|
+
protected onClosed(): void;
|
|
1343
|
+
protected onRefresh(): void;
|
|
1344
|
+
/**
|
|
1345
|
+
* 默认执行 close();
|
|
1346
|
+
*/
|
|
1347
|
+
protected onStop(): void;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1286
1350
|
declare class ViewList extends List<RouteView> {
|
|
1287
1351
|
}
|
|
1288
1352
|
/**
|
|
1289
1353
|
* 路由唯一编号->视图
|
|
1290
1354
|
*/
|
|
1291
|
-
declare class ViewDict extends Dictionary<string,
|
|
1355
|
+
declare class ViewDict extends Dictionary<string, any> {
|
|
1356
|
+
/**
|
|
1357
|
+
* 关闭相斥的视图对象
|
|
1358
|
+
* 1. 关闭同一层的所有视图对象
|
|
1359
|
+
* 2. 关闭符合相斥规则的视图对象
|
|
1360
|
+
* @param view
|
|
1361
|
+
* @param validFunc 符合条件的视图对象会被关闭
|
|
1362
|
+
* @returns 被关闭的视图
|
|
1363
|
+
*/
|
|
1364
|
+
closeExclusion(validFunc?: (existed: RouteView) => boolean): ViewList;
|
|
1365
|
+
listByRoutePath(path: string): ViewList;
|
|
1366
|
+
listByTags(tags: string[]): ViewList;
|
|
1367
|
+
/**
|
|
1368
|
+
* 往上追踪,返回第一个包含 RouteComponent 的节点, 返回节点中的 RouteView
|
|
1369
|
+
* @param node
|
|
1370
|
+
*/
|
|
1371
|
+
tailNode(node: Node): ViewModel;
|
|
1292
1372
|
}
|
|
1293
|
-
declare class
|
|
1373
|
+
declare class RouteViewDict extends ViewDict {
|
|
1294
1374
|
constructor();
|
|
1295
1375
|
openByString(route: string): RouteView;
|
|
1296
1376
|
/**
|
|
@@ -1301,32 +1381,14 @@ declare class ViewRepo extends ViewDict {
|
|
|
1301
1381
|
open(route: Route): RouteView;
|
|
1302
1382
|
close(route: Route): void;
|
|
1303
1383
|
/**
|
|
1304
|
-
* 关闭相斥的视图对象
|
|
1305
|
-
* 1. 关闭同一层的所有视图对象
|
|
1306
|
-
* 2. 关闭符合相斥规则的视图对象
|
|
1307
|
-
* @param view
|
|
1308
|
-
* @param validFunc 符合条件的视图对象会被关闭
|
|
1309
|
-
* @returns 被关闭的视图
|
|
1310
|
-
*/
|
|
1311
|
-
closeExclusion(validFunc?: (existed: RouteView) => boolean): ViewList;
|
|
1312
|
-
/**
|
|
1313
1384
|
* 如果页面存在,则刷新
|
|
1314
1385
|
* @param route
|
|
1315
1386
|
*/
|
|
1316
1387
|
refresh(route: Route): void;
|
|
1317
1388
|
getByRoute(route: Route): RouteView;
|
|
1318
|
-
listByRoutePath(path: string): ViewList;
|
|
1319
|
-
listByTags(tags: string[]): ViewList;
|
|
1320
|
-
/**
|
|
1321
|
-
* 往上追踪,返回第一个包含 RouteComponent 的节点, 返回节点中的 RouteView
|
|
1322
|
-
* @param node
|
|
1323
|
-
*/
|
|
1324
|
-
tailNode(node: Node): RouteView;
|
|
1325
1389
|
protected getController(name: string): RouteController;
|
|
1326
|
-
protected _indexLayer: {};
|
|
1327
|
-
protected _indexRoute: {};
|
|
1328
1390
|
}
|
|
1329
|
-
declare const
|
|
1391
|
+
declare const routeviews: RouteViewDict;
|
|
1330
1392
|
|
|
1331
1393
|
/**
|
|
1332
1394
|
* 事件字符串分隔符
|
|
@@ -2118,5 +2180,5 @@ declare class WidgetUtil {
|
|
|
2118
2180
|
}
|
|
2119
2181
|
declare var widgetutil: WidgetUtil;
|
|
2120
2182
|
|
|
2121
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList,
|
|
2183
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, create等距图集, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, routeviews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
2122
2184
|
export type { CreatorFunction, DisposeFunction, IController, IError, IEventDispatcher, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
|
package/dist/index.esm.js
CHANGED
|
@@ -3823,153 +3823,6 @@ class UIObjectRepo extends Dictionary {
|
|
|
3823
3823
|
*/
|
|
3824
3824
|
var uirepo = new UIObjectRepo();
|
|
3825
3825
|
|
|
3826
|
-
/******************************************************************************
|
|
3827
|
-
Copyright (c) Microsoft Corporation.
|
|
3828
|
-
|
|
3829
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
3830
|
-
purpose with or without fee is hereby granted.
|
|
3831
|
-
|
|
3832
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3833
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3834
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3835
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3836
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3837
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3838
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
3839
|
-
***************************************************************************** */
|
|
3840
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
function __decorate(decorators, target, key, desc) {
|
|
3844
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3845
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3846
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3847
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3848
|
-
}
|
|
3849
|
-
|
|
3850
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3851
|
-
var e = new Error(message);
|
|
3852
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3853
|
-
};
|
|
3854
|
-
|
|
3855
|
-
const { ccclass, property, menu } = _decorator;
|
|
3856
|
-
let RouteComponent = class RouteComponent extends Component {
|
|
3857
|
-
};
|
|
3858
|
-
RouteComponent = __decorate([
|
|
3859
|
-
ccclass('RouteComponent')
|
|
3860
|
-
], RouteComponent);
|
|
3861
|
-
|
|
3862
|
-
class ViewList extends List {
|
|
3863
|
-
}
|
|
3864
|
-
/**
|
|
3865
|
-
* 路由唯一编号->视图
|
|
3866
|
-
*/
|
|
3867
|
-
class ViewDict extends Dictionary {
|
|
3868
|
-
}
|
|
3869
|
-
class ViewRepo extends ViewDict {
|
|
3870
|
-
constructor() {
|
|
3871
|
-
super();
|
|
3872
|
-
this._indexLayer = {};
|
|
3873
|
-
this._indexRoute = {};
|
|
3874
|
-
}
|
|
3875
|
-
openByString(route) {
|
|
3876
|
-
return this.open(new Route(route));
|
|
3877
|
-
}
|
|
3878
|
-
/**
|
|
3879
|
-
* 打开页面
|
|
3880
|
-
* 一个路由代表一个页面
|
|
3881
|
-
* @param route
|
|
3882
|
-
*/
|
|
3883
|
-
open(route) {
|
|
3884
|
-
let controller = this.getController(route.path);
|
|
3885
|
-
if (!controller) {
|
|
3886
|
-
throw new Error("view controller no register: " + route.path);
|
|
3887
|
-
}
|
|
3888
|
-
return controller.openByRoute(route);
|
|
3889
|
-
}
|
|
3890
|
-
close(route) {
|
|
3891
|
-
let controller = this.getController(route.path);
|
|
3892
|
-
if (!controller) {
|
|
3893
|
-
throw new Error("view controller no register: " + route.path);
|
|
3894
|
-
}
|
|
3895
|
-
controller.closeByRoute(route);
|
|
3896
|
-
}
|
|
3897
|
-
/**
|
|
3898
|
-
* 关闭相斥的视图对象
|
|
3899
|
-
* 1. 关闭同一层的所有视图对象
|
|
3900
|
-
* 2. 关闭符合相斥规则的视图对象
|
|
3901
|
-
* @param view
|
|
3902
|
-
* @param validFunc 符合条件的视图对象会被关闭
|
|
3903
|
-
* @returns 被关闭的视图
|
|
3904
|
-
*/
|
|
3905
|
-
closeExclusion(validFunc = undefined) {
|
|
3906
|
-
if (!validFunc) {
|
|
3907
|
-
return;
|
|
3908
|
-
}
|
|
3909
|
-
let closedList = new ViewList();
|
|
3910
|
-
this.forEach((key, item, iterator) => {
|
|
3911
|
-
if (validFunc(item)) {
|
|
3912
|
-
closedList.push(item);
|
|
3913
|
-
}
|
|
3914
|
-
});
|
|
3915
|
-
closedList.forEach((index, item) => {
|
|
3916
|
-
item.controller;
|
|
3917
|
-
item.close();
|
|
3918
|
-
});
|
|
3919
|
-
return closedList;
|
|
3920
|
-
}
|
|
3921
|
-
/**
|
|
3922
|
-
* 如果页面存在,则刷新
|
|
3923
|
-
* @param route
|
|
3924
|
-
*/
|
|
3925
|
-
refresh(route) {
|
|
3926
|
-
let view = this.getByRoute(route);
|
|
3927
|
-
if (view) {
|
|
3928
|
-
view.controller.refresh();
|
|
3929
|
-
}
|
|
3930
|
-
}
|
|
3931
|
-
getByRoute(route) {
|
|
3932
|
-
return this.get(route.key);
|
|
3933
|
-
}
|
|
3934
|
-
listByRoutePath(path) {
|
|
3935
|
-
let list = new ViewList();
|
|
3936
|
-
this.forEach((index, item) => {
|
|
3937
|
-
if (item.controller.route.path == path) {
|
|
3938
|
-
list.push(item);
|
|
3939
|
-
}
|
|
3940
|
-
});
|
|
3941
|
-
return list;
|
|
3942
|
-
}
|
|
3943
|
-
listByTags(tags) {
|
|
3944
|
-
let list = new ViewList();
|
|
3945
|
-
this.forEach((index, item) => {
|
|
3946
|
-
if (item.controller.hasTags(tags)) {
|
|
3947
|
-
list.push(item);
|
|
3948
|
-
}
|
|
3949
|
-
});
|
|
3950
|
-
return list;
|
|
3951
|
-
}
|
|
3952
|
-
/**
|
|
3953
|
-
* 往上追踪,返回第一个包含 RouteComponent 的节点, 返回节点中的 RouteView
|
|
3954
|
-
* @param node
|
|
3955
|
-
*/
|
|
3956
|
-
tailNode(node) {
|
|
3957
|
-
let current = node;
|
|
3958
|
-
while (current != null) {
|
|
3959
|
-
let com = current.getComponent(RouteComponent);
|
|
3960
|
-
if (com) {
|
|
3961
|
-
return com.routeView;
|
|
3962
|
-
}
|
|
3963
|
-
current = current.parent;
|
|
3964
|
-
}
|
|
3965
|
-
return null;
|
|
3966
|
-
}
|
|
3967
|
-
getController(name) {
|
|
3968
|
-
return ctrlrepo.get(name);
|
|
3969
|
-
}
|
|
3970
|
-
}
|
|
3971
|
-
const viewrepo = new ViewRepo();
|
|
3972
|
-
|
|
3973
3826
|
var ViewState;
|
|
3974
3827
|
(function (ViewState) {
|
|
3975
3828
|
/**
|
|
@@ -4021,11 +3874,7 @@ class RouteView extends EventDispatcher {
|
|
|
4021
3874
|
if (this.state != ViewState.Closed) {
|
|
4022
3875
|
return;
|
|
4023
3876
|
}
|
|
4024
|
-
|
|
4025
|
-
if (viewrepo.get(route.key)) {
|
|
4026
|
-
throw `视图已存在: route=${route.key}`;
|
|
4027
|
-
}
|
|
4028
|
-
viewrepo.set(route.key, this);
|
|
3877
|
+
this.route;
|
|
4029
3878
|
this.state = ViewState.Opening;
|
|
4030
3879
|
this.dispatch(ViewEvent.Opening);
|
|
4031
3880
|
//
|
|
@@ -4161,7 +4010,6 @@ class RouteView extends EventDispatcher {
|
|
|
4161
4010
|
if (this.state == ViewState.Closed) {
|
|
4162
4011
|
return;
|
|
4163
4012
|
}
|
|
4164
|
-
viewrepo.delete(this.route.key);
|
|
4165
4013
|
this._waitCloseComplete = false;
|
|
4166
4014
|
this.state = ViewState.Closed;
|
|
4167
4015
|
this.dispatch(ViewEvent.Closed);
|
|
@@ -4176,8 +4024,8 @@ class RouteView extends EventDispatcher {
|
|
|
4176
4024
|
createNode(asset) {
|
|
4177
4025
|
let node = instantiate(asset);
|
|
4178
4026
|
this.node = node;
|
|
4179
|
-
let com = node.addComponent(RouteComponent);
|
|
4180
|
-
com.
|
|
4027
|
+
// let com = node.addComponent(RouteComponent);
|
|
4028
|
+
// com.viewModel = this;
|
|
4181
4029
|
}
|
|
4182
4030
|
get controller() {
|
|
4183
4031
|
return this._controller;
|
|
@@ -4219,16 +4067,161 @@ class RouteView extends EventDispatcher {
|
|
|
4219
4067
|
}
|
|
4220
4068
|
}
|
|
4221
4069
|
|
|
4070
|
+
/******************************************************************************
|
|
4071
|
+
Copyright (c) Microsoft Corporation.
|
|
4072
|
+
|
|
4073
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4074
|
+
purpose with or without fee is hereby granted.
|
|
4075
|
+
|
|
4076
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
4077
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
4078
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
4079
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
4080
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
4081
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4082
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
4083
|
+
***************************************************************************** */
|
|
4084
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
4085
|
+
|
|
4086
|
+
|
|
4087
|
+
function __decorate(decorators, target, key, desc) {
|
|
4088
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4089
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4090
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4091
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4092
|
+
}
|
|
4093
|
+
|
|
4094
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4095
|
+
var e = new Error(message);
|
|
4096
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4097
|
+
};
|
|
4098
|
+
|
|
4099
|
+
const { ccclass, property, menu } = _decorator;
|
|
4100
|
+
let ViewModelComponent = class ViewModelComponent extends Component {
|
|
4101
|
+
};
|
|
4102
|
+
ViewModelComponent = __decorate([
|
|
4103
|
+
ccclass('ViewModelComponent')
|
|
4104
|
+
], ViewModelComponent);
|
|
4105
|
+
|
|
4106
|
+
class ViewList extends List {
|
|
4107
|
+
}
|
|
4108
|
+
/**
|
|
4109
|
+
* 路由唯一编号->视图
|
|
4110
|
+
*/
|
|
4111
|
+
class ViewDict extends Dictionary {
|
|
4112
|
+
/**
|
|
4113
|
+
* 关闭相斥的视图对象
|
|
4114
|
+
* 1. 关闭同一层的所有视图对象
|
|
4115
|
+
* 2. 关闭符合相斥规则的视图对象
|
|
4116
|
+
* @param view
|
|
4117
|
+
* @param validFunc 符合条件的视图对象会被关闭
|
|
4118
|
+
* @returns 被关闭的视图
|
|
4119
|
+
*/
|
|
4120
|
+
closeExclusion(validFunc = undefined) {
|
|
4121
|
+
if (!validFunc) {
|
|
4122
|
+
return;
|
|
4123
|
+
}
|
|
4124
|
+
let closedList = new ViewList();
|
|
4125
|
+
this.forEach((key, item, iterator) => {
|
|
4126
|
+
if (validFunc(item)) {
|
|
4127
|
+
closedList.push(item);
|
|
4128
|
+
}
|
|
4129
|
+
});
|
|
4130
|
+
closedList.forEach((index, item) => {
|
|
4131
|
+
item.controller;
|
|
4132
|
+
item.close();
|
|
4133
|
+
});
|
|
4134
|
+
return closedList;
|
|
4135
|
+
}
|
|
4136
|
+
listByRoutePath(path) {
|
|
4137
|
+
let list = new ViewList();
|
|
4138
|
+
this.forEach((index, item) => {
|
|
4139
|
+
if (item.controller.route.path == path) {
|
|
4140
|
+
list.push(item);
|
|
4141
|
+
}
|
|
4142
|
+
});
|
|
4143
|
+
return list;
|
|
4144
|
+
}
|
|
4145
|
+
listByTags(tags) {
|
|
4146
|
+
let list = new ViewList();
|
|
4147
|
+
this.forEach((index, item) => {
|
|
4148
|
+
if (item.controller.hasTags(tags)) {
|
|
4149
|
+
list.push(item);
|
|
4150
|
+
}
|
|
4151
|
+
});
|
|
4152
|
+
return list;
|
|
4153
|
+
}
|
|
4154
|
+
/**
|
|
4155
|
+
* 往上追踪,返回第一个包含 RouteComponent 的节点, 返回节点中的 RouteView
|
|
4156
|
+
* @param node
|
|
4157
|
+
*/
|
|
4158
|
+
tailNode(node) {
|
|
4159
|
+
let current = node;
|
|
4160
|
+
while (current != null) {
|
|
4161
|
+
let com = current.getComponent(ViewModelComponent);
|
|
4162
|
+
if (com) {
|
|
4163
|
+
return com.viewModel;
|
|
4164
|
+
}
|
|
4165
|
+
current = current.parent;
|
|
4166
|
+
}
|
|
4167
|
+
return null;
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
class RouteViewDict extends ViewDict {
|
|
4171
|
+
constructor() {
|
|
4172
|
+
super();
|
|
4173
|
+
}
|
|
4174
|
+
openByString(route) {
|
|
4175
|
+
return this.open(new Route(route));
|
|
4176
|
+
}
|
|
4177
|
+
/**
|
|
4178
|
+
* 打开页面
|
|
4179
|
+
* 一个路由代表一个页面
|
|
4180
|
+
* @param route
|
|
4181
|
+
*/
|
|
4182
|
+
open(route) {
|
|
4183
|
+
let controller = this.getController(route.path);
|
|
4184
|
+
if (!controller) {
|
|
4185
|
+
throw new Error("view controller no register: " + route.path);
|
|
4186
|
+
}
|
|
4187
|
+
return controller.openByRoute(route);
|
|
4188
|
+
}
|
|
4189
|
+
close(route) {
|
|
4190
|
+
let controller = this.getController(route.path);
|
|
4191
|
+
if (!controller) {
|
|
4192
|
+
throw new Error("view controller no register: " + route.path);
|
|
4193
|
+
}
|
|
4194
|
+
controller.closeByRoute(route);
|
|
4195
|
+
}
|
|
4196
|
+
/**
|
|
4197
|
+
* 如果页面存在,则刷新
|
|
4198
|
+
* @param route
|
|
4199
|
+
*/
|
|
4200
|
+
refresh(route) {
|
|
4201
|
+
let view = this.getByRoute(route);
|
|
4202
|
+
if (view) {
|
|
4203
|
+
view.controller.refresh();
|
|
4204
|
+
}
|
|
4205
|
+
}
|
|
4206
|
+
getByRoute(route) {
|
|
4207
|
+
return this.get(route.key);
|
|
4208
|
+
}
|
|
4209
|
+
getController(name) {
|
|
4210
|
+
return ctrlrepo.get(name);
|
|
4211
|
+
}
|
|
4212
|
+
}
|
|
4213
|
+
const routeviews = new RouteViewDict();
|
|
4214
|
+
|
|
4222
4215
|
class ViewHistory extends RouteList {
|
|
4223
4216
|
back() {
|
|
4224
4217
|
if (viewhistorys.length == 0) {
|
|
4225
4218
|
return;
|
|
4226
4219
|
}
|
|
4227
|
-
|
|
4220
|
+
routeviews.close(viewhistorys.shift());
|
|
4228
4221
|
if (viewhistorys.length == 0) {
|
|
4229
4222
|
return;
|
|
4230
4223
|
}
|
|
4231
|
-
|
|
4224
|
+
routeviews.open(viewhistorys.last());
|
|
4232
4225
|
}
|
|
4233
4226
|
}
|
|
4234
4227
|
const viewhistorys = new ViewHistory();
|
|
@@ -6645,5 +6638,5 @@ class WidgetUtil {
|
|
|
6645
6638
|
}
|
|
6646
6639
|
var widgetutil = new WidgetUtil();
|
|
6647
6640
|
|
|
6648
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList,
|
|
6641
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, create等距图集, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, routeviews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
6649
6642
|
//# sourceMappingURL=index.esm.js.map
|