@zhongguo168a/yxeditor-common 0.0.16 → 0.0.18

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
@@ -1,4 +1,4 @@
1
- import { HorizontalTextAlignment, VerticalTextAlignment, Scheduler, Prefab, Node, Component, ISchedulable, AssetManager, Asset, SpriteAtlas, Camera, Canvas, Vec2, Vec3, Vec4, Widget, UITransform, math } from 'cc';
1
+ import { HorizontalTextAlignment, VerticalTextAlignment, Scheduler, Prefab, Node, ISchedulable, AssetManager, Asset, SpriteAtlas, Camera, Canvas, Vec2, Vec3, Vec4, Widget, UITransform, math } from 'cc';
2
2
 
3
3
  interface IError {
4
4
  isCancel(): boolean;
@@ -207,24 +207,6 @@ declare class Timer {
207
207
  }
208
208
  declare const timer: Timer;
209
209
 
210
- declare class ControllerSet {
211
- constructor(mod: IModule);
212
- has(name: string): boolean;
213
- add(controller: IController): void;
214
- createAndEnable(name: string, ...args: any[]): void;
215
- create(name: string, ...args: any[]): void;
216
- remove(name: string): void;
217
- disable(name: string): void;
218
- enable(name: string): void;
219
- enableAll(): void;
220
- disableAll(): void;
221
- dispose(): void;
222
- registerCreator(name: string, creator: (...args: any[]) => IController): void;
223
- protected _creator: {};
224
- protected _mod: IModule;
225
- private data;
226
- }
227
-
228
210
  /**
229
211
  * 事件
230
212
  */
@@ -367,122 +349,6 @@ declare class EventManager implements IEventManager {
367
349
  */
368
350
  declare const eventmgr: EventManager;
369
351
 
370
- /**
371
- * 一个简单的功能/库模块
372
- */
373
- interface IModuleSample {
374
- }
375
- interface IModule {
376
- controllers: ControllerSet;
377
- }
378
- declare class Module extends EventManager implements IModule {
379
- constructor();
380
- get controllers(): ControllerSet;
381
- private _controllers;
382
- }
383
-
384
- interface IController {
385
- get name(): string;
386
- get module(): IModule;
387
- init(core: IModule): any;
388
- enable(): any;
389
- disable(): any;
390
- dispose(): any;
391
- }
392
- declare class Controller {
393
- constructor(name: string);
394
- init(core: IModule): void;
395
- enable(): void;
396
- disable(): void;
397
- dispose(): void;
398
- get name(): string;
399
- get module(): IModule;
400
- get isEnable(): boolean;
401
- protected _module: IModule;
402
- protected _name: string;
403
- protected _enabled: boolean;
404
- }
405
-
406
- interface IModel {
407
- get module(): IModule;
408
- }
409
- declare class SimpleModel {
410
- constructor(mod: IModule);
411
- get core(): IModule;
412
- protected _mod: any;
413
- }
414
- declare class Model extends EventManager {
415
- constructor(core?: IModule);
416
- get module(): IModule;
417
- protected _module: any;
418
- }
419
-
420
- interface IExtend {
421
- get module(): IModule;
422
- }
423
-
424
- declare class Factory {
425
- _controllers: {
426
- [key: string]: (mod: IModule) => IController;
427
- };
428
- _extends: {
429
- [key: string]: (mod: IModule, ...args: any) => IExtend;
430
- };
431
- registerController(name: string, creator: (mod: IModule, ...args: any) => IController): void;
432
- registerExtend(name: string, creator: (mod: IModule, ...args: any) => IExtend): void;
433
- createController(name: string, mod: IModule): IController;
434
- createExtend(name: string, mod: IModule, ...args: any[]): IExtend;
435
- }
436
-
437
- /**
438
- * 视图的路由值, 保存视图的信息
439
- * 规则: path/search
440
- * path = /a/b/c
441
- * search = ?key=val&key=val
442
- */
443
- declare class Route {
444
- constructor(route: string);
445
- recycle(): void;
446
- /**
447
- * 获取调用链
448
- * 例如 a/b/c,返回 a/b/c -> a/b -> a
449
- */
450
- getLink(): Route[];
451
- protected static data: any;
452
- static getData(route: string): Route;
453
- toLoaction(): Location;
454
- /**
455
- * @constructor
456
- */
457
- NewRoute(): Route;
458
- /**
459
- * @constructor
460
- */
461
- NewRoutePath(): Route;
462
- /**
463
- * 新建一个带参数的路由
464
- * @param params
465
- */
466
- NewRouteParam(params: any): Route;
467
- toString(): string;
468
- get path(): string;
469
- get parentPath(): string;
470
- get params(): any;
471
- get search(): string;
472
- set search(value: string);
473
- get name(): string;
474
- /**
475
- * path/search
476
- */
477
- get key(): string;
478
- private _path;
479
- private _parentPath;
480
- private _search;
481
- private _name;
482
- private _params;
483
- protected _route: string;
484
- }
485
-
486
352
  declare class TreeIterator {
487
353
  break(): void;
488
354
  isBreak(): boolean;
@@ -1027,6 +893,126 @@ declare class List<T = any> {
1027
893
  private _onDeleteCaller;
1028
894
  }
1029
895
 
896
+ interface IModule {
897
+ get controllers(): ControllerDict;
898
+ }
899
+
900
+ interface IController {
901
+ get name(): string;
902
+ get module(): IModule;
903
+ init(core: IModule, ...args: any): any;
904
+ enable(): any;
905
+ disable(): any;
906
+ dispose(): any;
907
+ }
908
+ declare class Controller {
909
+ constructor(name: string);
910
+ init(module: IModule, ...args: any[]): void;
911
+ enable(): void;
912
+ disable(): void;
913
+ dispose(): void;
914
+ get name(): string;
915
+ get module(): IModule;
916
+ get isEnable(): boolean;
917
+ protected _module: IModule;
918
+ protected _name: string;
919
+ protected _enabled: boolean;
920
+ }
921
+ declare class ControllerDict extends Dictionary<string, IController> {
922
+ constructor();
923
+ disable(name: string): void;
924
+ enable(name: string): void;
925
+ enableAll(): void;
926
+ disableAll(): void;
927
+ }
928
+ declare class ControllerRepo extends ControllerDict {
929
+ constructor(mod: IModule);
930
+ add(controller: IController): void;
931
+ remove(name: string): void;
932
+ dispose(): void;
933
+ protected _mod: IModule;
934
+ }
935
+
936
+ interface IModel {
937
+ get module(): IModule;
938
+ }
939
+ declare class SimpleModel {
940
+ constructor(mod: IModule);
941
+ get core(): IModule;
942
+ protected _mod: any;
943
+ }
944
+ declare class Model extends EventManager {
945
+ constructor(core?: IModule);
946
+ get module(): IModule;
947
+ protected _module: any;
948
+ }
949
+
950
+ interface IExtend {
951
+ get module(): IModule;
952
+ }
953
+
954
+ declare class Factory {
955
+ _controllers: {
956
+ [key: string]: (mod: IModule) => IController;
957
+ };
958
+ _extends: {
959
+ [key: string]: (mod: IModule, ...args: any) => IExtend;
960
+ };
961
+ registerController(name: string, creator: (mod: IModule, ...args: any) => IController): void;
962
+ registerExtend(name: string, creator: (mod: IModule, ...args: any) => IExtend): void;
963
+ createController(name: string, mod: IModule): IController;
964
+ createExtend(name: string, mod: IModule, ...args: any[]): IExtend;
965
+ }
966
+
967
+ /**
968
+ * 视图的路由值, 保存视图的信息
969
+ * 规则: path/search
970
+ * path = /a/b/c
971
+ * search = ?key=val&key=val
972
+ */
973
+ declare class Route {
974
+ constructor(route: string);
975
+ recycle(): void;
976
+ /**
977
+ * 获取调用链
978
+ * 例如 a/b/c,返回 a/b/c -> a/b -> a
979
+ */
980
+ getLink(): Route[];
981
+ protected static data: any;
982
+ static getData(route: string): Route;
983
+ toLoaction(): Location;
984
+ /**
985
+ * @constructor
986
+ */
987
+ NewRoute(): Route;
988
+ /**
989
+ * @constructor
990
+ */
991
+ NewRoutePath(): Route;
992
+ /**
993
+ * 新建一个带参数的路由
994
+ * @param params
995
+ */
996
+ NewRouteParam(params: any): Route;
997
+ toString(): string;
998
+ get path(): string;
999
+ get parentPath(): string;
1000
+ get params(): any;
1001
+ get search(): string;
1002
+ set search(value: string);
1003
+ get name(): string;
1004
+ /**
1005
+ * path/search
1006
+ */
1007
+ get key(): string;
1008
+ private _path;
1009
+ private _parentPath;
1010
+ private _search;
1011
+ private _name;
1012
+ private _params;
1013
+ protected _route: string;
1014
+ }
1015
+
1030
1016
  declare class UIObjectDict extends Dictionary<string, any | List> {
1031
1017
  /**
1032
1018
  * 获取唯一的
@@ -1040,25 +1026,70 @@ declare class UIObjectDict extends Dictionary<string, any | List> {
1040
1026
  }
1041
1027
  declare var uidict: UIObjectDict;
1042
1028
 
1043
- declare class ViewController extends Component {
1029
+ /**
1030
+ * 视图管理器
1031
+ * 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
1032
+ */
1033
+ declare class PageLayer {
1034
+ name: string;
1044
1035
  constructor(name: string);
1045
- open(...args: any[]): void;
1046
1036
  close(): void;
1037
+ /**
1038
+ * 当前的页面
1039
+ */
1040
+ currentPage: Page;
1041
+ }
1042
+
1043
+ declare class PageList extends List<Page> {
1044
+ }
1045
+ declare class PageRepo extends PageList {
1046
+ constructor(module: IModule);
1047
+ openByString(route: string): Page;
1048
+ /**
1049
+ * 打开页面
1050
+ * 一个路由代表一个页面
1051
+ * @param route
1052
+ */
1053
+ open(route: Route): Page;
1054
+ close(route: Route): void;
1055
+ /**
1056
+ * 如果页面存在,则刷新
1057
+ * @param route
1058
+ */
1059
+ refresh(route: Route): void;
1060
+ /**
1061
+ * 历史记录
1062
+ */
1063
+ getHistory(): Route[];
1064
+ back(): void;
1065
+ getByRoute(route: Route): Page;
1066
+ listByTags(tags: string[]): PageList;
1067
+ getLayerMain(): PageLayer;
1068
+ /**
1069
+ * @param name
1070
+ */
1071
+ getLayer(name: string): PageLayer;
1072
+ protected getOrNewLayer(name: string): PageLayer;
1073
+ getController(route: Route): PageController;
1074
+ registerController(ctrl: PageController): void;
1047
1075
  get objectDict(): UIObjectDict;
1048
1076
  protected _objectDict: UIObjectDict;
1077
+ protected _indexLayer: {};
1078
+ protected _indexRoute: {};
1079
+ protected _history: Route[];
1080
+ protected _ctrlDict: ControllerDict;
1081
+ protected _module: IModule;
1049
1082
  }
1050
- declare class ControllerDict extends Dictionary<string, ViewController> {
1051
- getByName(name: string): ViewController;
1052
- register(controller: ViewController): void;
1053
- }
1054
- declare var ctrlrepo: ControllerDict;
1055
1083
 
1056
- declare class PageController extends ViewController {
1084
+ declare class PageController extends Controller {
1057
1085
  constructor(routeName: string, config?: {
1058
1086
  layer?: string;
1059
1087
  tags?: string[];
1060
1088
  enableHistory?: boolean;
1061
1089
  });
1090
+ init(module: IModule, pageRepo: PageRepo): void;
1091
+ open(...args: any[]): void;
1092
+ close(): void;
1062
1093
  protected onOpening(page: Page): void;
1063
1094
  protected onOpened(page: Page): void;
1064
1095
  protected onClosing(page: Page): void;
@@ -1083,6 +1114,7 @@ declare class PageController extends ViewController {
1083
1114
  protected _lastPage: Page;
1084
1115
  protected _tags: {};
1085
1116
  protected _layer: string;
1117
+ protected _pagerepo: PageRepo;
1086
1118
  }
1087
1119
 
1088
1120
  declare enum PageState {
@@ -1140,59 +1172,6 @@ declare class Page extends EventManager {
1140
1172
  protected _route: Route;
1141
1173
  }
1142
1174
 
1143
- /**
1144
- * 视图管理器
1145
- * 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
1146
- */
1147
- declare class PageLayer {
1148
- name: string;
1149
- constructor(name: string);
1150
- close(): void;
1151
- /**
1152
- * 当前的页面
1153
- */
1154
- currentPage: Page;
1155
- }
1156
-
1157
- declare class PageList extends List<Page> {
1158
- }
1159
- declare class PageRepo extends PageList {
1160
- constructor();
1161
- openByString(route: string): Page;
1162
- /**
1163
- * 打开页面
1164
- * 一个路由代表一个页面
1165
- * @param route
1166
- */
1167
- open(route: Route): Page;
1168
- close(route: Route): void;
1169
- /**
1170
- * 如果页面存在,则刷新
1171
- * @param route
1172
- */
1173
- refresh(route: Route): void;
1174
- /**
1175
- * 历史记录
1176
- */
1177
- getHistory(): Route[];
1178
- back(): void;
1179
- getByRoute(route: Route): Page;
1180
- listByTags(tags: string[]): PageList;
1181
- getLayerMain(): PageLayer;
1182
- /**
1183
- * @param name
1184
- */
1185
- getLayer(name: string): PageLayer;
1186
- protected getOrNewLayer(name: string): PageLayer;
1187
- getController(route: Route): PageController;
1188
- get objectDict(): UIObjectDict;
1189
- protected _objectDict: UIObjectDict;
1190
- protected _indexLayer: {};
1191
- protected _indexRoute: {};
1192
- protected _history: Route[];
1193
- }
1194
- declare const pagerepo: PageRepo;
1195
-
1196
1175
  /**
1197
1176
  * 事件字符串分隔符
1198
1177
  */
@@ -2043,5 +2022,5 @@ declare class WidgetUtil {
2043
2022
  }
2044
2023
  declare var widgetutil: WidgetUtil;
2045
2024
 
2046
- export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerSet, 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, Module, 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, 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, pagerepo, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uidict, uimgr, uiutil, widgetutil };
2047
- export type { CreatorFunction, DisposeFunction, IController, IError, IEventManager, IExtend, IListItem, IModel, IModule, IModuleSample, ITreeListItem, RecycleFunction };
2025
+ 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, parseAtlas, parsePlist, pathutil, randutil, resutil, scaleutil, stringutil, timer, timeutil, treeutil, uidict, uimgr, uiutil, widgetutil };
2026
+ export type { CreatorFunction, DisposeFunction, IController, IError, IEventManager, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };