@zhongguo168a/yxeditor-common 0.0.43 → 0.0.45
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 +3 -11
- package/dist/index.esm.js +115 -204
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1072,24 +1072,16 @@ declare class RouteView extends EventDispatcher {
|
|
|
1072
1072
|
protected _route: Route;
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
|
-
declare function OpenPageHandler(route: Route): Promise<void>;
|
|
1076
|
-
declare function OpenDialogHandler(route?: Route): Promise<void>;
|
|
1077
|
-
declare function CloseDialogHandler(route?: Route): RouteView;
|
|
1078
|
-
/**
|
|
1079
|
-
* @param route
|
|
1080
|
-
* @returns
|
|
1081
|
-
*/
|
|
1082
|
-
declare function ClosePageHandler(route?: Route): Promise<RouteView>;
|
|
1083
1075
|
declare class RouteController extends Controller {
|
|
1084
1076
|
constructor(routePath: string);
|
|
1085
|
-
open():
|
|
1077
|
+
open(...args: any[]): RouteView;
|
|
1086
1078
|
/**
|
|
1087
1079
|
* 当视图需要通过路由打开时,需要实现此方法
|
|
1088
1080
|
* @param route
|
|
1089
1081
|
*/
|
|
1090
1082
|
openByRoute(route?: Route): RouteView;
|
|
1091
1083
|
protected refreshView(view: RouteView): void;
|
|
1092
|
-
close():
|
|
1084
|
+
close(...args: any[]): RouteView;
|
|
1093
1085
|
/**
|
|
1094
1086
|
* 当视图需要通过路由关闭时,需要实现此方法
|
|
1095
1087
|
* @param route
|
|
@@ -2029,5 +2021,5 @@ declare class WidgetUtil {
|
|
|
2029
2021
|
}
|
|
2030
2022
|
declare var widgetutil: WidgetUtil;
|
|
2031
2023
|
|
|
2032
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil,
|
|
2024
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, 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, ViewRepo, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, viewrepo, widgetutil };
|
|
2033
2025
|
export type { CreatorFunction, DisposeFunction, IController, IError, IEventDispatcher, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
|
package/dist/index.esm.js
CHANGED
|
@@ -3475,38 +3475,6 @@ class Factory {
|
|
|
3475
3475
|
}
|
|
3476
3476
|
}
|
|
3477
3477
|
|
|
3478
|
-
/******************************************************************************
|
|
3479
|
-
Copyright (c) Microsoft Corporation.
|
|
3480
|
-
|
|
3481
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
3482
|
-
purpose with or without fee is hereby granted.
|
|
3483
|
-
|
|
3484
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3485
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3486
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3487
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3488
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3489
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3490
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
3491
|
-
***************************************************************************** */
|
|
3492
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
3496
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3497
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3498
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3499
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3500
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3501
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3502
|
-
});
|
|
3503
|
-
}
|
|
3504
|
-
|
|
3505
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3506
|
-
var e = new Error(message);
|
|
3507
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3508
|
-
};
|
|
3509
|
-
|
|
3510
3478
|
/**
|
|
3511
3479
|
* 视图的路由值, 保存视图的信息
|
|
3512
3480
|
* 规则: path/search
|
|
@@ -3636,181 +3604,14 @@ Route.data = {};
|
|
|
3636
3604
|
class RouteList extends List {
|
|
3637
3605
|
}
|
|
3638
3606
|
|
|
3639
|
-
class ViewList extends List {
|
|
3640
|
-
}
|
|
3641
|
-
/**
|
|
3642
|
-
* 路由唯一编号->视图
|
|
3643
|
-
*/
|
|
3644
|
-
class ViewDict extends Dictionary {
|
|
3645
|
-
}
|
|
3646
|
-
class ViewRepo extends ViewDict {
|
|
3647
|
-
constructor() {
|
|
3648
|
-
super();
|
|
3649
|
-
this._indexLayer = {};
|
|
3650
|
-
this._indexRoute = {};
|
|
3651
|
-
}
|
|
3652
|
-
openByString(route) {
|
|
3653
|
-
return this.open(new Route(route));
|
|
3654
|
-
}
|
|
3655
|
-
/**
|
|
3656
|
-
* 打开页面
|
|
3657
|
-
* 一个路由代表一个页面
|
|
3658
|
-
* @param route
|
|
3659
|
-
*/
|
|
3660
|
-
open(route) {
|
|
3661
|
-
let controller = this.getController(route.path);
|
|
3662
|
-
if (!controller) {
|
|
3663
|
-
throw new Error("view controller no register: " + route.path);
|
|
3664
|
-
}
|
|
3665
|
-
return controller.openByRoute(route);
|
|
3666
|
-
}
|
|
3667
|
-
close(route) {
|
|
3668
|
-
let controller = this.getController(route.path);
|
|
3669
|
-
if (!controller) {
|
|
3670
|
-
throw new Error("view controller no register: " + route.path);
|
|
3671
|
-
}
|
|
3672
|
-
controller.closeByRoute(route);
|
|
3673
|
-
}
|
|
3674
|
-
/**
|
|
3675
|
-
* 关闭相斥的视图对象
|
|
3676
|
-
* 1. 关闭同一层的所有视图对象
|
|
3677
|
-
* 2. 关闭符合相斥规则的视图对象
|
|
3678
|
-
* @param view
|
|
3679
|
-
* @param validFunc 符合条件的视图对象会被关闭
|
|
3680
|
-
* @returns 被关闭的视图
|
|
3681
|
-
*/
|
|
3682
|
-
closeExclusion(validFunc = undefined) {
|
|
3683
|
-
if (!validFunc) {
|
|
3684
|
-
return;
|
|
3685
|
-
}
|
|
3686
|
-
let closedList = new ViewList();
|
|
3687
|
-
this.forEach((key, item, iterator) => {
|
|
3688
|
-
if (validFunc(item)) {
|
|
3689
|
-
closedList.push(item);
|
|
3690
|
-
}
|
|
3691
|
-
});
|
|
3692
|
-
closedList.forEach((index, item) => {
|
|
3693
|
-
item.controller;
|
|
3694
|
-
item.close();
|
|
3695
|
-
});
|
|
3696
|
-
return closedList;
|
|
3697
|
-
}
|
|
3698
|
-
/**
|
|
3699
|
-
* 如果页面存在,则刷新
|
|
3700
|
-
* @param route
|
|
3701
|
-
*/
|
|
3702
|
-
refresh(route) {
|
|
3703
|
-
let view = this.getByRoute(route);
|
|
3704
|
-
if (view) {
|
|
3705
|
-
view.controller.refresh();
|
|
3706
|
-
}
|
|
3707
|
-
}
|
|
3708
|
-
getByRoute(route) {
|
|
3709
|
-
return this.get(route.key);
|
|
3710
|
-
}
|
|
3711
|
-
listByRoutePath(path) {
|
|
3712
|
-
let list = new ViewList();
|
|
3713
|
-
this.forEach((index, item) => {
|
|
3714
|
-
if (item.controller.route.path == path) {
|
|
3715
|
-
list.push(item);
|
|
3716
|
-
}
|
|
3717
|
-
});
|
|
3718
|
-
return list;
|
|
3719
|
-
}
|
|
3720
|
-
listByTags(tags) {
|
|
3721
|
-
let list = new ViewList();
|
|
3722
|
-
this.forEach((index, item) => {
|
|
3723
|
-
if (item.controller.hasTags(tags)) {
|
|
3724
|
-
list.push(item);
|
|
3725
|
-
}
|
|
3726
|
-
});
|
|
3727
|
-
return list;
|
|
3728
|
-
}
|
|
3729
|
-
getController(name) {
|
|
3730
|
-
return ctrlrepo.get(name);
|
|
3731
|
-
}
|
|
3732
|
-
}
|
|
3733
|
-
const viewrepo = new ViewRepo();
|
|
3734
|
-
|
|
3735
|
-
class ViewHistory extends RouteList {
|
|
3736
|
-
back() {
|
|
3737
|
-
if (viewhistorys.length == 0) {
|
|
3738
|
-
return;
|
|
3739
|
-
}
|
|
3740
|
-
viewrepo.close(viewhistorys.shift());
|
|
3741
|
-
if (viewhistorys.length == 0) {
|
|
3742
|
-
return;
|
|
3743
|
-
}
|
|
3744
|
-
viewrepo.open(viewhistorys.last());
|
|
3745
|
-
}
|
|
3746
|
-
}
|
|
3747
|
-
const viewhistorys = new ViewHistory();
|
|
3748
|
-
|
|
3749
|
-
function OpenPageHandler(route) {
|
|
3750
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3751
|
-
let view = viewrepo.getByRoute(route);
|
|
3752
|
-
if (view) { //
|
|
3753
|
-
this.refreshView(view);
|
|
3754
|
-
return;
|
|
3755
|
-
}
|
|
3756
|
-
// 关闭同一层的所有视图
|
|
3757
|
-
this.closeExclusion((existed) => {
|
|
3758
|
-
return existed.layer == this._layer;
|
|
3759
|
-
});
|
|
3760
|
-
if (this.enableHistory) {
|
|
3761
|
-
viewhistorys.push(route);
|
|
3762
|
-
}
|
|
3763
|
-
});
|
|
3764
|
-
}
|
|
3765
|
-
function OpenDialogHandler(route) {
|
|
3766
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3767
|
-
if (!route) {
|
|
3768
|
-
route = this.route;
|
|
3769
|
-
}
|
|
3770
|
-
let oldView = viewrepo.getByRoute(route);
|
|
3771
|
-
if (oldView) {
|
|
3772
|
-
oldView.close();
|
|
3773
|
-
}
|
|
3774
|
-
});
|
|
3775
|
-
}
|
|
3776
|
-
function CloseDialogHandler(route) {
|
|
3777
|
-
if (!route) {
|
|
3778
|
-
route = this.route;
|
|
3779
|
-
}
|
|
3780
|
-
let view = viewrepo.getByRoute(route);
|
|
3781
|
-
if (view) {
|
|
3782
|
-
view.close();
|
|
3783
|
-
}
|
|
3784
|
-
return view;
|
|
3785
|
-
}
|
|
3786
|
-
/**
|
|
3787
|
-
* @param route
|
|
3788
|
-
* @returns
|
|
3789
|
-
*/
|
|
3790
|
-
function ClosePageHandler(route) {
|
|
3791
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3792
|
-
let lastview;
|
|
3793
|
-
if (lastview.layer) {
|
|
3794
|
-
if (lastview.enableHistory) {
|
|
3795
|
-
// 清空历史记录
|
|
3796
|
-
viewhistorys.clear();
|
|
3797
|
-
}
|
|
3798
|
-
}
|
|
3799
|
-
else {
|
|
3800
|
-
lastview = viewrepo.getByRoute(route);
|
|
3801
|
-
}
|
|
3802
|
-
lastview.close();
|
|
3803
|
-
return lastview;
|
|
3804
|
-
});
|
|
3805
|
-
}
|
|
3806
3607
|
class RouteController extends Controller {
|
|
3807
3608
|
constructor(routePath) {
|
|
3808
3609
|
super(routePath);
|
|
3809
3610
|
this._tags = {};
|
|
3810
3611
|
this._route = new Route(routePath);
|
|
3811
3612
|
}
|
|
3812
|
-
open() {
|
|
3813
|
-
this.openByRoute();
|
|
3613
|
+
open(...args) {
|
|
3614
|
+
return this.openByRoute();
|
|
3814
3615
|
}
|
|
3815
3616
|
/**
|
|
3816
3617
|
* 当视图需要通过路由打开时,需要实现此方法
|
|
@@ -3821,8 +3622,8 @@ class RouteController extends Controller {
|
|
|
3821
3622
|
}
|
|
3822
3623
|
refreshView(view) {
|
|
3823
3624
|
}
|
|
3824
|
-
close() {
|
|
3825
|
-
this.closeByRoute();
|
|
3625
|
+
close(...args) {
|
|
3626
|
+
return this.closeByRoute();
|
|
3826
3627
|
}
|
|
3827
3628
|
/**
|
|
3828
3629
|
* 当视图需要通过路由关闭时,需要实现此方法
|
|
@@ -3916,6 +3717,102 @@ class UIObjectRepo extends Dictionary {
|
|
|
3916
3717
|
*/
|
|
3917
3718
|
var uirepo = new UIObjectRepo();
|
|
3918
3719
|
|
|
3720
|
+
class ViewList extends List {
|
|
3721
|
+
}
|
|
3722
|
+
/**
|
|
3723
|
+
* 路由唯一编号->视图
|
|
3724
|
+
*/
|
|
3725
|
+
class ViewDict extends Dictionary {
|
|
3726
|
+
}
|
|
3727
|
+
class ViewRepo extends ViewDict {
|
|
3728
|
+
constructor() {
|
|
3729
|
+
super();
|
|
3730
|
+
this._indexLayer = {};
|
|
3731
|
+
this._indexRoute = {};
|
|
3732
|
+
}
|
|
3733
|
+
openByString(route) {
|
|
3734
|
+
return this.open(new Route(route));
|
|
3735
|
+
}
|
|
3736
|
+
/**
|
|
3737
|
+
* 打开页面
|
|
3738
|
+
* 一个路由代表一个页面
|
|
3739
|
+
* @param route
|
|
3740
|
+
*/
|
|
3741
|
+
open(route) {
|
|
3742
|
+
let controller = this.getController(route.path);
|
|
3743
|
+
if (!controller) {
|
|
3744
|
+
throw new Error("view controller no register: " + route.path);
|
|
3745
|
+
}
|
|
3746
|
+
return controller.openByRoute(route);
|
|
3747
|
+
}
|
|
3748
|
+
close(route) {
|
|
3749
|
+
let controller = this.getController(route.path);
|
|
3750
|
+
if (!controller) {
|
|
3751
|
+
throw new Error("view controller no register: " + route.path);
|
|
3752
|
+
}
|
|
3753
|
+
controller.closeByRoute(route);
|
|
3754
|
+
}
|
|
3755
|
+
/**
|
|
3756
|
+
* 关闭相斥的视图对象
|
|
3757
|
+
* 1. 关闭同一层的所有视图对象
|
|
3758
|
+
* 2. 关闭符合相斥规则的视图对象
|
|
3759
|
+
* @param view
|
|
3760
|
+
* @param validFunc 符合条件的视图对象会被关闭
|
|
3761
|
+
* @returns 被关闭的视图
|
|
3762
|
+
*/
|
|
3763
|
+
closeExclusion(validFunc = undefined) {
|
|
3764
|
+
if (!validFunc) {
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3767
|
+
let closedList = new ViewList();
|
|
3768
|
+
this.forEach((key, item, iterator) => {
|
|
3769
|
+
if (validFunc(item)) {
|
|
3770
|
+
closedList.push(item);
|
|
3771
|
+
}
|
|
3772
|
+
});
|
|
3773
|
+
closedList.forEach((index, item) => {
|
|
3774
|
+
item.controller;
|
|
3775
|
+
item.close();
|
|
3776
|
+
});
|
|
3777
|
+
return closedList;
|
|
3778
|
+
}
|
|
3779
|
+
/**
|
|
3780
|
+
* 如果页面存在,则刷新
|
|
3781
|
+
* @param route
|
|
3782
|
+
*/
|
|
3783
|
+
refresh(route) {
|
|
3784
|
+
let view = this.getByRoute(route);
|
|
3785
|
+
if (view) {
|
|
3786
|
+
view.controller.refresh();
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
getByRoute(route) {
|
|
3790
|
+
return this.get(route.key);
|
|
3791
|
+
}
|
|
3792
|
+
listByRoutePath(path) {
|
|
3793
|
+
let list = new ViewList();
|
|
3794
|
+
this.forEach((index, item) => {
|
|
3795
|
+
if (item.controller.route.path == path) {
|
|
3796
|
+
list.push(item);
|
|
3797
|
+
}
|
|
3798
|
+
});
|
|
3799
|
+
return list;
|
|
3800
|
+
}
|
|
3801
|
+
listByTags(tags) {
|
|
3802
|
+
let list = new ViewList();
|
|
3803
|
+
this.forEach((index, item) => {
|
|
3804
|
+
if (item.controller.hasTags(tags)) {
|
|
3805
|
+
list.push(item);
|
|
3806
|
+
}
|
|
3807
|
+
});
|
|
3808
|
+
return list;
|
|
3809
|
+
}
|
|
3810
|
+
getController(name) {
|
|
3811
|
+
return ctrlrepo.get(name);
|
|
3812
|
+
}
|
|
3813
|
+
}
|
|
3814
|
+
const viewrepo = new ViewRepo();
|
|
3815
|
+
|
|
3919
3816
|
var ViewState;
|
|
3920
3817
|
(function (ViewState) {
|
|
3921
3818
|
/**
|
|
@@ -4110,6 +4007,20 @@ class RouteView extends EventDispatcher {
|
|
|
4110
4007
|
}
|
|
4111
4008
|
}
|
|
4112
4009
|
|
|
4010
|
+
class ViewHistory extends RouteList {
|
|
4011
|
+
back() {
|
|
4012
|
+
if (viewhistorys.length == 0) {
|
|
4013
|
+
return;
|
|
4014
|
+
}
|
|
4015
|
+
viewrepo.close(viewhistorys.shift());
|
|
4016
|
+
if (viewhistorys.length == 0) {
|
|
4017
|
+
return;
|
|
4018
|
+
}
|
|
4019
|
+
viewrepo.open(viewhistorys.last());
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
const viewhistorys = new ViewHistory();
|
|
4023
|
+
|
|
4113
4024
|
class Listener {
|
|
4114
4025
|
static create(ident) {
|
|
4115
4026
|
return new Listener(ident);
|
|
@@ -6383,5 +6294,5 @@ class WidgetUtil {
|
|
|
6383
6294
|
}
|
|
6384
6295
|
var widgetutil = new WidgetUtil();
|
|
6385
6296
|
|
|
6386
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil,
|
|
6297
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, 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, ViewRepo, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, viewrepo, widgetutil };
|
|
6387
6298
|
//# sourceMappingURL=index.esm.js.map
|