更新编译结果
This commit is contained in:
parent
eb3d46c037
commit
25aa6ae382
2
lib/app/JlDrawApp.d.ts
vendored
2
lib/app/JlDrawApp.d.ts
vendored
@ -28,7 +28,7 @@ export declare abstract class GraphicDrawAssistant<GT extends GraphicTemplate, G
|
||||
/**
|
||||
* 获取下一个id
|
||||
*/
|
||||
nextId(): string;
|
||||
nextId(): number;
|
||||
clearCache(): void;
|
||||
/**
|
||||
* 重绘
|
||||
|
18
lib/core/GraphicStore.d.ts
vendored
18
lib/core/GraphicStore.d.ts
vendored
@ -8,12 +8,12 @@ export interface GraphicQueryStore {
|
||||
/**
|
||||
* 根据id获取图形
|
||||
*/
|
||||
queryById<T extends JlGraphic>(id: string): T;
|
||||
queryById<T extends JlGraphic>(id: number | string): T;
|
||||
/**
|
||||
* 根据id模糊查询图形
|
||||
* @param id
|
||||
*/
|
||||
queryByIdAmbiguous(id: string): JlGraphic[];
|
||||
queryByIdAmbiguous(id: number | string): JlGraphic[];
|
||||
/**
|
||||
* 根据类型获取图形列表
|
||||
*/
|
||||
@ -33,13 +33,13 @@ export interface GraphicQueryStore {
|
||||
* 根据id或code查询图形
|
||||
* @param v
|
||||
*/
|
||||
queryByIdOrCode(v: string): JlGraphic[];
|
||||
queryByIdOrCode(v: string | number): JlGraphic[];
|
||||
/**
|
||||
* 根据id或code及类型查询图形
|
||||
* @param v
|
||||
* @param type
|
||||
*/
|
||||
queryByIdOrCodeAndType(v: string, type: string): JlGraphic[];
|
||||
queryByIdOrCodeAndType(v: string | number, type: string): JlGraphic[];
|
||||
/**
|
||||
* 根据code和类型获取图形
|
||||
* @param code
|
||||
@ -57,20 +57,20 @@ export interface GraphicQueryStore {
|
||||
* 图形存储
|
||||
*/
|
||||
export declare class GraphicStore implements GraphicQueryStore {
|
||||
store: Map<string, JlGraphic>;
|
||||
store: Map<number, JlGraphic>;
|
||||
relationManage: RelationManage;
|
||||
constructor();
|
||||
/**
|
||||
* 获取所有图形对象
|
||||
*/
|
||||
getAllGraphics(): JlGraphic[];
|
||||
queryById<T extends JlGraphic>(id: string): T;
|
||||
queryByIdAmbiguous(id: string): JlGraphic[];
|
||||
queryById<T extends JlGraphic>(id: number | string): T;
|
||||
queryByIdAmbiguous(id: number | string): JlGraphic[];
|
||||
queryByType<T extends JlGraphic>(type: string): T[];
|
||||
queryByCode(code: string): JlGraphic[] | undefined;
|
||||
queryByCodeAmbiguous(code: string): JlGraphic[];
|
||||
queryByIdOrCode(s: string): JlGraphic[];
|
||||
queryByIdOrCodeAndType(s: string, type: string): JlGraphic[];
|
||||
queryByIdOrCode(s: string | number): JlGraphic[];
|
||||
queryByIdOrCodeAndType(s: string | number, type: string): JlGraphic[];
|
||||
queryByCodeAndType<T extends JlGraphic>(code: string, type: string): T | undefined;
|
||||
queryByCodeAndTypeAmbiguous<T extends JlGraphic>(code: string, type: string): T[];
|
||||
/**
|
||||
|
2
lib/core/IdGenerator.d.ts
vendored
2
lib/core/IdGenerator.d.ts
vendored
@ -5,7 +5,7 @@ export declare class IdGenerator {
|
||||
serial: number;
|
||||
type: string;
|
||||
constructor(type: string);
|
||||
next(): string;
|
||||
next(): number;
|
||||
getType(): string;
|
||||
initSerial(serial: number): void;
|
||||
}
|
||||
|
10
lib/core/JlGraphic.d.ts
vendored
10
lib/core/JlGraphic.d.ts
vendored
@ -38,8 +38,8 @@ export declare class ChildTransform {
|
||||
* 图形数据
|
||||
*/
|
||||
export interface GraphicData {
|
||||
get id(): string;
|
||||
set id(v: string);
|
||||
get id(): number;
|
||||
set id(v: number);
|
||||
get graphicType(): string;
|
||||
set graphicType(v: string);
|
||||
get transform(): GraphicTransform;
|
||||
@ -142,15 +142,15 @@ export declare abstract class JlGraphic extends Container {
|
||||
/**
|
||||
* 是否此对象id/code
|
||||
*/
|
||||
isIdOrCode(s: string): boolean;
|
||||
isIdOrCode(s: string | number): boolean;
|
||||
/**
|
||||
* 获取图形id,如果图形数据对象存在,则返回图形数据对象id
|
||||
*/
|
||||
get id(): string;
|
||||
get id(): number;
|
||||
/**
|
||||
* 设置图形id,如果图形数据存在,则同时设置图形数据id
|
||||
*/
|
||||
set id(v: string);
|
||||
set id(v: number);
|
||||
/**
|
||||
* 获取图形业务code,如果业务code在图形数据或图形状态中,则需要重写此方法
|
||||
*/
|
||||
|
23
lib/index.js
23
lib/index.js
@ -17,7 +17,8 @@ class IdGenerator {
|
||||
}
|
||||
next() {
|
||||
++this.serial;
|
||||
return this.getType() + this.serial;
|
||||
// console.log(this.getType() + this.serial)
|
||||
return this.serial;
|
||||
}
|
||||
getType() {
|
||||
return this.type;
|
||||
@ -4252,15 +4253,20 @@ class GraphicStore {
|
||||
return [...this.store.values()];
|
||||
}
|
||||
queryById(id) {
|
||||
const graphic = this.store.get(id);
|
||||
let nid = id;
|
||||
if (typeof id === 'string') {
|
||||
nid = parseInt(id);
|
||||
}
|
||||
const graphic = this.store.get(nid);
|
||||
if (!graphic)
|
||||
throw Error(`未找到id为 [${id}] 的图形.`);
|
||||
return this.store.get(id);
|
||||
throw Error(`未找到id为 [${nid}] 的图形.`);
|
||||
return this.store.get(nid);
|
||||
}
|
||||
queryByIdAmbiguous(id) {
|
||||
const nid = id + '';
|
||||
const list = [];
|
||||
this.store.forEach((g) => {
|
||||
if (g.id.search(id) >= 0) {
|
||||
if ((g.id + '').search(nid) >= 0) {
|
||||
list.push(g);
|
||||
}
|
||||
});
|
||||
@ -4332,7 +4338,7 @@ class GraphicStore {
|
||||
* @param graphics 要存储的图形
|
||||
*/
|
||||
storeGraphics(graphic) {
|
||||
if (!graphic.id || graphic.id.trim() === '') {
|
||||
if (!graphic.id || graphic.id === 0) {
|
||||
throw new Error(`存储图形对象异常: id为空, ${graphic}`);
|
||||
}
|
||||
if (this.store.has(graphic.id)) {
|
||||
@ -4783,7 +4789,7 @@ class GraphicAnimation {
|
||||
class JlGraphic extends Container {
|
||||
__JlGraphic = true;
|
||||
type; // 图形类型
|
||||
_id = ''; // 图形的唯一标识,不具有业务意义,唯一,不可重复,可用做图形数据关联。
|
||||
_id = 0; // 图形的唯一标识,不具有业务意义,唯一,不可重复,可用做图形数据关联。
|
||||
_code = ''; // 业务编号/名称,用于标识图形对象,具有业务意义
|
||||
_datas; // 图形数据
|
||||
_states; // 图形状态数据
|
||||
@ -6770,8 +6776,7 @@ class GraphicSceneBase extends EventEmitter {
|
||||
// 更新id生成器
|
||||
const max = this.queryStore
|
||||
.getAllGraphics()
|
||||
.filter((g) => !isNaN(parseInt(g.id)))
|
||||
.map((g) => parseInt(g.id))
|
||||
.map((g) => g.id)
|
||||
.sort((a, b) => a - b)
|
||||
.pop() ?? 0;
|
||||
GraphicIdGenerator.initSerial(max);
|
||||
|
2
lib/plugins/AnimationManager.d.ts
vendored
2
lib/plugins/AnimationManager.d.ts
vendored
@ -9,7 +9,7 @@ export declare class AnimationManager {
|
||||
/**
|
||||
* key - graphic.id
|
||||
*/
|
||||
graphicAnimationMap: Map<string, Map<string, GraphicAnimation>>;
|
||||
graphicAnimationMap: Map<number, Map<string, GraphicAnimation>>;
|
||||
constructor(app: IGraphicScene);
|
||||
private run;
|
||||
pause(): void;
|
||||
|
Loading…
Reference in New Issue
Block a user