@zhongguo168a/yxeditor-common 0.0.87 → 0.0.88
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 +1 -1
- package/dist/index.esm.js +210 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -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
|
@@ -4226,6 +4226,215 @@ class ViewHistory extends RouteList {
|
|
|
4226
4226
|
}
|
|
4227
4227
|
const viewhistorys = new ViewHistory();
|
|
4228
4228
|
|
|
4229
|
+
class ViewModel extends EventDispatcher {
|
|
4230
|
+
/**
|
|
4231
|
+
* 视图模型的名称
|
|
4232
|
+
* @param name
|
|
4233
|
+
*/
|
|
4234
|
+
constructor(name) {
|
|
4235
|
+
super();
|
|
4236
|
+
this._waitOpenComplete = false;
|
|
4237
|
+
this._waitCloseComplete = false;
|
|
4238
|
+
this.datas = new MapObject({});
|
|
4239
|
+
this.tags = new MapObject({});
|
|
4240
|
+
this.enableHistory = false;
|
|
4241
|
+
this.state = 0;
|
|
4242
|
+
this.name = name;
|
|
4243
|
+
}
|
|
4244
|
+
/**
|
|
4245
|
+
* 视图模型的编号
|
|
4246
|
+
* 默认为视图模型的类型,表示该模型在应用中唯一
|
|
4247
|
+
* 如果应用中,存在多个
|
|
4248
|
+
* @returns
|
|
4249
|
+
*/
|
|
4250
|
+
getIdent() {
|
|
4251
|
+
return this.name;
|
|
4252
|
+
}
|
|
4253
|
+
/**
|
|
4254
|
+
*
|
|
4255
|
+
* @param asset 通过此方法创建的节点,自动添加 RouteComponent 到节点上
|
|
4256
|
+
*/
|
|
4257
|
+
createNode(asset) {
|
|
4258
|
+
let node = instantiate(asset);
|
|
4259
|
+
this.node = node;
|
|
4260
|
+
let com = node.addComponent(ViewModelComponent);
|
|
4261
|
+
com.viewModel = this;
|
|
4262
|
+
}
|
|
4263
|
+
/**
|
|
4264
|
+
* 使用route的视图模型,可以实现通过路由,操作视图
|
|
4265
|
+
* @param route
|
|
4266
|
+
* @param controller
|
|
4267
|
+
*/
|
|
4268
|
+
useRoute(route, controller) {
|
|
4269
|
+
this._route = route;
|
|
4270
|
+
this._controller = controller;
|
|
4271
|
+
}
|
|
4272
|
+
open() {
|
|
4273
|
+
if (this.state != ViewState.Closed) {
|
|
4274
|
+
return;
|
|
4275
|
+
}
|
|
4276
|
+
let route = this._route;
|
|
4277
|
+
if (route) {
|
|
4278
|
+
if (routeviews.get(route.key)) {
|
|
4279
|
+
throw `视图已存在: route=${route.key}`;
|
|
4280
|
+
}
|
|
4281
|
+
routeviews.set(route.key, this);
|
|
4282
|
+
}
|
|
4283
|
+
this.state = ViewState.Opening;
|
|
4284
|
+
this.dispatch(ViewEvent.Opening);
|
|
4285
|
+
//
|
|
4286
|
+
try {
|
|
4287
|
+
//
|
|
4288
|
+
this.onOpen();
|
|
4289
|
+
if (!this._waitOpenComplete) {
|
|
4290
|
+
// 没有被打断,打开完成
|
|
4291
|
+
this.openComplete();
|
|
4292
|
+
}
|
|
4293
|
+
else {
|
|
4294
|
+
// 被打断了,等待完成1
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
catch (e) {
|
|
4298
|
+
console.error(`open view ${this.toString()}`);
|
|
4299
|
+
console.error(e.stack);
|
|
4300
|
+
//
|
|
4301
|
+
this.close();
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
close() {
|
|
4305
|
+
if (this.state == ViewState.Closed) {
|
|
4306
|
+
return;
|
|
4307
|
+
}
|
|
4308
|
+
let route = this._route;
|
|
4309
|
+
if (route) {
|
|
4310
|
+
routeviews.delete(this._route.key);
|
|
4311
|
+
}
|
|
4312
|
+
this.state = ViewState.Closeing;
|
|
4313
|
+
this.dispatch(ViewEvent.Closeing);
|
|
4314
|
+
try {
|
|
4315
|
+
this.onClose();
|
|
4316
|
+
if (!this._waitCloseComplete) {
|
|
4317
|
+
// 没有被打断,关闭完成
|
|
4318
|
+
this.closeComplete();
|
|
4319
|
+
}
|
|
4320
|
+
else {
|
|
4321
|
+
// 被打断了,等待完成1
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
catch (e) {
|
|
4325
|
+
console.error(`close view ${this.toString()}`);
|
|
4326
|
+
console.error(e.stack);
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
refresh() {
|
|
4330
|
+
try {
|
|
4331
|
+
this.onRefresh();
|
|
4332
|
+
}
|
|
4333
|
+
catch (e) {
|
|
4334
|
+
console.error(`refresh view ${this.toString()}`);
|
|
4335
|
+
console.error(e.stack);
|
|
4336
|
+
}
|
|
4337
|
+
}
|
|
4338
|
+
stop(reason) {
|
|
4339
|
+
try {
|
|
4340
|
+
this.onStop();
|
|
4341
|
+
}
|
|
4342
|
+
catch (e) {
|
|
4343
|
+
console.error(`stop view ${this.toString()}`);
|
|
4344
|
+
console.error(e.stack);
|
|
4345
|
+
}
|
|
4346
|
+
this.dispatch(ViewEvent.Stop);
|
|
4347
|
+
}
|
|
4348
|
+
/**
|
|
4349
|
+
* 等待发送的结果
|
|
4350
|
+
* 如果返回 null,表示主动取消 [cancel]
|
|
4351
|
+
*/
|
|
4352
|
+
wait() {
|
|
4353
|
+
switch (this.state) {
|
|
4354
|
+
case ViewState.Opening:
|
|
4355
|
+
return new Promise((resolve, reject) => {
|
|
4356
|
+
let opened = () => {
|
|
4357
|
+
this.off("opened", this, opened);
|
|
4358
|
+
this.off("canceled", this, opened);
|
|
4359
|
+
resolve(this);
|
|
4360
|
+
};
|
|
4361
|
+
let canceled = () => {
|
|
4362
|
+
this.off("opened", this, opened);
|
|
4363
|
+
this.off("canceled", this, opened);
|
|
4364
|
+
resolve(this);
|
|
4365
|
+
};
|
|
4366
|
+
this.on("opened", this, opened);
|
|
4367
|
+
this.on("canceled", this, canceled);
|
|
4368
|
+
});
|
|
4369
|
+
case ViewState.Closeing:
|
|
4370
|
+
return new Promise((resolve, reject) => {
|
|
4371
|
+
let opened = () => {
|
|
4372
|
+
this.off("closed", this, opened);
|
|
4373
|
+
resolve(this);
|
|
4374
|
+
};
|
|
4375
|
+
this.on("closed", this, opened);
|
|
4376
|
+
});
|
|
4377
|
+
default:
|
|
4378
|
+
return new Promise((resolve, reject) => {
|
|
4379
|
+
resolve(this);
|
|
4380
|
+
});
|
|
4381
|
+
}
|
|
4382
|
+
}
|
|
4383
|
+
toString() {
|
|
4384
|
+
return `View[${this.getIdent}, ${this.id}]`;
|
|
4385
|
+
}
|
|
4386
|
+
/**
|
|
4387
|
+
* 等待打开完成指令
|
|
4388
|
+
*/
|
|
4389
|
+
waitOpenComplete() {
|
|
4390
|
+
this._waitOpenComplete = true;
|
|
4391
|
+
}
|
|
4392
|
+
openComplete() {
|
|
4393
|
+
if (this.state == ViewState.Opened) {
|
|
4394
|
+
return;
|
|
4395
|
+
}
|
|
4396
|
+
this.state = ViewState.Opened;
|
|
4397
|
+
// @ts-ignore
|
|
4398
|
+
this._waitOpenComplete = false;
|
|
4399
|
+
this.onOpened();
|
|
4400
|
+
this.dispatch(ViewEvent.Opened);
|
|
4401
|
+
}
|
|
4402
|
+
waitCloseComplete() {
|
|
4403
|
+
// @ts-ignore
|
|
4404
|
+
this._waitCloseComplete = true;
|
|
4405
|
+
}
|
|
4406
|
+
closeComplete() {
|
|
4407
|
+
if (this.state == ViewState.Closed) {
|
|
4408
|
+
return;
|
|
4409
|
+
}
|
|
4410
|
+
routeviews.delete(this.getIdent());
|
|
4411
|
+
this._waitCloseComplete = false;
|
|
4412
|
+
this.state = ViewState.Closed;
|
|
4413
|
+
this.dispatch(ViewEvent.Closed);
|
|
4414
|
+
this.onClosed();
|
|
4415
|
+
}
|
|
4416
|
+
get reason() {
|
|
4417
|
+
return this._reason;
|
|
4418
|
+
}
|
|
4419
|
+
onOpen() {
|
|
4420
|
+
}
|
|
4421
|
+
onOpened() {
|
|
4422
|
+
}
|
|
4423
|
+
onClose() {
|
|
4424
|
+
}
|
|
4425
|
+
onClosed() {
|
|
4426
|
+
}
|
|
4427
|
+
onRefresh() {
|
|
4428
|
+
}
|
|
4429
|
+
/**
|
|
4430
|
+
* 默认执行 close();
|
|
4431
|
+
*/
|
|
4432
|
+
onStop() {
|
|
4433
|
+
this.close();
|
|
4434
|
+
}
|
|
4435
|
+
;
|
|
4436
|
+
}
|
|
4437
|
+
|
|
4229
4438
|
class Listener {
|
|
4230
4439
|
static create(ident) {
|
|
4231
4440
|
return new Listener(ident);
|
|
@@ -6638,5 +6847,5 @@ class WidgetUtil {
|
|
|
6638
6847
|
}
|
|
6639
6848
|
var widgetutil = new WidgetUtil();
|
|
6640
6849
|
|
|
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 };
|
|
6850
|
+
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
6851
|
//# sourceMappingURL=index.esm.js.map
|