@zhongguo168a/yxeditor-common 0.0.31 → 0.0.34

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/README.md CHANGED
@@ -27,3 +27,17 @@ A TypeScript project template with Rollup and Vitest.
27
27
  - `npm run test:ui` - Run tests with UI
28
28
  - `npm run test:run` - Run tests once
29
29
  - `npm run coverage` - Run tests with coverage report
30
+
31
+
32
+ ```shell
33
+ npm version patch && npm publish --access public
34
+ ```
35
+
36
+
37
+ ```shell
38
+ npm version patch && npm publish --access public
39
+ ```
40
+
41
+ ```shell
42
+ npm version patch && npm publish --access public
43
+ ```
package/dist/index.d.ts CHANGED
@@ -1028,6 +1028,13 @@ declare enum ViewState {
1028
1028
  */
1029
1029
  Closeing = 3
1030
1030
  }
1031
+ declare enum ViewEvent {
1032
+ Opening = "opening",
1033
+ Opened = "opened",
1034
+ Closeing = "closeing",
1035
+ Closed = "closed",
1036
+ Stop = "stop"
1037
+ }
1031
1038
  declare class View extends EventDispatcher {
1032
1039
  constructor(controller: ViewController, route: Route);
1033
1040
  /**
@@ -1063,6 +1070,36 @@ declare var uidict: UIObjectDict;
1063
1070
 
1064
1071
  declare class ViewList extends List<View> {
1065
1072
  }
1073
+ /**
1074
+ * 路由唯一编号->视图
1075
+ */
1076
+ declare class ViewDict extends Dictionary<string, View> {
1077
+ }
1078
+ declare class ViewRepo extends ViewDict {
1079
+ constructor();
1080
+ openByString(route: string): View;
1081
+ /**
1082
+ * 打开页面
1083
+ * 一个路由代表一个页面
1084
+ * @param route
1085
+ */
1086
+ open(route: Route): View;
1087
+ close(route: Route): void;
1088
+ /**
1089
+ * 如果页面存在,则刷新
1090
+ * @param route
1091
+ */
1092
+ refresh(route: Route): void;
1093
+ getByRoute(route: Route): View;
1094
+ listByRoutePath(path: string): ViewList;
1095
+ listByTags(tags: string[]): ViewList;
1096
+ protected getController(name: string): ViewController;
1097
+ get objectDict(): UIObjectDict;
1098
+ protected _objectDict: UIObjectDict;
1099
+ protected _indexLayer: {};
1100
+ protected _indexRoute: {};
1101
+ }
1102
+ declare const viewrepo: ViewRepo;
1066
1103
 
1067
1104
  declare class ViewController extends Controller {
1068
1105
  constructor(routeName: string);
@@ -1070,7 +1107,7 @@ declare class ViewController extends Controller {
1070
1107
  * 当视图需要通过路由打开时,需要实现此方法
1071
1108
  * @param route
1072
1109
  */
1073
- open(route: Route): View;
1110
+ open(route?: Route): View;
1074
1111
  protected onOpening(view: View): void;
1075
1112
  protected onOpened(view: View): void;
1076
1113
  protected onClosing(view: View): void;
@@ -1116,6 +1153,30 @@ declare class ViewController extends Controller {
1116
1153
  protected _layer: string;
1117
1154
  }
1118
1155
 
1156
+ declare class ViewHistory extends RouteList {
1157
+ back(): void;
1158
+ }
1159
+ declare const viewhistorys: RouteList;
1160
+
1161
+ declare class PageController extends ViewController {
1162
+ constructor(routeName: string);
1163
+ /**
1164
+ * 打开视图,如果视图已经存在则刷新视图
1165
+ * @param route
1166
+ */
1167
+ open(route: Route): View;
1168
+ /**
1169
+ * @param route
1170
+ * @returns
1171
+ */
1172
+ close(route?: Route): View;
1173
+ useHistory(): this;
1174
+ get route(): Route;
1175
+ get enableHistory(): boolean;
1176
+ protected _enableHistory: boolean;
1177
+ protected _layer: string;
1178
+ }
1179
+
1119
1180
  /**
1120
1181
  * 事件字符串分隔符
1121
1182
  */
@@ -1978,5 +2039,5 @@ declare class WidgetUtil {
1978
2039
  }
1979
2040
  declare var widgetutil: WidgetUtil;
1980
2041
 
1981
- 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, RouteList, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, ViewController, 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, uidict, uimgr, uiutil, widgetutil };
2042
+ 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, PageController, PathUtil, Pool, RandUtil, Route, RouteList, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, View, ViewController, 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, uidict, uimgr, uiutil, viewhistorys, viewrepo, widgetutil };
1982
2043
  export type { CreatorFunction, DisposeFunction, IController, IError, IEventManager, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
package/dist/index.esm.js CHANGED
@@ -3839,6 +3839,9 @@ class ViewController extends Controller {
3839
3839
  * @param route
3840
3840
  */
3841
3841
  open(route) {
3842
+ if (!route) {
3843
+ route = this.route;
3844
+ }
3842
3845
  let oldView = viewrepo.getByRoute(route);
3843
3846
  if (oldView) {
3844
3847
  this.closeView(oldView);
@@ -3916,6 +3919,9 @@ class ViewController extends Controller {
3916
3919
  * @returns
3917
3920
  */
3918
3921
  close(route) {
3922
+ if (!route) {
3923
+ route = this.route;
3924
+ }
3919
3925
  let view = viewrepo.getByRoute(route);
3920
3926
  if (view) {
3921
3927
  this.closeView(view);
@@ -4034,6 +4040,78 @@ class ViewController extends Controller {
4034
4040
  }
4035
4041
  }
4036
4042
 
4043
+ class ViewHistory extends RouteList {
4044
+ back() {
4045
+ if (viewhistorys.length == 0) {
4046
+ return;
4047
+ }
4048
+ viewrepo.close(viewhistorys.shift());
4049
+ if (viewhistorys.length == 0) {
4050
+ return;
4051
+ }
4052
+ viewrepo.open(viewhistorys.last());
4053
+ }
4054
+ }
4055
+ const viewhistorys = new RouteList();
4056
+
4057
+ class PageController extends ViewController {
4058
+ constructor(routeName) {
4059
+ super(routeName);
4060
+ this._enableHistory = false;
4061
+ this._layer = "";
4062
+ this._route = new Route(routeName);
4063
+ }
4064
+ /**
4065
+ * 打开视图,如果视图已经存在则刷新视图
4066
+ * @param route
4067
+ */
4068
+ open(route) {
4069
+ let view = viewrepo.getByRoute(route);
4070
+ if (view) { //
4071
+ this.refreshView(view);
4072
+ return;
4073
+ }
4074
+ // 关闭同一层的所有视图
4075
+ this.closeExclusion((existed) => {
4076
+ return existed.layer == this._layer;
4077
+ });
4078
+ if (this.enableHistory) {
4079
+ viewhistorys.push(route);
4080
+ }
4081
+ view = new View(this, route);
4082
+ this.openView(view);
4083
+ return view;
4084
+ }
4085
+ /**
4086
+ * @param route
4087
+ * @returns
4088
+ */
4089
+ close(route) {
4090
+ let lastview;
4091
+ if (this._layer) {
4092
+ if (this._enableHistory) {
4093
+ // 清空历史记录
4094
+ viewhistorys.clear();
4095
+ }
4096
+ }
4097
+ else {
4098
+ lastview = viewrepo.getByRoute(route);
4099
+ }
4100
+ this.closeView(lastview);
4101
+ return lastview;
4102
+ }
4103
+ useHistory() {
4104
+ this._enableHistory = true;
4105
+ return this;
4106
+ }
4107
+ get route() {
4108
+ return this._route;
4109
+ }
4110
+ get enableHistory() {
4111
+ return this._enableHistory;
4112
+ }
4113
+ }
4114
+
4037
4115
  class Listener {
4038
4116
  static create(ident) {
4039
4117
  return new Listener(ident);
@@ -6307,5 +6385,5 @@ class WidgetUtil {
6307
6385
  }
6308
6386
  var widgetutil = new WidgetUtil();
6309
6387
 
6310
- 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, RouteList, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, ViewController, 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, uidict, uimgr, uiutil, widgetutil };
6388
+ 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, PageController, PathUtil, Pool, RandUtil, Route, RouteList, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectDict, UIPoolConfig, UISingleConfig, UIUtil, View, ViewController, 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, uidict, uimgr, uiutil, viewhistorys, viewrepo, widgetutil };
6311
6389
  //# sourceMappingURL=index.esm.js.map