@zhongguo168a/yxeditor-common 0.0.17 → 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 +788 -811
- package/dist/index.esm.js +2907 -2952
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -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,605 +349,250 @@ declare class EventManager implements IEventManager {
|
|
|
367
349
|
*/
|
|
368
350
|
declare const eventmgr: EventManager;
|
|
369
351
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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;
|
|
352
|
+
declare class TreeIterator {
|
|
353
|
+
break(): void;
|
|
354
|
+
isBreak(): boolean;
|
|
355
|
+
protected _isBreak: any;
|
|
435
356
|
}
|
|
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;
|
|
357
|
+
interface ITreeListItem {
|
|
446
358
|
/**
|
|
447
|
-
*
|
|
448
|
-
* 例如 a/b/c,返回 a/b/c -> a/b -> a
|
|
359
|
+
* 路径
|
|
449
360
|
*/
|
|
450
|
-
|
|
451
|
-
protected static data: any;
|
|
452
|
-
static getData(route: string): Route;
|
|
453
|
-
toLoaction(): Location;
|
|
361
|
+
path: string;
|
|
454
362
|
/**
|
|
455
|
-
*
|
|
363
|
+
* 自定义数据
|
|
456
364
|
*/
|
|
457
|
-
|
|
365
|
+
data?: any;
|
|
458
366
|
/**
|
|
459
|
-
*
|
|
367
|
+
* 功能性标签,用于开发组件时,记录组件的状态。例如title, icon, 显示树的组件,需要 expanded,selected标签
|
|
460
368
|
*/
|
|
461
|
-
|
|
369
|
+
tags?: {
|
|
370
|
+
[key: string]: any;
|
|
371
|
+
};
|
|
462
372
|
/**
|
|
463
|
-
*
|
|
464
|
-
* @param params
|
|
373
|
+
* 是否树叶
|
|
465
374
|
*/
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
get
|
|
470
|
-
get params(): any;
|
|
471
|
-
get search(): string;
|
|
472
|
-
set search(value: string);
|
|
473
|
-
get name(): string;
|
|
375
|
+
isLeaf: boolean;
|
|
376
|
+
}
|
|
377
|
+
declare class TreeNode<T = any> {
|
|
378
|
+
get root(): TreeRoot;
|
|
474
379
|
/**
|
|
475
|
-
*
|
|
380
|
+
* 根节点
|
|
476
381
|
*/
|
|
477
|
-
|
|
478
|
-
private _path;
|
|
479
|
-
private _parentPath;
|
|
480
|
-
private _search;
|
|
481
|
-
private _name;
|
|
482
|
-
private _params;
|
|
483
|
-
protected _route: string;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
declare class DictIterator {
|
|
487
|
-
break(): void;
|
|
488
|
-
isBreak(): boolean;
|
|
489
|
-
protected _isBreak: any;
|
|
490
|
-
}
|
|
491
|
-
declare class Dictionary<K = string, V = any> {
|
|
492
|
-
constructor(data?: any);
|
|
493
|
-
reset(data: any): void;
|
|
494
|
-
protected _reset(data: any, size?: number): void;
|
|
495
|
-
getData(): any;
|
|
382
|
+
protected _root: TreeRoot;
|
|
496
383
|
/**
|
|
497
|
-
*
|
|
384
|
+
* 编号
|
|
498
385
|
*/
|
|
499
|
-
|
|
386
|
+
uuid: string;
|
|
500
387
|
/**
|
|
501
|
-
*
|
|
502
|
-
* @param target
|
|
388
|
+
* 编号
|
|
503
389
|
*/
|
|
504
|
-
|
|
505
|
-
resetByDict(dict: Dictionary): void;
|
|
506
|
-
onSet(caller: any, handler: (key: K, value: V) => void): void;
|
|
507
|
-
onDelete(caller: any, handler: (key: K, value: V) => void): void;
|
|
390
|
+
id: string;
|
|
508
391
|
/**
|
|
509
|
-
*
|
|
510
|
-
* @param key
|
|
511
|
-
* @param value
|
|
392
|
+
* 自定义数据
|
|
512
393
|
*/
|
|
513
|
-
|
|
514
|
-
private setData;
|
|
515
|
-
setByMap(m: any): void;
|
|
516
|
-
addDictionary(other: Dictionary<K, V>): void;
|
|
517
|
-
deleteDictionary(other: Dictionary<K, V>): void;
|
|
394
|
+
data: T;
|
|
518
395
|
/**
|
|
519
|
-
*
|
|
520
|
-
* @param key
|
|
396
|
+
* 是否树叶
|
|
521
397
|
*/
|
|
522
|
-
|
|
523
|
-
exist(key: K): boolean;
|
|
524
|
-
delete(key: K): void;
|
|
525
|
-
private deleteData;
|
|
526
|
-
exists(key: K): boolean;
|
|
527
|
-
length(): number;
|
|
528
|
-
pop(key: K): [V, boolean];
|
|
529
|
-
isEmpty(): boolean;
|
|
530
|
-
items(): V[];
|
|
531
|
-
keys(): K[];
|
|
398
|
+
isLeaf: boolean;
|
|
532
399
|
/**
|
|
533
|
-
*
|
|
534
|
-
* @param handler 可以使用【iterator】中断遍历
|
|
535
|
-
* @return iterator 获取是否中断了
|
|
400
|
+
* 功能性标签,用于开发组件时,记录组件的状态。例如title, icon, 显示树的组件,需要 expanded,selected标签
|
|
536
401
|
*/
|
|
537
|
-
|
|
402
|
+
tags: {
|
|
403
|
+
[key: string]: any;
|
|
404
|
+
};
|
|
538
405
|
/**
|
|
406
|
+
* 深度
|
|
539
407
|
*/
|
|
540
|
-
|
|
408
|
+
get depth(): number;
|
|
409
|
+
private _depth;
|
|
541
410
|
/**
|
|
542
|
-
*
|
|
411
|
+
* 父节点
|
|
543
412
|
*/
|
|
544
|
-
|
|
413
|
+
parent: TreeNode;
|
|
545
414
|
/**
|
|
546
|
-
*
|
|
547
|
-
* @param cond 可以使用【iterator】中断遍历
|
|
415
|
+
* 子节点
|
|
548
416
|
*/
|
|
549
|
-
|
|
417
|
+
children: TreeNode[];
|
|
550
418
|
/**
|
|
551
|
-
*
|
|
552
|
-
* @param
|
|
553
|
-
* @param target 存到目标对象中
|
|
419
|
+
* 设置根
|
|
420
|
+
* @param val
|
|
554
421
|
*/
|
|
555
|
-
|
|
556
|
-
|
|
422
|
+
setRoot(val: TreeRoot): void;
|
|
423
|
+
getTags(): {
|
|
557
424
|
[key: string]: any;
|
|
558
425
|
};
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
declare class List<T = any> {
|
|
573
|
-
constructor();
|
|
574
|
-
onSet(caller: any, handler: (value: T) => void): void;
|
|
575
|
-
onDelete(caller: any, handler: (value: T) => void): void;
|
|
576
|
-
firstByCondition(conf: (index: number, item: T) => boolean): [number, T];
|
|
577
|
-
lastByCondition(conf: (index: number, item: T) => boolean): [number, T];
|
|
578
|
-
forEach(handler: (index: number, item: T, iterator: ListIterator) => void): ListIterator;
|
|
426
|
+
getTag(name: string): any;
|
|
427
|
+
removeTag(name: string): void;
|
|
428
|
+
setTag(name: string, value: any): void;
|
|
429
|
+
constructor(id: string, isLeaf?: boolean);
|
|
430
|
+
addChild(val: TreeNode): void;
|
|
431
|
+
getChildIndex(val: TreeNode): number;
|
|
432
|
+
insertChild(val: TreeNode, index: number): void;
|
|
433
|
+
removeChild(val: TreeNode): void;
|
|
434
|
+
removeChildren(): void;
|
|
435
|
+
get name(): string;
|
|
436
|
+
setDepth(val: number): void;
|
|
437
|
+
containsById(id: string): boolean;
|
|
579
438
|
/**
|
|
580
|
-
*
|
|
581
|
-
* @param
|
|
582
|
-
* @param removedList 设置后,可获得被移除的项
|
|
439
|
+
* 通过编号获取子节点
|
|
440
|
+
* @param id
|
|
583
441
|
*/
|
|
584
|
-
|
|
442
|
+
getChildById(id: string): TreeNode;
|
|
585
443
|
/**
|
|
586
|
-
*
|
|
587
|
-
* @param cond 可以使用【iterator】中断遍历
|
|
588
|
-
* @param target 存到目标对象中
|
|
444
|
+
* 返回相邻的上一个节点
|
|
589
445
|
*/
|
|
590
|
-
|
|
591
|
-
pop(): T;
|
|
592
|
-
shift(): T;
|
|
593
|
-
first(): T;
|
|
594
|
-
last(): T;
|
|
595
|
-
removeAt(index: number): void;
|
|
596
|
-
remove(item: T): void;
|
|
446
|
+
prevNode(): TreeNode;
|
|
597
447
|
/**
|
|
598
|
-
*
|
|
599
|
-
* @param other
|
|
448
|
+
* 返回相邻的下一个节点
|
|
600
449
|
*/
|
|
601
|
-
|
|
602
|
-
sort(compareFn?: (a: T, b: T) => number): void;
|
|
603
|
-
reverse(): void;
|
|
604
|
-
clear(): void;
|
|
450
|
+
nextNode(): TreeNode;
|
|
605
451
|
/**
|
|
606
|
-
*
|
|
607
|
-
* @param
|
|
452
|
+
* 如果返回true则删除节点,包含当前节点
|
|
453
|
+
* @param f
|
|
608
454
|
*/
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
insertAt(index: number, ...item: T[]): void;
|
|
455
|
+
walkRemove(f: (node: TreeNode) => boolean): void;
|
|
456
|
+
private _walkRemove;
|
|
612
457
|
/**
|
|
613
|
-
*
|
|
614
|
-
* @param
|
|
458
|
+
* 如果返回true则继续,包含当前节点
|
|
459
|
+
* @param f
|
|
460
|
+
* @param inChild
|
|
615
461
|
*/
|
|
616
|
-
|
|
462
|
+
walk(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): void;
|
|
463
|
+
private _walk;
|
|
617
464
|
/**
|
|
618
|
-
*
|
|
619
|
-
* @param
|
|
465
|
+
* 从当前节点(包括)遍历父节点链,包含当前节点
|
|
466
|
+
* @param f
|
|
620
467
|
*/
|
|
621
|
-
|
|
622
|
-
at(index: number): T;
|
|
623
|
-
set(index: number, item: T): void;
|
|
624
|
-
indexOf(item: T): number;
|
|
625
|
-
has(item: T): boolean;
|
|
626
|
-
push(item: T): void;
|
|
468
|
+
walkParent(f: (node: TreeNode) => boolean): boolean;
|
|
627
469
|
/**
|
|
628
|
-
*
|
|
629
|
-
* @param
|
|
470
|
+
* 从当前节点往前遍历(深度),包含当前节点
|
|
471
|
+
* @param f
|
|
472
|
+
* @param inChild
|
|
630
473
|
*/
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
474
|
+
walkPrev(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): any;
|
|
475
|
+
private _walkPrev;
|
|
476
|
+
dump(): void;
|
|
634
477
|
/**
|
|
635
|
-
*
|
|
636
|
-
* @param count
|
|
637
|
-
* @param enableRepeat 允许重复
|
|
638
|
-
* @param target
|
|
478
|
+
* 遍历节点,查找指定编号的节点
|
|
639
479
|
*/
|
|
640
|
-
|
|
641
|
-
protected callPush(value: any): void;
|
|
642
|
-
protected callRemove(value: any): void;
|
|
643
|
-
protected _data: any[];
|
|
644
|
-
private _onSet;
|
|
645
|
-
private _onDelete;
|
|
646
|
-
private _onSetCaller;
|
|
647
|
-
private _onDeleteCaller;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
480
|
+
findById(id: string): TreeNode;
|
|
651
481
|
/**
|
|
652
|
-
*
|
|
653
|
-
* @param
|
|
482
|
+
* 如果返回true则继续
|
|
483
|
+
* @param f
|
|
654
484
|
*/
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
popObject(prefab: Prefab): any;
|
|
658
|
-
backObject(object: Node): void;
|
|
659
|
-
protected getList(key: any): List;
|
|
660
|
-
}
|
|
661
|
-
declare var uidict: UIObjectDict;
|
|
662
|
-
|
|
663
|
-
declare class ViewController {
|
|
664
|
-
constructor(name: string);
|
|
665
|
-
open(...args: any[]): void;
|
|
666
|
-
close(): void;
|
|
667
|
-
get objectDict(): UIObjectDict;
|
|
668
|
-
get name(): string;
|
|
669
|
-
protected _objectDict: UIObjectDict;
|
|
670
|
-
private _name;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
declare class PageController extends ViewController {
|
|
674
|
-
constructor(routeName: string, config?: {
|
|
675
|
-
layer?: string;
|
|
676
|
-
tags?: string[];
|
|
677
|
-
enableHistory?: boolean;
|
|
678
|
-
});
|
|
679
|
-
protected onOpening(page: Page): void;
|
|
680
|
-
protected onOpened(page: Page): void;
|
|
681
|
-
protected onClosing(page: Page): void;
|
|
682
|
-
protected onClosed(page: Page): void;
|
|
683
|
-
protected onRefresh(page: Page): void;
|
|
684
|
-
openByRoute(route: Route): Page;
|
|
685
|
-
private openPage;
|
|
686
|
-
openComplete(page: Page): void;
|
|
687
|
-
closeByRoute(route?: Route): Page;
|
|
688
|
-
private closePage;
|
|
689
|
-
closeComplete(page: Page): void;
|
|
690
|
-
refresh(): void;
|
|
691
|
-
get layer(): string;
|
|
692
|
-
hasTags(tags: string[]): boolean;
|
|
693
|
-
setLayer(name: string): this;
|
|
694
|
-
setTags(tags: string[]): this;
|
|
695
|
-
get lastPage(): Page;
|
|
696
|
-
get route(): Route;
|
|
697
|
-
get enableHistory(): boolean;
|
|
698
|
-
protected _enableHistory: boolean;
|
|
699
|
-
protected _route: Route;
|
|
700
|
-
protected _lastPage: Page;
|
|
701
|
-
protected _tags: {};
|
|
702
|
-
protected _layer: string;
|
|
703
|
-
}
|
|
704
|
-
declare class PageControllerDict extends Dictionary<string, PageController> {
|
|
705
|
-
getByName(name: string): PageController;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
declare enum PageState {
|
|
485
|
+
findOne(f: (node: TreeNode) => boolean): TreeNode;
|
|
486
|
+
private _findOne;
|
|
709
487
|
/**
|
|
710
|
-
*
|
|
488
|
+
* 通过路径获取节点
|
|
489
|
+
* 格式为 /path1/path2/...
|
|
490
|
+
* 如果 path == "/",则返回自身
|
|
491
|
+
* @param path
|
|
711
492
|
*/
|
|
712
|
-
|
|
493
|
+
getNodeByPath(path: string): TreeNode;
|
|
494
|
+
protected getNodeByPathArr(pathArr: string[]): TreeNode;
|
|
495
|
+
getName(): string;
|
|
496
|
+
getPath(): string;
|
|
713
497
|
/**
|
|
714
|
-
*
|
|
498
|
+
* 如果返回true则继续
|
|
499
|
+
* @param f
|
|
715
500
|
*/
|
|
716
|
-
|
|
501
|
+
find(f: (node: TreeNode) => boolean): TreeNode[];
|
|
502
|
+
private _find;
|
|
503
|
+
toRoot(): TreeRoot;
|
|
504
|
+
clone(): TreeNode;
|
|
505
|
+
protected cloneChildrenTo(node: TreeNode): void;
|
|
506
|
+
fixDepthAndRoot(depth: number, root: TreeRoot): void;
|
|
507
|
+
toString(): string;
|
|
508
|
+
}
|
|
509
|
+
declare class TreeRoot<NODE = any> extends EventManager {
|
|
717
510
|
/**
|
|
718
|
-
*
|
|
511
|
+
* 添加数据节点
|
|
512
|
+
* dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
|
|
719
513
|
*/
|
|
720
|
-
|
|
514
|
+
static EVENT_ADD: string;
|
|
721
515
|
/**
|
|
722
|
-
*
|
|
516
|
+
* 移除数据节点
|
|
517
|
+
* dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
|
|
723
518
|
*/
|
|
724
|
-
|
|
725
|
-
}
|
|
726
|
-
declare enum PageEvent {
|
|
727
|
-
Opening = "opening",
|
|
728
|
-
Opened = "opened",
|
|
729
|
-
Closeing = "closeing",
|
|
730
|
-
Closed = "closed",
|
|
731
|
-
Stop = "stop"
|
|
732
|
-
}
|
|
733
|
-
declare class Page extends EventManager {
|
|
734
|
-
constructor(controller: PageController, route: Route);
|
|
519
|
+
static EVENT_REMOVE: string;
|
|
735
520
|
/**
|
|
736
|
-
*
|
|
521
|
+
* 插入数据节点
|
|
522
|
+
* dispatchParams = {node:TreeNode, before:TreeNode}
|
|
737
523
|
*/
|
|
738
|
-
|
|
739
|
-
waitCloseComplete(): void;
|
|
740
|
-
openComplete(): void;
|
|
741
|
-
closeComplete(): void;
|
|
742
|
-
stop(reason: LinkError): void;
|
|
524
|
+
static EVENT_INSERT: string;
|
|
743
525
|
/**
|
|
744
|
-
*
|
|
745
|
-
*
|
|
526
|
+
* 刷新数据节点
|
|
527
|
+
* dispatchParams = {node:TreeNode}
|
|
746
528
|
*/
|
|
747
|
-
|
|
748
|
-
toString(): string;
|
|
749
|
-
get objectDict(): UIObjectDict;
|
|
750
|
-
protected _objectDict: UIObjectDict;
|
|
751
|
-
protected _waitOpenComplete: boolean;
|
|
752
|
-
protected _waitCloseComplete: boolean;
|
|
753
|
-
get controller(): PageController;
|
|
754
|
-
get route(): Route;
|
|
755
|
-
cache: {};
|
|
756
|
-
tags: {};
|
|
757
|
-
layer: string;
|
|
758
|
-
state: PageState;
|
|
759
|
-
protected _controller: PageController;
|
|
760
|
-
protected _route: Route;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
/**
|
|
764
|
-
* 视图管理器
|
|
765
|
-
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
766
|
-
*/
|
|
767
|
-
declare class PageLayer {
|
|
768
|
-
name: string;
|
|
769
|
-
constructor(name: string);
|
|
770
|
-
close(): void;
|
|
529
|
+
static EVENT_REFRESH: string;
|
|
771
530
|
/**
|
|
772
|
-
*
|
|
531
|
+
* 设置数据时触发
|
|
532
|
+
* dispatchParams = {node:TreeNode}
|
|
773
533
|
*/
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
declare class PageList extends List<Page> {
|
|
778
|
-
}
|
|
779
|
-
declare class PageRepo extends PageList {
|
|
780
|
-
constructor();
|
|
781
|
-
openByString(route: string): Page;
|
|
534
|
+
static EVENT_DATA_SET: string;
|
|
782
535
|
/**
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
* @param route
|
|
536
|
+
* 设置数据时触发
|
|
537
|
+
* dispatchParams = {node:TreeNode, tag:string, value:any}
|
|
786
538
|
*/
|
|
787
|
-
|
|
788
|
-
|
|
539
|
+
static EVENT_TAGS_SET: string;
|
|
540
|
+
static create(): TreeRoot<any>;
|
|
789
541
|
/**
|
|
790
|
-
*
|
|
791
|
-
* @param
|
|
542
|
+
* 通过列表生成一个树结构
|
|
543
|
+
* @param items
|
|
544
|
+
* @param existed 列表将添加的已经存在的树结构
|
|
792
545
|
*/
|
|
793
|
-
|
|
546
|
+
static createByList(items: ITreeListItem[], existed?: TreeRoot): TreeRoot;
|
|
547
|
+
static sortChildrenByName(node: TreeNode, des?: boolean): void;
|
|
548
|
+
constructor();
|
|
549
|
+
setNodeData(node: TreeNode, data: any): void;
|
|
550
|
+
setNodeTags(node: TreeNode, tag: string, value: any, force?: boolean): void;
|
|
551
|
+
getNodeByPath(path: string): TreeNode;
|
|
552
|
+
makeNodeByPath(path: string): TreeNode;
|
|
794
553
|
/**
|
|
795
|
-
*
|
|
554
|
+
* 添加节点,按照 node.path 添加到正确的位置
|
|
555
|
+
* @param node
|
|
556
|
+
* @param parentPath 如果父节点路径为 "", 则添加到起源节点
|
|
557
|
+
* @param autoCreateParent 如果父节点不存在,自动创建
|
|
796
558
|
*/
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
559
|
+
addNode(node: TreeNode, parentPath?: string, autoCreateParent?: boolean): void;
|
|
560
|
+
removeNode(node: TreeNode): void;
|
|
561
|
+
removeChildren(node: TreeNode): void;
|
|
562
|
+
insertNode(node: TreeNode, before: TreeNode, resetId?: boolean): void;
|
|
563
|
+
walk(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): void;
|
|
564
|
+
walkPrev(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): void;
|
|
802
565
|
/**
|
|
803
|
-
*
|
|
566
|
+
* 派发 refresh 消息
|
|
567
|
+
* @param node
|
|
804
568
|
*/
|
|
805
|
-
|
|
806
|
-
protected getOrNewLayer(name: string): PageLayer;
|
|
807
|
-
getController(route: Route): PageController;
|
|
808
|
-
registerController(ctrl: PageController): void;
|
|
809
|
-
get objectDict(): UIObjectDict;
|
|
810
|
-
protected _objectDict: UIObjectDict;
|
|
811
|
-
protected _indexLayer: {};
|
|
812
|
-
protected _indexRoute: {};
|
|
813
|
-
protected _history: Route[];
|
|
814
|
-
protected _ctrlDict: PageControllerDict;
|
|
815
|
-
}
|
|
816
|
-
declare const pagerepo: PageRepo;
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* 事件字符串分隔符
|
|
820
|
-
*/
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* 回调列表
|
|
824
|
-
*/
|
|
825
|
-
declare class CallbackList<PARAMS = any> {
|
|
826
|
-
constructor();
|
|
827
|
-
addListener(listener: Listener): void;
|
|
828
|
-
removeListener(listener: Listener): void;
|
|
829
|
-
/**
|
|
830
|
-
*/
|
|
831
|
-
create(): Listener<PARAMS>;
|
|
832
|
-
/**
|
|
833
|
-
* 如果监听器已经不存在,则创建
|
|
834
|
-
* @param ident
|
|
835
|
-
*/
|
|
836
|
-
createByIdent(ident: any): Listener<PARAMS>;
|
|
837
|
-
removeByIdent(ident: any): void;
|
|
838
|
-
removeByCaller(caller: any): void;
|
|
839
|
-
getByIdent(ident: any): Listener;
|
|
840
|
-
/**
|
|
841
|
-
* 派发事件
|
|
842
|
-
* @param params 事件参数
|
|
843
|
-
* @param subIdent
|
|
844
|
-
*/
|
|
845
|
-
dispatch(params?: PARAMS, subIdent?: string): void;
|
|
846
|
-
protected _data: List<Listener<any>>;
|
|
847
|
-
protected _indexIdent: {};
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
declare class Listener<PARAMS = any> {
|
|
851
|
-
static create(ident?: string): Listener<any>;
|
|
852
|
-
constructor(ident?: string);
|
|
853
|
-
getCaller(): any;
|
|
854
|
-
setCaller(caller: any): this;
|
|
855
|
-
setSubIdent(val: string): this;
|
|
856
|
-
setCondition(condition: (listener: Listener<PARAMS>) => boolean): this;
|
|
857
|
-
setHandler(handler: (listener: Listener<PARAMS>) => void): this;
|
|
858
|
-
setOnParams(val: any): this;
|
|
859
|
-
getIdent(): string;
|
|
860
|
-
on(): this;
|
|
861
|
-
off(): this;
|
|
862
|
-
isOn(): boolean;
|
|
863
|
-
remove(): void;
|
|
864
|
-
/**
|
|
865
|
-
* 内部使用
|
|
866
|
-
* @param params
|
|
867
|
-
* @param subIdent 子编号
|
|
868
|
-
*/
|
|
869
|
-
_dispatch(params: PARAMS, subIdent?: string): void;
|
|
870
|
-
getOnParams(): any;
|
|
871
|
-
getParams(): PARAMS;
|
|
872
|
-
protected onParams: any;
|
|
873
|
-
protected params: PARAMS;
|
|
874
|
-
protected ident: string;
|
|
875
|
-
protected _subIdent: string;
|
|
876
|
-
protected source: CallbackList;
|
|
877
|
-
protected _handler: (any: any) => void;
|
|
878
|
-
protected _condition: (any: any) => boolean;
|
|
879
|
-
protected caller: any;
|
|
880
|
-
protected _isOn: boolean;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* 事件字符串分隔符
|
|
885
|
-
*/
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* 事件派发器
|
|
889
|
-
*/
|
|
890
|
-
declare class Dispatcher implements ISchedulable {
|
|
891
|
-
constructor(name?: string);
|
|
892
|
-
dispose(): void;
|
|
893
|
-
create(type: string, listener: Listener): void;
|
|
894
|
-
remove(type: string, listener: Listener): void;
|
|
895
|
-
getByIdent(type: string, ident: string): Listener;
|
|
896
|
-
/**
|
|
897
|
-
* @param type
|
|
898
|
-
* @param ident
|
|
899
|
-
*/
|
|
900
|
-
createByIdent(type: string, ident: string): Listener;
|
|
901
|
-
/**
|
|
902
|
-
* 派发事件
|
|
903
|
-
* @param eventType 事件类型
|
|
904
|
-
* @param params 事件参数
|
|
905
|
-
*/
|
|
906
|
-
dispatch(eventType: string, params?: any): void;
|
|
907
|
-
protected getList(type: string): CallbackList;
|
|
908
|
-
id?: string;
|
|
909
|
-
uuid?: string;
|
|
910
|
-
name: string;
|
|
911
|
-
protected isDispose: boolean;
|
|
912
|
-
protected typeToList: Dictionary<string, CallbackList<any>>;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
declare class CallbackItem {
|
|
916
|
-
listener: Function;
|
|
917
|
-
caller: any;
|
|
918
|
-
once: boolean;
|
|
919
|
-
}
|
|
920
|
-
declare class SampleCallbackList {
|
|
921
|
-
constructor();
|
|
922
|
-
dispose(): void;
|
|
923
|
-
has(caller: any, listener: Function): boolean;
|
|
924
|
-
protected getItem(caller: any, listener: Function): CallbackItem;
|
|
569
|
+
refresh(node: TreeNode): void;
|
|
925
570
|
/**
|
|
926
|
-
*
|
|
927
|
-
*
|
|
928
|
-
*
|
|
571
|
+
* 克隆当前的树结
|
|
572
|
+
* * 新的tags克隆旧的data
|
|
573
|
+
* * 新的data指向旧的data
|
|
929
574
|
*/
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
off(caller: any, listener: Function): void;
|
|
934
|
-
offAll(type?: string): void;
|
|
935
|
-
offAllCaller(caller: any): void;
|
|
575
|
+
clone(): TreeRoot;
|
|
576
|
+
toString(): string;
|
|
577
|
+
createNode(id: string, isLeaf?: boolean): TreeNode;
|
|
936
578
|
/**
|
|
937
|
-
*
|
|
938
|
-
* @param params 事件参数
|
|
579
|
+
* origin的第一个child
|
|
939
580
|
*/
|
|
940
|
-
|
|
941
|
-
|
|
581
|
+
get firstNode(): TreeNode;
|
|
582
|
+
origin: TreeNode;
|
|
942
583
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
name: string;
|
|
946
|
-
constructor(name: string);
|
|
947
|
-
loadType: number;
|
|
948
|
-
uuid: string;
|
|
949
|
-
path: string;
|
|
950
|
-
bundle: string;
|
|
584
|
+
declare class TreeRootPlugin {
|
|
585
|
+
root: TreeRoot;
|
|
951
586
|
}
|
|
952
|
-
declare class
|
|
953
|
-
|
|
954
|
-
getAssetByUUID(uuid: string): any;
|
|
955
|
-
getRoot(): AssetManager;
|
|
587
|
+
declare class TreeNodePlugin {
|
|
588
|
+
node: TreeNode;
|
|
956
589
|
}
|
|
957
|
-
declare let assetx: XAssetManager;
|
|
958
590
|
|
|
959
|
-
|
|
960
|
-
break(): void;
|
|
961
|
-
isBreak(): boolean;
|
|
962
|
-
protected _isBreak: any;
|
|
963
|
-
}
|
|
964
|
-
interface ITreeListItem {
|
|
591
|
+
interface IListItem {
|
|
965
592
|
/**
|
|
966
|
-
*
|
|
593
|
+
* 编号
|
|
967
594
|
*/
|
|
968
|
-
|
|
595
|
+
id: string;
|
|
969
596
|
/**
|
|
970
597
|
* 自定义数据
|
|
971
598
|
*/
|
|
@@ -976,245 +603,182 @@ interface ITreeListItem {
|
|
|
976
603
|
tags?: {
|
|
977
604
|
[key: string]: any;
|
|
978
605
|
};
|
|
979
|
-
/**
|
|
980
|
-
* 是否树叶
|
|
981
|
-
*/
|
|
982
|
-
isLeaf: boolean;
|
|
983
606
|
}
|
|
984
|
-
declare class
|
|
985
|
-
|
|
607
|
+
declare class ListNode {
|
|
608
|
+
static create(id: string, data?: any): ListNode;
|
|
609
|
+
constructor();
|
|
610
|
+
root: ListSource;
|
|
611
|
+
uuid: string;
|
|
612
|
+
id: string;
|
|
613
|
+
data: any;
|
|
614
|
+
tags: {};
|
|
615
|
+
getTags(): {
|
|
616
|
+
[key: string]: any;
|
|
617
|
+
};
|
|
618
|
+
setTags(tags: {
|
|
619
|
+
[key: string]: any;
|
|
620
|
+
}): void;
|
|
621
|
+
getTag(name: string): any;
|
|
622
|
+
setTag(name: string, value: any): void;
|
|
623
|
+
}
|
|
624
|
+
declare class ListSource extends EventManager {
|
|
986
625
|
/**
|
|
987
|
-
*
|
|
626
|
+
* 通过数组创建 ListSource。ListSource的id自动生成。如果需要指定编号,可设置 idCreator
|
|
627
|
+
* @param arr
|
|
628
|
+
* @param idCreator
|
|
988
629
|
*/
|
|
989
|
-
|
|
630
|
+
static createByArray(arr: any[], idCreator?: (item: any) => string): ListSource;
|
|
631
|
+
static createByListItem(arr: IListItem[], target?: ListSource): any;
|
|
990
632
|
/**
|
|
991
|
-
*
|
|
633
|
+
* 设置数据时触发
|
|
634
|
+
* dispatchParams = {node:ListNode}
|
|
992
635
|
*/
|
|
993
|
-
|
|
636
|
+
static EVENT_ADD: string;
|
|
994
637
|
/**
|
|
995
|
-
*
|
|
638
|
+
* 设置数据时触发
|
|
639
|
+
* dispatchParams = {node:ListNode, index:number}
|
|
996
640
|
*/
|
|
997
|
-
|
|
641
|
+
static EVENT_REMOVE: string;
|
|
998
642
|
/**
|
|
999
|
-
*
|
|
643
|
+
* 设置数据时触发
|
|
1000
644
|
*/
|
|
1001
|
-
|
|
645
|
+
static EVENT_REMOVE_ALL: string;
|
|
1002
646
|
/**
|
|
1003
|
-
*
|
|
647
|
+
* 刷新数据节点
|
|
648
|
+
* dispatchParams = {node:ListNode}
|
|
1004
649
|
*/
|
|
1005
|
-
|
|
650
|
+
static EVENT_REFRESH: string;
|
|
1006
651
|
/**
|
|
1007
|
-
*
|
|
652
|
+
* 设置数据时触发
|
|
653
|
+
* dispatchParams = nodes: [ListNode], indexs: [number]
|
|
1008
654
|
*/
|
|
1009
|
-
|
|
1010
|
-
[key: string]: any;
|
|
1011
|
-
};
|
|
655
|
+
static EVENT_SWAP: string;
|
|
1012
656
|
/**
|
|
1013
|
-
*
|
|
657
|
+
* 设置数据时触发
|
|
658
|
+
* dispatchParams = {node:ListNode, data:any}
|
|
1014
659
|
*/
|
|
1015
|
-
|
|
1016
|
-
private _depth;
|
|
660
|
+
static EVENT_DATA_SET: string;
|
|
1017
661
|
/**
|
|
1018
|
-
*
|
|
662
|
+
* 设置数据时触发
|
|
663
|
+
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
1019
664
|
*/
|
|
1020
|
-
|
|
665
|
+
static EVENT_TAGS_SET: string;
|
|
666
|
+
protected _identFunc: (node: ListNode) => boolean;
|
|
667
|
+
at(index: number): ListNode;
|
|
668
|
+
first(): ListNode;
|
|
669
|
+
last(): ListNode;
|
|
670
|
+
length(): number;
|
|
1021
671
|
/**
|
|
1022
|
-
*
|
|
672
|
+
* 添加项,无法添加相同的项
|
|
673
|
+
* @param node
|
|
674
|
+
* @param enableDispatch 默认为true
|
|
1023
675
|
*/
|
|
1024
|
-
|
|
676
|
+
add(node: ListNode, enableDispatch?: boolean): void;
|
|
677
|
+
getById(id: string): ListNode;
|
|
678
|
+
remove(node: ListNode): void;
|
|
679
|
+
removeAll(): void;
|
|
680
|
+
swap(a: ListNode, b: ListNode): void;
|
|
681
|
+
contains(node: ListNode): boolean;
|
|
682
|
+
containsById(id: string): boolean;
|
|
683
|
+
indexOf(node: ListNode): number;
|
|
684
|
+
indexOfById(id: string): number;
|
|
685
|
+
setData(node: ListNode, data: any): void;
|
|
686
|
+
setNodeTags(node: ListNode, tag: string, value: any): void;
|
|
1025
687
|
/**
|
|
1026
|
-
*
|
|
1027
|
-
* @param
|
|
1028
|
-
*/
|
|
1029
|
-
setRoot(val: TreeRoot): void;
|
|
1030
|
-
getTags(): {
|
|
1031
|
-
[key: string]: any;
|
|
1032
|
-
};
|
|
1033
|
-
getTag(name: string): any;
|
|
1034
|
-
removeTag(name: string): void;
|
|
1035
|
-
setTag(name: string, value: any): void;
|
|
1036
|
-
constructor(id: string, isLeaf?: boolean);
|
|
1037
|
-
addChild(val: TreeNode): void;
|
|
1038
|
-
getChildIndex(val: TreeNode): number;
|
|
1039
|
-
insertChild(val: TreeNode, index: number): void;
|
|
1040
|
-
removeChild(val: TreeNode): void;
|
|
1041
|
-
removeChildren(): void;
|
|
1042
|
-
get name(): string;
|
|
1043
|
-
setDepth(val: number): void;
|
|
1044
|
-
containsById(id: string): boolean;
|
|
1045
|
-
/**
|
|
1046
|
-
* 通过编号获取子节点
|
|
1047
|
-
* @param id
|
|
1048
|
-
*/
|
|
1049
|
-
getChildById(id: string): TreeNode;
|
|
1050
|
-
/**
|
|
1051
|
-
* 返回相邻的上一个节点
|
|
1052
|
-
*/
|
|
1053
|
-
prevNode(): TreeNode;
|
|
1054
|
-
/**
|
|
1055
|
-
* 返回相邻的下一个节点
|
|
1056
|
-
*/
|
|
1057
|
-
nextNode(): TreeNode;
|
|
1058
|
-
/**
|
|
1059
|
-
* 如果返回true则删除节点,包含当前节点
|
|
1060
|
-
* @param f
|
|
1061
|
-
*/
|
|
1062
|
-
walkRemove(f: (node: TreeNode) => boolean): void;
|
|
1063
|
-
private _walkRemove;
|
|
1064
|
-
/**
|
|
1065
|
-
* 如果返回true则继续,包含当前节点
|
|
1066
|
-
* @param f
|
|
1067
|
-
* @param inChild
|
|
1068
|
-
*/
|
|
1069
|
-
walk(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): void;
|
|
1070
|
-
private _walk;
|
|
1071
|
-
/**
|
|
1072
|
-
* 从当前节点(包括)遍历父节点链,包含当前节点
|
|
1073
|
-
* @param f
|
|
1074
|
-
*/
|
|
1075
|
-
walkParent(f: (node: TreeNode) => boolean): boolean;
|
|
1076
|
-
/**
|
|
1077
|
-
* 从当前节点往前遍历(深度),包含当前节点
|
|
1078
|
-
* @param f
|
|
1079
|
-
* @param inChild
|
|
1080
|
-
*/
|
|
1081
|
-
walkPrev(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): any;
|
|
1082
|
-
private _walkPrev;
|
|
1083
|
-
dump(): void;
|
|
1084
|
-
/**
|
|
1085
|
-
* 遍历节点,查找指定编号的节点
|
|
1086
|
-
*/
|
|
1087
|
-
findById(id: string): TreeNode;
|
|
1088
|
-
/**
|
|
1089
|
-
* 如果返回true则继续
|
|
1090
|
-
* @param f
|
|
1091
|
-
*/
|
|
1092
|
-
findOne(f: (node: TreeNode) => boolean): TreeNode;
|
|
1093
|
-
private _findOne;
|
|
1094
|
-
/**
|
|
1095
|
-
* 通过路径获取节点
|
|
1096
|
-
* 格式为 /path1/path2/...
|
|
1097
|
-
* 如果 path == "/",则返回自身
|
|
1098
|
-
* @param path
|
|
1099
|
-
*/
|
|
1100
|
-
getNodeByPath(path: string): TreeNode;
|
|
1101
|
-
protected getNodeByPathArr(pathArr: string[]): TreeNode;
|
|
1102
|
-
getName(): string;
|
|
1103
|
-
getPath(): string;
|
|
1104
|
-
/**
|
|
1105
|
-
* 如果返回true则继续
|
|
1106
|
-
* @param f
|
|
688
|
+
* 派发 refresh 消息
|
|
689
|
+
* @param node
|
|
1107
690
|
*/
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
fixDepthAndRoot(depth: number, root: TreeRoot): void;
|
|
1114
|
-
toString(): string;
|
|
691
|
+
refresh(node: ListNode): void;
|
|
692
|
+
walk(f: (node: ListNode) => boolean): boolean;
|
|
693
|
+
walkPrev(node: ListNode, f: (node: ListNode) => boolean): boolean;
|
|
694
|
+
get data(): any[];
|
|
695
|
+
private _data;
|
|
1115
696
|
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
/**
|
|
1128
|
-
* 插入数据节点
|
|
1129
|
-
* dispatchParams = {node:TreeNode, before:TreeNode}
|
|
1130
|
-
*/
|
|
1131
|
-
static EVENT_INSERT: string;
|
|
1132
|
-
/**
|
|
1133
|
-
* 刷新数据节点
|
|
1134
|
-
* dispatchParams = {node:TreeNode}
|
|
1135
|
-
*/
|
|
1136
|
-
static EVENT_REFRESH: string;
|
|
1137
|
-
/**
|
|
1138
|
-
* 设置数据时触发
|
|
1139
|
-
* dispatchParams = {node:TreeNode}
|
|
1140
|
-
*/
|
|
1141
|
-
static EVENT_DATA_SET: string;
|
|
697
|
+
|
|
698
|
+
declare class DictIterator {
|
|
699
|
+
break(): void;
|
|
700
|
+
isBreak(): boolean;
|
|
701
|
+
protected _isBreak: any;
|
|
702
|
+
}
|
|
703
|
+
declare class Dictionary<K = string, V = any> {
|
|
704
|
+
constructor(data?: any);
|
|
705
|
+
reset(data: any): void;
|
|
706
|
+
protected _reset(data: any, size?: number): void;
|
|
707
|
+
getData(): any;
|
|
1142
708
|
/**
|
|
1143
|
-
*
|
|
1144
|
-
* dispatchParams = {node:TreeNode, tag:string, value:any}
|
|
709
|
+
* 如果使用了 onSet or onDelete,需要注意清理
|
|
1145
710
|
*/
|
|
1146
|
-
|
|
1147
|
-
static create(): TreeRoot<any>;
|
|
711
|
+
clear(): void;
|
|
1148
712
|
/**
|
|
1149
|
-
*
|
|
1150
|
-
* @param
|
|
1151
|
-
* @param existed 列表将添加的已经存在的树结构
|
|
713
|
+
* 克隆自身所有项到【target】对象,并返回【target】对象
|
|
714
|
+
* @param target
|
|
1152
715
|
*/
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
setNodeTags(node: TreeNode, tag: string, value: any, force?: boolean): void;
|
|
1158
|
-
getNodeByPath(path: string): TreeNode;
|
|
1159
|
-
makeNodeByPath(path: string): TreeNode;
|
|
716
|
+
clone(target: this): this;
|
|
717
|
+
resetByDict(dict: Dictionary): void;
|
|
718
|
+
onSet(caller: any, handler: (key: K, value: V) => void): void;
|
|
719
|
+
onDelete(caller: any, handler: (key: K, value: V) => void): void;
|
|
1160
720
|
/**
|
|
1161
|
-
*
|
|
1162
|
-
* @param
|
|
1163
|
-
* @param
|
|
1164
|
-
* @param autoCreateParent 如果父节点不存在,自动创建
|
|
721
|
+
* 设置键值对,如果没有发生变化,不会触发onSet函数
|
|
722
|
+
* @param key
|
|
723
|
+
* @param value
|
|
1165
724
|
*/
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
walkPrev(f: (node: TreeNode) => boolean, inChild?: (node: TreeNode) => boolean): void;
|
|
725
|
+
set(key: K, value: V): void;
|
|
726
|
+
private setData;
|
|
727
|
+
setByMap(m: any): void;
|
|
728
|
+
addDictionary(other: Dictionary<K, V>): void;
|
|
729
|
+
deleteDictionary(other: Dictionary<K, V>): void;
|
|
1172
730
|
/**
|
|
1173
|
-
*
|
|
1174
|
-
* @param
|
|
731
|
+
* 如果不存在,返回 undefined
|
|
732
|
+
* @param key
|
|
1175
733
|
*/
|
|
1176
|
-
|
|
734
|
+
get(key: K): V;
|
|
735
|
+
exist(key: K): boolean;
|
|
736
|
+
delete(key: K): void;
|
|
737
|
+
private deleteData;
|
|
738
|
+
exists(key: K): boolean;
|
|
739
|
+
length(): number;
|
|
740
|
+
pop(key: K): [V, boolean];
|
|
741
|
+
isEmpty(): boolean;
|
|
742
|
+
items(): V[];
|
|
743
|
+
keys(): K[];
|
|
1177
744
|
/**
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1180
|
-
*
|
|
745
|
+
*
|
|
746
|
+
* @param handler 可以使用【iterator】中断遍历
|
|
747
|
+
* @return iterator 获取是否中断了
|
|
1181
748
|
*/
|
|
1182
|
-
|
|
1183
|
-
toString(): string;
|
|
1184
|
-
createNode(id: string, isLeaf?: boolean): TreeNode;
|
|
749
|
+
forEach(handler: (key: K, val: V, iterator: DictIterator) => void): DictIterator;
|
|
1185
750
|
/**
|
|
1186
|
-
* origin的第一个child
|
|
1187
751
|
*/
|
|
1188
|
-
|
|
1189
|
-
origin: TreeNode;
|
|
1190
|
-
}
|
|
1191
|
-
declare class TreeRootPlugin {
|
|
1192
|
-
root: TreeRoot;
|
|
1193
|
-
}
|
|
1194
|
-
declare class TreeNodePlugin {
|
|
1195
|
-
node: TreeNode;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
interface IListItem {
|
|
752
|
+
first(): V | undefined;
|
|
1199
753
|
/**
|
|
1200
|
-
*
|
|
754
|
+
* @param handler 返回true结束迭代
|
|
1201
755
|
*/
|
|
1202
|
-
|
|
756
|
+
firstByCondition(handler: (key: K, val: V) => boolean): V | undefined;
|
|
1203
757
|
/**
|
|
1204
|
-
*
|
|
758
|
+
* 移除符合条件的项
|
|
759
|
+
* @param cond 可以使用【iterator】中断遍历
|
|
1205
760
|
*/
|
|
1206
|
-
|
|
761
|
+
removeByCondition(cond: (key: K, val: V, iterator: DictIterator) => boolean): void;
|
|
1207
762
|
/**
|
|
1208
|
-
*
|
|
763
|
+
* 查找符合条件的项保存到【target】对象中,并返回【target】对象
|
|
764
|
+
* @param cond 可以使用【iterator】中断遍历
|
|
765
|
+
* @param target 存到目标对象中
|
|
1209
766
|
*/
|
|
1210
|
-
|
|
767
|
+
findByCondition(cond: (key: K, val: V, iterator: DictIterator) => boolean, target: Dictionary): this;
|
|
768
|
+
groupByCondition(createKey: (key: K, val: V) => string, ITEM_CLASS?: any): {
|
|
1211
769
|
[key: string]: any;
|
|
1212
770
|
};
|
|
771
|
+
protected size: number;
|
|
772
|
+
private _data;
|
|
773
|
+
private _onSet;
|
|
774
|
+
private _onDelete;
|
|
775
|
+
private _onSetCaller;
|
|
776
|
+
private _onDeleteCaller;
|
|
1213
777
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
778
|
+
|
|
779
|
+
declare class DictNode {
|
|
780
|
+
static create(id: string, data?: any): DictNode;
|
|
1216
781
|
constructor();
|
|
1217
|
-
root: ListSource;
|
|
1218
782
|
uuid: string;
|
|
1219
783
|
id: string;
|
|
1220
784
|
data: any;
|
|
@@ -1222,120 +786,533 @@ declare class ListNode {
|
|
|
1222
786
|
getTags(): {
|
|
1223
787
|
[key: string]: any;
|
|
1224
788
|
};
|
|
1225
|
-
setTags(tags: {
|
|
1226
|
-
[key: string]: any;
|
|
1227
|
-
}): void;
|
|
1228
789
|
getTag(name: string): any;
|
|
1229
790
|
setTag(name: string, value: any): void;
|
|
1230
|
-
}
|
|
1231
|
-
declare class ListSource extends EventManager {
|
|
1232
791
|
/**
|
|
1233
|
-
*
|
|
1234
|
-
* @param arr
|
|
1235
|
-
* @param idCreator
|
|
792
|
+
* 清理【data】和【tags】
|
|
1236
793
|
*/
|
|
1237
|
-
|
|
1238
|
-
|
|
794
|
+
clean(): void;
|
|
795
|
+
}
|
|
796
|
+
declare class DictSource extends Dictionary<string, DictNode> {
|
|
1239
797
|
/**
|
|
1240
|
-
*
|
|
798
|
+
* 刷新数据节点
|
|
1241
799
|
* dispatchParams = {node:ListNode}
|
|
1242
800
|
*/
|
|
1243
|
-
static
|
|
801
|
+
static EVENT_REFRESH: string;
|
|
1244
802
|
/**
|
|
1245
803
|
* 设置数据时触发
|
|
1246
|
-
* dispatchParams = {node:ListNode,
|
|
804
|
+
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
1247
805
|
*/
|
|
1248
|
-
static
|
|
806
|
+
static EVENT_TAGS_SET: string;
|
|
807
|
+
setNodeTags(node: DictNode, tag: string, value: any): void;
|
|
808
|
+
refreshNode(node: DictNode): void;
|
|
809
|
+
get dispatcher(): EventManager;
|
|
810
|
+
protected _dispatcher: EventManager;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
declare class ListIterator {
|
|
814
|
+
break(): void;
|
|
815
|
+
isBreak(): boolean;
|
|
816
|
+
protected _isBreak: any;
|
|
817
|
+
}
|
|
818
|
+
declare class List<T = any> {
|
|
819
|
+
constructor();
|
|
820
|
+
onSet(caller: any, handler: (value: T) => void): void;
|
|
821
|
+
onDelete(caller: any, handler: (value: T) => void): void;
|
|
822
|
+
firstByCondition(conf: (index: number, item: T) => boolean): [number, T];
|
|
823
|
+
lastByCondition(conf: (index: number, item: T) => boolean): [number, T];
|
|
824
|
+
forEach(handler: (index: number, item: T, iterator: ListIterator) => void): ListIterator;
|
|
1249
825
|
/**
|
|
1250
|
-
*
|
|
826
|
+
* 移除符合条件的项, 从后往前遍历
|
|
827
|
+
* @param cond 可以使用【iterator】中断遍历
|
|
828
|
+
* @param removedList 设置后,可获得被移除的项
|
|
1251
829
|
*/
|
|
1252
|
-
|
|
830
|
+
removeByCondition(cond: (index: number, val: T, iterator: ListIterator) => boolean, removedList?: List): this;
|
|
1253
831
|
/**
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
832
|
+
* 查找符合条件的项保存到【target】对象中,并返回【target】对象
|
|
833
|
+
* @param cond 可以使用【iterator】中断遍历
|
|
834
|
+
* @param target 存到目标对象中
|
|
1256
835
|
*/
|
|
1257
|
-
|
|
836
|
+
findByCondition(cond: (index: number, val: T, iterator: ListIterator) => boolean, target: List): this;
|
|
837
|
+
pop(): T;
|
|
838
|
+
shift(): T;
|
|
839
|
+
first(): T;
|
|
840
|
+
last(): T;
|
|
841
|
+
removeAt(index: number): void;
|
|
842
|
+
remove(item: T): void;
|
|
1258
843
|
/**
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
844
|
+
* 把【other】的项合并到自身
|
|
845
|
+
* @param other
|
|
1261
846
|
*/
|
|
1262
|
-
|
|
847
|
+
removeList(other: List<T>): void;
|
|
848
|
+
sort(compareFn?: (a: T, b: T) => number): void;
|
|
849
|
+
reverse(): void;
|
|
850
|
+
clear(): void;
|
|
1263
851
|
/**
|
|
1264
|
-
*
|
|
1265
|
-
*
|
|
852
|
+
* 克隆自身所有项到【target】对象,并返回【target】对象
|
|
853
|
+
* @param target
|
|
1266
854
|
*/
|
|
1267
|
-
|
|
855
|
+
clone(target: this): this;
|
|
856
|
+
get length(): number;
|
|
857
|
+
insertAt(index: number, ...item: T[]): void;
|
|
1268
858
|
/**
|
|
1269
|
-
*
|
|
1270
|
-
*
|
|
859
|
+
* @param beforeItem
|
|
860
|
+
* @param item
|
|
1271
861
|
*/
|
|
1272
|
-
|
|
1273
|
-
protected _identFunc: (node: ListNode) => boolean;
|
|
1274
|
-
at(index: number): ListNode;
|
|
1275
|
-
first(): ListNode;
|
|
1276
|
-
last(): ListNode;
|
|
1277
|
-
length(): number;
|
|
862
|
+
insertBefore(beforeItem: T, ...item: T[]): void;
|
|
1278
863
|
/**
|
|
1279
|
-
*
|
|
1280
|
-
* @param
|
|
1281
|
-
* @param enableDispatch 默认为true
|
|
864
|
+
* @param afterItem
|
|
865
|
+
* @param item
|
|
1282
866
|
*/
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
containsById(id: string): boolean;
|
|
1290
|
-
indexOf(node: ListNode): number;
|
|
1291
|
-
indexOfById(id: string): number;
|
|
1292
|
-
setData(node: ListNode, data: any): void;
|
|
1293
|
-
setNodeTags(node: ListNode, tag: string, value: any): void;
|
|
867
|
+
insertAfter(afterItem: T, ...item: T[]): void;
|
|
868
|
+
at(index: number): T;
|
|
869
|
+
set(index: number, item: T): void;
|
|
870
|
+
indexOf(item: T): number;
|
|
871
|
+
has(item: T): boolean;
|
|
872
|
+
push(item: T): void;
|
|
1294
873
|
/**
|
|
1295
|
-
*
|
|
1296
|
-
* @param
|
|
874
|
+
* 把【other】的项合并到自身
|
|
875
|
+
* @param other
|
|
1297
876
|
*/
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
877
|
+
pushList(other: List<T>): void;
|
|
878
|
+
getData(): T[];
|
|
879
|
+
resetData(val: T[]): void;
|
|
880
|
+
/**
|
|
881
|
+
* 随机获取【count】个项,并返回【target】对象
|
|
882
|
+
* @param count
|
|
883
|
+
* @param enableRepeat 允许重复
|
|
884
|
+
* @param target
|
|
885
|
+
*/
|
|
886
|
+
random(count: number, enableRepeat?: boolean, target?: List<T>): List<T>;
|
|
887
|
+
protected callPush(value: any): void;
|
|
888
|
+
protected callRemove(value: any): void;
|
|
889
|
+
protected _data: any[];
|
|
890
|
+
private _onSet;
|
|
891
|
+
private _onDelete;
|
|
892
|
+
private _onSetCaller;
|
|
893
|
+
private _onDeleteCaller;
|
|
1303
894
|
}
|
|
1304
895
|
|
|
1305
|
-
|
|
1306
|
-
|
|
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> {
|
|
1307
922
|
constructor();
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
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;
|
|
1314
957
|
};
|
|
1315
|
-
|
|
1316
|
-
|
|
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;
|
|
1317
976
|
/**
|
|
1318
|
-
*
|
|
977
|
+
* 获取调用链
|
|
978
|
+
* 例如 a/b/c,返回 a/b/c -> a/b -> a
|
|
1319
979
|
*/
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
980
|
+
getLink(): Route[];
|
|
981
|
+
protected static data: any;
|
|
982
|
+
static getData(route: string): Route;
|
|
983
|
+
toLoaction(): Location;
|
|
1323
984
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
* dispatchParams = {node:ListNode}
|
|
985
|
+
* @constructor
|
|
1326
986
|
*/
|
|
1327
|
-
|
|
987
|
+
NewRoute(): Route;
|
|
1328
988
|
/**
|
|
1329
|
-
*
|
|
1330
|
-
* dispatchParams = {node:ListNode, tag:string, value:any}
|
|
989
|
+
* @constructor
|
|
1331
990
|
*/
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
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;
|
|
1337
1014
|
}
|
|
1338
1015
|
|
|
1016
|
+
declare class UIObjectDict extends Dictionary<string, any | List> {
|
|
1017
|
+
/**
|
|
1018
|
+
* 获取唯一的
|
|
1019
|
+
* @param prefab
|
|
1020
|
+
*/
|
|
1021
|
+
uniqueObject(prefab: Prefab): Node;
|
|
1022
|
+
removeObject(prefab: Prefab): void;
|
|
1023
|
+
popObject(prefab: Prefab): any;
|
|
1024
|
+
backObject(object: Node): void;
|
|
1025
|
+
protected getList(key: any): List;
|
|
1026
|
+
}
|
|
1027
|
+
declare var uidict: UIObjectDict;
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* 视图管理器
|
|
1031
|
+
* 打开一个视图的时候,可能会听过加载资源,读取数据,调整布局,切换特效等处理,所以使用视图模式封装视图打开关闭的逻辑
|
|
1032
|
+
*/
|
|
1033
|
+
declare class PageLayer {
|
|
1034
|
+
name: string;
|
|
1035
|
+
constructor(name: string);
|
|
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;
|
|
1075
|
+
get objectDict(): UIObjectDict;
|
|
1076
|
+
protected _objectDict: UIObjectDict;
|
|
1077
|
+
protected _indexLayer: {};
|
|
1078
|
+
protected _indexRoute: {};
|
|
1079
|
+
protected _history: Route[];
|
|
1080
|
+
protected _ctrlDict: ControllerDict;
|
|
1081
|
+
protected _module: IModule;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
declare class PageController extends Controller {
|
|
1085
|
+
constructor(routeName: string, config?: {
|
|
1086
|
+
layer?: string;
|
|
1087
|
+
tags?: string[];
|
|
1088
|
+
enableHistory?: boolean;
|
|
1089
|
+
});
|
|
1090
|
+
init(module: IModule, pageRepo: PageRepo): void;
|
|
1091
|
+
open(...args: any[]): void;
|
|
1092
|
+
close(): void;
|
|
1093
|
+
protected onOpening(page: Page): void;
|
|
1094
|
+
protected onOpened(page: Page): void;
|
|
1095
|
+
protected onClosing(page: Page): void;
|
|
1096
|
+
protected onClosed(page: Page): void;
|
|
1097
|
+
protected onRefresh(page: Page): void;
|
|
1098
|
+
openByRoute(route: Route): Page;
|
|
1099
|
+
private openPage;
|
|
1100
|
+
openComplete(page: Page): void;
|
|
1101
|
+
closeByRoute(route?: Route): Page;
|
|
1102
|
+
private closePage;
|
|
1103
|
+
closeComplete(page: Page): void;
|
|
1104
|
+
refresh(): void;
|
|
1105
|
+
get layer(): string;
|
|
1106
|
+
hasTags(tags: string[]): boolean;
|
|
1107
|
+
setLayer(name: string): this;
|
|
1108
|
+
setTags(tags: string[]): this;
|
|
1109
|
+
get lastPage(): Page;
|
|
1110
|
+
get route(): Route;
|
|
1111
|
+
get enableHistory(): boolean;
|
|
1112
|
+
protected _enableHistory: boolean;
|
|
1113
|
+
protected _route: Route;
|
|
1114
|
+
protected _lastPage: Page;
|
|
1115
|
+
protected _tags: {};
|
|
1116
|
+
protected _layer: string;
|
|
1117
|
+
protected _pagerepo: PageRepo;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
declare enum PageState {
|
|
1121
|
+
/**
|
|
1122
|
+
* 关闭
|
|
1123
|
+
*/
|
|
1124
|
+
Closed = 0,
|
|
1125
|
+
/**
|
|
1126
|
+
* 正在打开
|
|
1127
|
+
*/
|
|
1128
|
+
Opening = 1,
|
|
1129
|
+
/**
|
|
1130
|
+
* 已打开
|
|
1131
|
+
*/
|
|
1132
|
+
Opened = 2,
|
|
1133
|
+
/**
|
|
1134
|
+
* 正在关闭
|
|
1135
|
+
*/
|
|
1136
|
+
Closeing = 3
|
|
1137
|
+
}
|
|
1138
|
+
declare enum PageEvent {
|
|
1139
|
+
Opening = "opening",
|
|
1140
|
+
Opened = "opened",
|
|
1141
|
+
Closeing = "closeing",
|
|
1142
|
+
Closed = "closed",
|
|
1143
|
+
Stop = "stop"
|
|
1144
|
+
}
|
|
1145
|
+
declare class Page extends EventManager {
|
|
1146
|
+
constructor(controller: PageController, route: Route);
|
|
1147
|
+
/**
|
|
1148
|
+
* 等待打开完成指令
|
|
1149
|
+
*/
|
|
1150
|
+
waitOpenComplete(): void;
|
|
1151
|
+
waitCloseComplete(): void;
|
|
1152
|
+
openComplete(): void;
|
|
1153
|
+
closeComplete(): void;
|
|
1154
|
+
stop(reason: LinkError): void;
|
|
1155
|
+
/**
|
|
1156
|
+
* 等待发送的结果
|
|
1157
|
+
* 如果返回 null,表示主动取消 [cancel]
|
|
1158
|
+
*/
|
|
1159
|
+
wait(): Promise<this>;
|
|
1160
|
+
toString(): string;
|
|
1161
|
+
get objectDict(): UIObjectDict;
|
|
1162
|
+
protected _objectDict: UIObjectDict;
|
|
1163
|
+
protected _waitOpenComplete: boolean;
|
|
1164
|
+
protected _waitCloseComplete: boolean;
|
|
1165
|
+
get controller(): PageController;
|
|
1166
|
+
get route(): Route;
|
|
1167
|
+
cache: {};
|
|
1168
|
+
tags: {};
|
|
1169
|
+
layer: string;
|
|
1170
|
+
state: PageState;
|
|
1171
|
+
protected _controller: PageController;
|
|
1172
|
+
protected _route: Route;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
/**
|
|
1176
|
+
* 事件字符串分隔符
|
|
1177
|
+
*/
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* 回调列表
|
|
1181
|
+
*/
|
|
1182
|
+
declare class CallbackList<PARAMS = any> {
|
|
1183
|
+
constructor();
|
|
1184
|
+
addListener(listener: Listener): void;
|
|
1185
|
+
removeListener(listener: Listener): void;
|
|
1186
|
+
/**
|
|
1187
|
+
*/
|
|
1188
|
+
create(): Listener<PARAMS>;
|
|
1189
|
+
/**
|
|
1190
|
+
* 如果监听器已经不存在,则创建
|
|
1191
|
+
* @param ident
|
|
1192
|
+
*/
|
|
1193
|
+
createByIdent(ident: any): Listener<PARAMS>;
|
|
1194
|
+
removeByIdent(ident: any): void;
|
|
1195
|
+
removeByCaller(caller: any): void;
|
|
1196
|
+
getByIdent(ident: any): Listener;
|
|
1197
|
+
/**
|
|
1198
|
+
* 派发事件
|
|
1199
|
+
* @param params 事件参数
|
|
1200
|
+
* @param subIdent
|
|
1201
|
+
*/
|
|
1202
|
+
dispatch(params?: PARAMS, subIdent?: string): void;
|
|
1203
|
+
protected _data: List<Listener<any>>;
|
|
1204
|
+
protected _indexIdent: {};
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
declare class Listener<PARAMS = any> {
|
|
1208
|
+
static create(ident?: string): Listener<any>;
|
|
1209
|
+
constructor(ident?: string);
|
|
1210
|
+
getCaller(): any;
|
|
1211
|
+
setCaller(caller: any): this;
|
|
1212
|
+
setSubIdent(val: string): this;
|
|
1213
|
+
setCondition(condition: (listener: Listener<PARAMS>) => boolean): this;
|
|
1214
|
+
setHandler(handler: (listener: Listener<PARAMS>) => void): this;
|
|
1215
|
+
setOnParams(val: any): this;
|
|
1216
|
+
getIdent(): string;
|
|
1217
|
+
on(): this;
|
|
1218
|
+
off(): this;
|
|
1219
|
+
isOn(): boolean;
|
|
1220
|
+
remove(): void;
|
|
1221
|
+
/**
|
|
1222
|
+
* 内部使用
|
|
1223
|
+
* @param params
|
|
1224
|
+
* @param subIdent 子编号
|
|
1225
|
+
*/
|
|
1226
|
+
_dispatch(params: PARAMS, subIdent?: string): void;
|
|
1227
|
+
getOnParams(): any;
|
|
1228
|
+
getParams(): PARAMS;
|
|
1229
|
+
protected onParams: any;
|
|
1230
|
+
protected params: PARAMS;
|
|
1231
|
+
protected ident: string;
|
|
1232
|
+
protected _subIdent: string;
|
|
1233
|
+
protected source: CallbackList;
|
|
1234
|
+
protected _handler: (any: any) => void;
|
|
1235
|
+
protected _condition: (any: any) => boolean;
|
|
1236
|
+
protected caller: any;
|
|
1237
|
+
protected _isOn: boolean;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* 事件字符串分隔符
|
|
1242
|
+
*/
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* 事件派发器
|
|
1246
|
+
*/
|
|
1247
|
+
declare class Dispatcher implements ISchedulable {
|
|
1248
|
+
constructor(name?: string);
|
|
1249
|
+
dispose(): void;
|
|
1250
|
+
create(type: string, listener: Listener): void;
|
|
1251
|
+
remove(type: string, listener: Listener): void;
|
|
1252
|
+
getByIdent(type: string, ident: string): Listener;
|
|
1253
|
+
/**
|
|
1254
|
+
* @param type
|
|
1255
|
+
* @param ident
|
|
1256
|
+
*/
|
|
1257
|
+
createByIdent(type: string, ident: string): Listener;
|
|
1258
|
+
/**
|
|
1259
|
+
* 派发事件
|
|
1260
|
+
* @param eventType 事件类型
|
|
1261
|
+
* @param params 事件参数
|
|
1262
|
+
*/
|
|
1263
|
+
dispatch(eventType: string, params?: any): void;
|
|
1264
|
+
protected getList(type: string): CallbackList;
|
|
1265
|
+
id?: string;
|
|
1266
|
+
uuid?: string;
|
|
1267
|
+
name: string;
|
|
1268
|
+
protected isDispose: boolean;
|
|
1269
|
+
protected typeToList: Dictionary<string, CallbackList<any>>;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
declare class CallbackItem {
|
|
1273
|
+
listener: Function;
|
|
1274
|
+
caller: any;
|
|
1275
|
+
once: boolean;
|
|
1276
|
+
}
|
|
1277
|
+
declare class SampleCallbackList {
|
|
1278
|
+
constructor();
|
|
1279
|
+
dispose(): void;
|
|
1280
|
+
has(caller: any, listener: Function): boolean;
|
|
1281
|
+
protected getItem(caller: any, listener: Function): CallbackItem;
|
|
1282
|
+
/**
|
|
1283
|
+
* 监听事件,如果监听已经存在则返回
|
|
1284
|
+
* @param caller
|
|
1285
|
+
* @param listener 为了性能考虑, event使用了对象池处理。因此处理函数不应该保存event的引用。如有需要,可通过新建对象或Event.Clone()实现
|
|
1286
|
+
*/
|
|
1287
|
+
on(caller: any, listener: (ctx: this, params?: any) => void): CallbackItem;
|
|
1288
|
+
once(caller: any, listener: (ctx: this, params?: any) => void): CallbackItem;
|
|
1289
|
+
protected offItem(item: CallbackItem): void;
|
|
1290
|
+
off(caller: any, listener: Function): void;
|
|
1291
|
+
offAll(type?: string): void;
|
|
1292
|
+
offAllCaller(caller: any): void;
|
|
1293
|
+
/**
|
|
1294
|
+
* 派发事件
|
|
1295
|
+
* @param params 事件参数
|
|
1296
|
+
*/
|
|
1297
|
+
dispatch(params?: any): void;
|
|
1298
|
+
protected _callbackItems: CallbackItem[];
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
declare class AssetURI {
|
|
1302
|
+
name: string;
|
|
1303
|
+
constructor(name: string);
|
|
1304
|
+
loadType: number;
|
|
1305
|
+
uuid: string;
|
|
1306
|
+
path: string;
|
|
1307
|
+
bundle: string;
|
|
1308
|
+
}
|
|
1309
|
+
declare class XAssetManager {
|
|
1310
|
+
getAsset(uri: string): any;
|
|
1311
|
+
getAssetByUUID(uuid: string): any;
|
|
1312
|
+
getRoot(): AssetManager;
|
|
1313
|
+
}
|
|
1314
|
+
declare let assetx: XAssetManager;
|
|
1315
|
+
|
|
1339
1316
|
declare class LoaderItem {
|
|
1340
1317
|
onComplete?: (err: any, asset: any) => void;
|
|
1341
1318
|
callHandler(err: any, asset: any): void;
|
|
@@ -2045,5 +2022,5 @@ declare class WidgetUtil {
|
|
|
2045
2022
|
}
|
|
2046
2023
|
declare var widgetutil: WidgetUtil;
|
|
2047
2024
|
|
|
2048
|
-
export { ArrayUtil, AssetLoader, AssetURI, BitUtil, CallbackList, CameraUtil, CanvasUtil, Controller,
|
|
2049
|
-
export type { CreatorFunction, DisposeFunction, IController, IError, IEventManager, IExtend, IListItem, IModel, IModule,
|
|
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 };
|