@zhongguo168a/yxeditor-common 0.0.31 → 0.0.32

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);
@@ -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
@@ -4034,6 +4034,78 @@ class ViewController extends Controller {
4034
4034
  }
4035
4035
  }
4036
4036
 
4037
+ class ViewHistory extends RouteList {
4038
+ back() {
4039
+ if (viewhistorys.length == 0) {
4040
+ return;
4041
+ }
4042
+ viewrepo.close(viewhistorys.shift());
4043
+ if (viewhistorys.length == 0) {
4044
+ return;
4045
+ }
4046
+ viewrepo.open(viewhistorys.last());
4047
+ }
4048
+ }
4049
+ const viewhistorys = new RouteList();
4050
+
4051
+ class PageController extends ViewController {
4052
+ constructor(routeName) {
4053
+ super(routeName);
4054
+ this._enableHistory = false;
4055
+ this._layer = "";
4056
+ this._route = new Route(routeName);
4057
+ }
4058
+ /**
4059
+ * 打开视图,如果视图已经存在则刷新视图
4060
+ * @param route
4061
+ */
4062
+ open(route) {
4063
+ let view = viewrepo.getByRoute(route);
4064
+ if (view) { //
4065
+ this.refreshView(view);
4066
+ return;
4067
+ }
4068
+ // 关闭同一层的所有视图
4069
+ this.closeExclusion((existed) => {
4070
+ return existed.layer == this._layer;
4071
+ });
4072
+ if (this.enableHistory) {
4073
+ viewhistorys.push(route);
4074
+ }
4075
+ view = new View(this, route);
4076
+ this.openView(view);
4077
+ return view;
4078
+ }
4079
+ /**
4080
+ * @param route
4081
+ * @returns
4082
+ */
4083
+ close(route) {
4084
+ let lastview;
4085
+ if (this._layer) {
4086
+ if (this._enableHistory) {
4087
+ // 清空历史记录
4088
+ viewhistorys.clear();
4089
+ }
4090
+ }
4091
+ else {
4092
+ lastview = viewrepo.getByRoute(route);
4093
+ }
4094
+ this.closeView(lastview);
4095
+ return lastview;
4096
+ }
4097
+ useHistory() {
4098
+ this._enableHistory = true;
4099
+ return this;
4100
+ }
4101
+ get route() {
4102
+ return this._route;
4103
+ }
4104
+ get enableHistory() {
4105
+ return this._enableHistory;
4106
+ }
4107
+ }
4108
+
4037
4109
  class Listener {
4038
4110
  static create(ident) {
4039
4111
  return new Listener(ident);
@@ -6307,5 +6379,5 @@ class WidgetUtil {
6307
6379
  }
6308
6380
  var widgetutil = new WidgetUtil();
6309
6381
 
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 };
6382
+ 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
6383
  //# sourceMappingURL=index.esm.js.map