@zhongguo168a/yxeditor-common 0.0.87 → 0.0.89
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 -3
- package/dist/index.esm.js +210 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1347,7 +1347,7 @@ declare class ViewModel extends EventDispatcher {
|
|
|
1347
1347
|
protected onStop(): void;
|
|
1348
1348
|
}
|
|
1349
1349
|
|
|
1350
|
-
declare class ViewList extends List<
|
|
1350
|
+
declare class ViewList extends List<ViewModel> {
|
|
1351
1351
|
}
|
|
1352
1352
|
/**
|
|
1353
1353
|
* 路由唯一编号->视图
|
|
@@ -1361,7 +1361,7 @@ declare class ViewDict extends Dictionary<string, any> {
|
|
|
1361
1361
|
* @param validFunc 符合条件的视图对象会被关闭
|
|
1362
1362
|
* @returns 被关闭的视图
|
|
1363
1363
|
*/
|
|
1364
|
-
closeExclusion(validFunc?: (existed:
|
|
1364
|
+
closeExclusion(validFunc?: (existed: ViewModel) => boolean): ViewList;
|
|
1365
1365
|
listByRoutePath(path: string): ViewList;
|
|
1366
1366
|
listByTags(tags: string[]): ViewList;
|
|
1367
1367
|
/**
|
|
@@ -2180,5 +2180,5 @@ declare class WidgetUtil {
|
|
|
2180
2180
|
}
|
|
2181
2181
|
declare var widgetutil: WidgetUtil;
|
|
2182
2182
|
|
|
2183
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, create等距图集, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, routeviews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
2183
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewModel, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, create等距图集, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, routeviews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
2184
2184
|
export type { CreatorFunction, DisposeFunction, IController, IError, IEventDispatcher, IExtend, IListItem, IModel, IModule, ITreeListItem, RecycleFunction };
|
package/dist/index.esm.js
CHANGED
|
@@ -4128,7 +4128,6 @@ class ViewDict extends Dictionary {
|
|
|
4128
4128
|
}
|
|
4129
4129
|
});
|
|
4130
4130
|
closedList.forEach((index, item) => {
|
|
4131
|
-
item.controller;
|
|
4132
4131
|
item.close();
|
|
4133
4132
|
});
|
|
4134
4133
|
return closedList;
|
|
@@ -4226,6 +4225,215 @@ class ViewHistory extends RouteList {
|
|
|
4226
4225
|
}
|
|
4227
4226
|
const viewhistorys = new ViewHistory();
|
|
4228
4227
|
|
|
4228
|
+
class ViewModel extends EventDispatcher {
|
|
4229
|
+
/**
|
|
4230
|
+
* 视图模型的名称
|
|
4231
|
+
* @param name
|
|
4232
|
+
*/
|
|
4233
|
+
constructor(name) {
|
|
4234
|
+
super();
|
|
4235
|
+
this._waitOpenComplete = false;
|
|
4236
|
+
this._waitCloseComplete = false;
|
|
4237
|
+
this.datas = new MapObject({});
|
|
4238
|
+
this.tags = new MapObject({});
|
|
4239
|
+
this.enableHistory = false;
|
|
4240
|
+
this.state = 0;
|
|
4241
|
+
this.name = name;
|
|
4242
|
+
}
|
|
4243
|
+
/**
|
|
4244
|
+
* 视图模型的编号
|
|
4245
|
+
* 默认为视图模型的类型,表示该模型在应用中唯一
|
|
4246
|
+
* 如果应用中,存在多个
|
|
4247
|
+
* @returns
|
|
4248
|
+
*/
|
|
4249
|
+
getIdent() {
|
|
4250
|
+
return this.name;
|
|
4251
|
+
}
|
|
4252
|
+
/**
|
|
4253
|
+
*
|
|
4254
|
+
* @param asset 通过此方法创建的节点,自动添加 RouteComponent 到节点上
|
|
4255
|
+
*/
|
|
4256
|
+
createNode(asset) {
|
|
4257
|
+
let node = instantiate(asset);
|
|
4258
|
+
this.node = node;
|
|
4259
|
+
let com = node.addComponent(ViewModelComponent);
|
|
4260
|
+
com.viewModel = this;
|
|
4261
|
+
}
|
|
4262
|
+
/**
|
|
4263
|
+
* 使用route的视图模型,可以实现通过路由,操作视图
|
|
4264
|
+
* @param route
|
|
4265
|
+
* @param controller
|
|
4266
|
+
*/
|
|
4267
|
+
useRoute(route, controller) {
|
|
4268
|
+
this._route = route;
|
|
4269
|
+
this._controller = controller;
|
|
4270
|
+
}
|
|
4271
|
+
open() {
|
|
4272
|
+
if (this.state != ViewState.Closed) {
|
|
4273
|
+
return;
|
|
4274
|
+
}
|
|
4275
|
+
let route = this._route;
|
|
4276
|
+
if (route) {
|
|
4277
|
+
if (routeviews.get(route.key)) {
|
|
4278
|
+
throw `视图已存在: route=${route.key}`;
|
|
4279
|
+
}
|
|
4280
|
+
routeviews.set(route.key, this);
|
|
4281
|
+
}
|
|
4282
|
+
this.state = ViewState.Opening;
|
|
4283
|
+
this.dispatch(ViewEvent.Opening);
|
|
4284
|
+
//
|
|
4285
|
+
try {
|
|
4286
|
+
//
|
|
4287
|
+
this.onOpen();
|
|
4288
|
+
if (!this._waitOpenComplete) {
|
|
4289
|
+
// 没有被打断,打开完成
|
|
4290
|
+
this.openComplete();
|
|
4291
|
+
}
|
|
4292
|
+
else {
|
|
4293
|
+
// 被打断了,等待完成1
|
|
4294
|
+
}
|
|
4295
|
+
}
|
|
4296
|
+
catch (e) {
|
|
4297
|
+
console.error(`open view ${this.toString()}`);
|
|
4298
|
+
console.error(e.stack);
|
|
4299
|
+
//
|
|
4300
|
+
this.close();
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
close() {
|
|
4304
|
+
if (this.state == ViewState.Closed) {
|
|
4305
|
+
return;
|
|
4306
|
+
}
|
|
4307
|
+
let route = this._route;
|
|
4308
|
+
if (route) {
|
|
4309
|
+
routeviews.delete(this._route.key);
|
|
4310
|
+
}
|
|
4311
|
+
this.state = ViewState.Closeing;
|
|
4312
|
+
this.dispatch(ViewEvent.Closeing);
|
|
4313
|
+
try {
|
|
4314
|
+
this.onClose();
|
|
4315
|
+
if (!this._waitCloseComplete) {
|
|
4316
|
+
// 没有被打断,关闭完成
|
|
4317
|
+
this.closeComplete();
|
|
4318
|
+
}
|
|
4319
|
+
else {
|
|
4320
|
+
// 被打断了,等待完成1
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
catch (e) {
|
|
4324
|
+
console.error(`close view ${this.toString()}`);
|
|
4325
|
+
console.error(e.stack);
|
|
4326
|
+
}
|
|
4327
|
+
}
|
|
4328
|
+
refresh() {
|
|
4329
|
+
try {
|
|
4330
|
+
this.onRefresh();
|
|
4331
|
+
}
|
|
4332
|
+
catch (e) {
|
|
4333
|
+
console.error(`refresh view ${this.toString()}`);
|
|
4334
|
+
console.error(e.stack);
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
stop(reason) {
|
|
4338
|
+
try {
|
|
4339
|
+
this.onStop();
|
|
4340
|
+
}
|
|
4341
|
+
catch (e) {
|
|
4342
|
+
console.error(`stop view ${this.toString()}`);
|
|
4343
|
+
console.error(e.stack);
|
|
4344
|
+
}
|
|
4345
|
+
this.dispatch(ViewEvent.Stop);
|
|
4346
|
+
}
|
|
4347
|
+
/**
|
|
4348
|
+
* 等待发送的结果
|
|
4349
|
+
* 如果返回 null,表示主动取消 [cancel]
|
|
4350
|
+
*/
|
|
4351
|
+
wait() {
|
|
4352
|
+
switch (this.state) {
|
|
4353
|
+
case ViewState.Opening:
|
|
4354
|
+
return new Promise((resolve, reject) => {
|
|
4355
|
+
let opened = () => {
|
|
4356
|
+
this.off("opened", this, opened);
|
|
4357
|
+
this.off("canceled", this, opened);
|
|
4358
|
+
resolve(this);
|
|
4359
|
+
};
|
|
4360
|
+
let canceled = () => {
|
|
4361
|
+
this.off("opened", this, opened);
|
|
4362
|
+
this.off("canceled", this, opened);
|
|
4363
|
+
resolve(this);
|
|
4364
|
+
};
|
|
4365
|
+
this.on("opened", this, opened);
|
|
4366
|
+
this.on("canceled", this, canceled);
|
|
4367
|
+
});
|
|
4368
|
+
case ViewState.Closeing:
|
|
4369
|
+
return new Promise((resolve, reject) => {
|
|
4370
|
+
let opened = () => {
|
|
4371
|
+
this.off("closed", this, opened);
|
|
4372
|
+
resolve(this);
|
|
4373
|
+
};
|
|
4374
|
+
this.on("closed", this, opened);
|
|
4375
|
+
});
|
|
4376
|
+
default:
|
|
4377
|
+
return new Promise((resolve, reject) => {
|
|
4378
|
+
resolve(this);
|
|
4379
|
+
});
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
toString() {
|
|
4383
|
+
return `View[${this.getIdent}, ${this.id}]`;
|
|
4384
|
+
}
|
|
4385
|
+
/**
|
|
4386
|
+
* 等待打开完成指令
|
|
4387
|
+
*/
|
|
4388
|
+
waitOpenComplete() {
|
|
4389
|
+
this._waitOpenComplete = true;
|
|
4390
|
+
}
|
|
4391
|
+
openComplete() {
|
|
4392
|
+
if (this.state == ViewState.Opened) {
|
|
4393
|
+
return;
|
|
4394
|
+
}
|
|
4395
|
+
this.state = ViewState.Opened;
|
|
4396
|
+
// @ts-ignore
|
|
4397
|
+
this._waitOpenComplete = false;
|
|
4398
|
+
this.onOpened();
|
|
4399
|
+
this.dispatch(ViewEvent.Opened);
|
|
4400
|
+
}
|
|
4401
|
+
waitCloseComplete() {
|
|
4402
|
+
// @ts-ignore
|
|
4403
|
+
this._waitCloseComplete = true;
|
|
4404
|
+
}
|
|
4405
|
+
closeComplete() {
|
|
4406
|
+
if (this.state == ViewState.Closed) {
|
|
4407
|
+
return;
|
|
4408
|
+
}
|
|
4409
|
+
routeviews.delete(this.getIdent());
|
|
4410
|
+
this._waitCloseComplete = false;
|
|
4411
|
+
this.state = ViewState.Closed;
|
|
4412
|
+
this.dispatch(ViewEvent.Closed);
|
|
4413
|
+
this.onClosed();
|
|
4414
|
+
}
|
|
4415
|
+
get reason() {
|
|
4416
|
+
return this._reason;
|
|
4417
|
+
}
|
|
4418
|
+
onOpen() {
|
|
4419
|
+
}
|
|
4420
|
+
onOpened() {
|
|
4421
|
+
}
|
|
4422
|
+
onClose() {
|
|
4423
|
+
}
|
|
4424
|
+
onClosed() {
|
|
4425
|
+
}
|
|
4426
|
+
onRefresh() {
|
|
4427
|
+
}
|
|
4428
|
+
/**
|
|
4429
|
+
* 默认执行 close();
|
|
4430
|
+
*/
|
|
4431
|
+
onStop() {
|
|
4432
|
+
this.close();
|
|
4433
|
+
}
|
|
4434
|
+
;
|
|
4435
|
+
}
|
|
4436
|
+
|
|
4229
4437
|
class Listener {
|
|
4230
4438
|
static create(ident) {
|
|
4231
4439
|
return new Listener(ident);
|
|
@@ -6638,5 +6846,5 @@ class WidgetUtil {
|
|
|
6638
6846
|
}
|
|
6639
6847
|
var widgetutil = new WidgetUtil();
|
|
6640
6848
|
|
|
6641
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, create等距图集, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, routeviews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
6849
|
+
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller, ControllerDict, ControllerRepo, ConvertUtil, DictIterator, DictNode, DictSource, Dictionary, DirectionMode, Dispatcher, DocUtil, ErrorUtil, EventDispatcher, EventItem, EventUtil, Factory, FloatUtil, GeometryDirection, GeometryUtil, IdentUtil, LOGGER_EVENT, LinkError, List, ListIterator, ListNode, ListSource, Listener, LogLevel, LogManager, Logger, MapObject, MapUtil, MathUtil, Model, NetUtil, PathUtil, Pool, RandUtil, Route, RouteController, RouteList, RouteView, RouteViewDict, SampleCallbackList, SamplePool, SamplePoolSet, ScaleUtil, SimpleModel, StringUtil, TimeUtil, Timer, TreeIterator, TreeNode, TreeNodePlugin, TreeRoot, TreeRootPlugin, TreeUtil, UIManager, UIObjectRepo, UIPoolConfig, UISingleConfig, UIUtil, ViewDict, ViewEvent, ViewHistory, ViewList, ViewModel, ViewState, WidgetAlign, WidgetUtil, XAssetManager, XEvent, arrayutil, assetx, bitutil, camerautil, canvasutil, convertutil, create等距图集, ctrlrepo, docutil, errorutil, eventmgr, eventutil, floatutil, formatutil, geoutil, identutil, loadAtlas, logmgr, maputil, mathutil, netutil, parseAtlas, parsePlist, pathutil, randutil, resutil, routeviews, scaleutil, stringutil, timer, timeutil, treeutil, uimgr, uirepo, uiutil, viewhistorys, widgetutil };
|
|
6642
6850
|
//# sourceMappingURL=index.esm.js.map
|