@zhongguo168a/yxeditor-common 0.0.19 → 0.0.20

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 CHANGED
@@ -1019,61 +1019,6 @@ declare class UIObjectDict extends Dictionary<string, any | List> {
1019
1019
  }
1020
1020
  declare var uidict: UIObjectDict;
1021
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
1022
  declare class PageController extends Controller {
1078
1023
  constructor(routeName: string, config?: {
1079
1024
  layer?: string;
@@ -1106,7 +1051,6 @@ declare class PageController extends Controller {
1106
1051
  protected _lastPage: Page;
1107
1052
  protected _tags: {};
1108
1053
  protected _layer: string;
1109
- protected _pagerepo: PageRepo;
1110
1054
  }
1111
1055
 
1112
1056
  declare enum PageState {
@@ -1164,6 +1108,61 @@ declare class Page extends EventManager {
1164
1108
  protected _route: Route;
1165
1109
  }
1166
1110
 
1111
+ /**
1112
+ * 视图管理器
1113
+ * 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
1114
+ */
1115
+ declare class PageLayer {
1116
+ name: string;
1117
+ constructor(name: string);
1118
+ close(): void;
1119
+ /**
1120
+ * 当前的页面
1121
+ */
1122
+ currentPage: Page;
1123
+ }
1124
+
1125
+ declare class PageList extends List<Page> {
1126
+ }
1127
+ declare class PageRepo extends PageList {
1128
+ constructor();
1129
+ openByString(route: string): Page;
1130
+ /**
1131
+ * 打开页面
1132
+ * 一个路由代表一个页面
1133
+ * @param route
1134
+ */
1135
+ open(route: Route): Page;
1136
+ close(route: Route): void;
1137
+ /**
1138
+ * 如果页面存在,则刷新
1139
+ * @param route
1140
+ */
1141
+ refresh(route: Route): void;
1142
+ /**
1143
+ * 历史记录
1144
+ */
1145
+ getHistory(): Route[];
1146
+ back(): void;
1147
+ getByRoute(route: Route): Page;
1148
+ listByTags(tags: string[]): PageList;
1149
+ getLayerMain(): PageLayer;
1150
+ /**
1151
+ * @param name
1152
+ */
1153
+ getLayer(name: string): PageLayer;
1154
+ protected getOrNewLayer(name: string): PageLayer;
1155
+ getController(name: string): PageController;
1156
+ registerController(ctrl: PageController): void;
1157
+ get objectDict(): UIObjectDict;
1158
+ protected _objectDict: UIObjectDict;
1159
+ protected _indexLayer: {};
1160
+ protected _indexRoute: {};
1161
+ protected _history: Route[];
1162
+ protected _ctrlDict: ControllerDict;
1163
+ }
1164
+ declare const pagerepo: PageRepo;
1165
+
1167
1166
  /**
1168
1167
  * 事件字符串分隔符
1169
1168
  */
@@ -2014,5 +2013,5 @@ declare class WidgetUtil {
2014
2013
  }
2015
2014
  declare var widgetutil: WidgetUtil;
2016
2015
 
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, pageRepo, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uidict, uimgr, uiutil, widgetutil };
2016
+ 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
2017
  export type { CreatorFunction, DisposeFunction, IController, IError, IEventManager, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
package/dist/index.esm.js CHANGED
@@ -3766,6 +3766,124 @@ class Route {
3766
3766
  // 打开界面缓存的route对象
3767
3767
  Route.data = {};
3768
3768
 
3769
+ /**
3770
+ * 视图管理器
3771
+ * 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
3772
+ */
3773
+ class PageLayer {
3774
+ constructor(name) {
3775
+ this.name = name;
3776
+ }
3777
+ close() {
3778
+ if (this.currentPage) {
3779
+ this.currentPage.controller.closeByRoute();
3780
+ }
3781
+ }
3782
+ }
3783
+
3784
+ class PageList extends List {
3785
+ }
3786
+ class PageRepo extends PageList {
3787
+ constructor() {
3788
+ super();
3789
+ this._indexLayer = {};
3790
+ this._indexRoute = {};
3791
+ this._history = [];
3792
+ this._ctrlDict = new ControllerDict();
3793
+ this.onSet(this, (item) => {
3794
+ this._indexRoute[item.route.path] = item;
3795
+ });
3796
+ this.onDelete(this, (item) => {
3797
+ delete this._indexRoute[item.route.path];
3798
+ });
3799
+ }
3800
+ openByString(route) {
3801
+ return this.open(new Route(route));
3802
+ }
3803
+ /**
3804
+ * 打开页面
3805
+ * 一个路由代表一个页面
3806
+ * @param route
3807
+ */
3808
+ open(route) {
3809
+ let controller = this.getController(route.path);
3810
+ if (!controller) {
3811
+ throw new Error("page controller no register: " + route.path);
3812
+ }
3813
+ return controller.openByRoute(route);
3814
+ }
3815
+ close(route) {
3816
+ let controller = this.getController(route.path);
3817
+ if (!controller) {
3818
+ throw new Error("page controller no register: " + route.path);
3819
+ }
3820
+ controller.closeByRoute(route);
3821
+ }
3822
+ /**
3823
+ * 如果页面存在,则刷新
3824
+ * @param route
3825
+ */
3826
+ refresh(route) {
3827
+ let page = this.getByRoute(route);
3828
+ if (page) {
3829
+ page.controller.refresh();
3830
+ }
3831
+ }
3832
+ /**
3833
+ * 历史记录
3834
+ */
3835
+ getHistory() {
3836
+ return this._history;
3837
+ }
3838
+ back() {
3839
+ this.open(this._history.pop());
3840
+ }
3841
+ getByRoute(route) {
3842
+ return this._indexRoute[route.path];
3843
+ }
3844
+ listByTags(tags) {
3845
+ let list = new PageList();
3846
+ this.forEach((index, item) => {
3847
+ if (item.controller.hasTags(tags)) {
3848
+ list.push(item);
3849
+ }
3850
+ });
3851
+ return list;
3852
+ }
3853
+ getLayerMain() {
3854
+ return this._indexLayer["main"];
3855
+ }
3856
+ /**
3857
+ * @param name
3858
+ */
3859
+ getLayer(name) {
3860
+ return this.getOrNewLayer(name);
3861
+ }
3862
+ getOrNewLayer(name) {
3863
+ let layer = this._indexLayer[name];
3864
+ if (!layer) {
3865
+ layer = new PageLayer(name);
3866
+ this._indexLayer[name] = layer;
3867
+ }
3868
+ return layer;
3869
+ }
3870
+ getController(name) {
3871
+ return this._ctrlDict.get(name);
3872
+ }
3873
+ registerController(ctrl) {
3874
+ this._ctrlDict.set(ctrl.name, ctrl);
3875
+ }
3876
+ get objectDict() {
3877
+ let dict = this._objectDict;
3878
+ if (!dict) {
3879
+ dict = new UIObjectDict();
3880
+ this._objectDict = dict;
3881
+ }
3882
+ return dict;
3883
+ }
3884
+ }
3885
+ const pagerepo = new PageRepo();
3886
+
3769
3887
  class PageController extends Controller {
3770
3888
  constructor(routeName, config) {
3771
3889
  super(routeName);
@@ -3802,7 +3920,6 @@ class PageController extends Controller {
3802
3920
  let newpage;
3803
3921
  let oldpage;
3804
3922
  if (this._layer) {
3805
- let pagerepo = this._pagerepo;
3806
3923
  let layer = pagerepo.getLayer(this._layer);
3807
3924
  oldpage = layer.currentPage;
3808
3925
  if (oldpage) {
@@ -3840,7 +3957,6 @@ class PageController extends Controller {
3840
3957
  page.dispatch(PageEvent.Opening);
3841
3958
  //
3842
3959
  try {
3843
- let pagerepo = this._pagerepo;
3844
3960
  pagerepo.push(page);
3845
3961
  this.onOpening(page);
3846
3962
  // @ts-ignore
@@ -3869,7 +3985,6 @@ class PageController extends Controller {
3869
3985
  page.dispatch(PageEvent.Opened);
3870
3986
  }
3871
3987
  closeByRoute(route) {
3872
- let pagerepo = this._pagerepo;
3873
3988
  let lastpage;
3874
3989
  if (this._layer) {
3875
3990
  let layer = pagerepo.getLayer(this._layer);
@@ -3916,7 +4031,6 @@ class PageController extends Controller {
3916
4031
  if (!page) {
3917
4032
  return;
3918
4033
  }
3919
- let pagerepo = this._pagerepo;
3920
4034
  pagerepo.remove(page);
3921
4035
  this._lastPage = page;
3922
4036
  // @ts-ignore
@@ -3965,124 +4079,6 @@ class PageController extends Controller {
3965
4079
  }
3966
4080
  }
3967
4081
 
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
4082
  class Listener {
4087
4083
  static create(ident) {
4088
4084
  return new Listener(ident);
@@ -6325,5 +6321,5 @@ class WidgetUtil {
6325
6321
  }
6326
6322
  var widgetutil = new WidgetUtil();
6327
6323
 
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, pageRepo, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uidict, uimgr, uiutil, widgetutil };
6324
+ 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
6325
  //# sourceMappingURL=index.esm.js.map