@ibiz-template/runtime 0.5.0 → 0.5.1-dev.0
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.esm.js +165 -144
- package/dist/index.system.min.js +1 -1
- package/out/constant/view-type.d.ts +5 -1
- package/out/constant/view-type.d.ts.map +1 -1
- package/out/constant/view-type.js +4 -0
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts +1 -2
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/tree-exp-bar.controller.js +6 -7
- package/out/controller/control/gantt/gantt.controller.js +2 -2
- package/out/controller/control/gantt/gantt.service.js +2 -2
- package/out/controller/control/tree/tree.controller.d.ts +8 -3
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +63 -63
- package/out/controller/control/tree/tree.service.js +8 -8
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.js +2 -2
- package/out/interface/controller/event/view/i-sub-app-ref-view.event.d.ts +12 -0
- package/out/interface/controller/event/view/i-sub-app-ref-view.event.d.ts.map +1 -0
- package/out/interface/controller/event/view/i-sub-app-ref-view.event.js +1 -0
- package/out/interface/controller/event/view/index.d.ts +1 -0
- package/out/interface/controller/event/view/index.d.ts.map +1 -1
- package/out/interface/controller/event/view/index.js +1 -0
- package/out/interface/controller/state/control/i-gantt.state.d.ts +2 -2
- package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree.state.d.ts +26 -25
- package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
- package/out/interface/controller/state/view/i-sub-app-ref-view.state.d.ts +11 -0
- package/out/interface/controller/state/view/i-sub-app-ref-view.state.d.ts.map +1 -0
- package/out/interface/controller/state/view/i-sub-app-ref-view.state.js +1 -0
- package/out/interface/controller/state/view/index.d.ts +1 -0
- package/out/interface/controller/state/view/index.d.ts.map +1 -1
- package/out/interface/controller/state/view/index.js +1 -0
- package/out/service/dto/method.dto.d.ts +12 -1
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +15 -3
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts +2 -2
- package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts +3 -3
- package/out/service/vo/tree-node-data/tree-code-list-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-code-list-node-data.js +10 -10
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +4 -4
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-data-set-node-data.js +27 -27
- package/out/service/vo/tree-node-data/tree-node-data.d.ts +12 -13
- package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-node-data.js +8 -8
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts +4 -4
- package/out/service/vo/tree-node-data/tree-static-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-static-node-data.js +11 -11
- package/package.json +5 -5
- package/src/constant/view-type.ts +5 -0
- package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +6 -7
- package/src/controller/control/gantt/gantt.controller.ts +2 -2
- package/src/controller/control/gantt/gantt.service.ts +2 -2
- package/src/controller/control/tree/tree.controller.ts +70 -65
- package/src/controller/control/tree/tree.service.ts +8 -8
- package/src/controller/control/tree-grid-ex/tree-grid-ex.controller.ts +7 -3
- package/src/interface/controller/event/view/i-sub-app-ref-view.event.ts +12 -0
- package/src/interface/controller/event/view/index.ts +1 -0
- package/src/interface/controller/state/control/i-gantt.state.ts +2 -2
- package/src/interface/controller/state/control/i-tree.state.ts +27 -25
- package/src/interface/controller/state/view/i-sub-app-ref-view.state.ts +10 -0
- package/src/interface/controller/state/view/index.ts +1 -0
- package/src/service/dto/method.dto.ts +14 -2
- package/src/service/vo/gantt-node-data/gantt-code-list-node-data.ts +2 -2
- package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +2 -2
- package/src/service/vo/gantt-node-data/gantt-static-node-data.ts +2 -2
- package/src/service/vo/tree-node-data/tree-code-list-node-data.ts +13 -13
- package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +35 -35
- package/src/service/vo/tree-node-data/tree-node-data.ts +19 -22
- package/src/service/vo/tree-node-data/tree-static-node-data.ts +16 -15
|
@@ -230,9 +230,13 @@ export class TreeGridExController<
|
|
|
230
230
|
await super.afterLoadNodes(nodes);
|
|
231
231
|
|
|
232
232
|
// 封装更新树表格行数据
|
|
233
|
-
recursiveIterate(
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
recursiveIterate(
|
|
234
|
+
{ _children: nodes },
|
|
235
|
+
(node: ITreeNodeData) => {
|
|
236
|
+
this.state.rows[node._uuid] = new TreeGridExRowState(node, this);
|
|
237
|
+
},
|
|
238
|
+
{ childrenFields: ['_children'] },
|
|
239
|
+
);
|
|
236
240
|
}
|
|
237
241
|
|
|
238
242
|
/**
|
|
@@ -108,7 +108,7 @@ export interface IGanttNodeData extends ITreeNodeData {
|
|
|
108
108
|
* @date 2023-12-11 18:12:16
|
|
109
109
|
* @type {(IGanttNodeData[] | undefined)}
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
_children?: IGanttNodeData[] | undefined;
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* 父节点数据对象
|
|
@@ -116,5 +116,5 @@ export interface IGanttNodeData extends ITreeNodeData {
|
|
|
116
116
|
* @type {IGanttNodeData}
|
|
117
117
|
* @memberof IGanttNodeData
|
|
118
118
|
*/
|
|
119
|
-
|
|
119
|
+
_parent?: IGanttNodeData;
|
|
120
120
|
}
|
|
@@ -12,6 +12,8 @@ import { IMDControlState } from './i-md-control.state';
|
|
|
12
12
|
export interface ITreeState extends IMDControlState {
|
|
13
13
|
items: ITreeNodeData[];
|
|
14
14
|
|
|
15
|
+
selectedData: ITreeNodeData[];
|
|
16
|
+
|
|
15
17
|
/**
|
|
16
18
|
* 树的根节点
|
|
17
19
|
*
|
|
@@ -69,7 +71,7 @@ export interface ITreeState extends IMDControlState {
|
|
|
69
71
|
* @export
|
|
70
72
|
* @class ITreeNodeData
|
|
71
73
|
*/
|
|
72
|
-
export interface ITreeNodeData
|
|
74
|
+
export interface ITreeNodeData {
|
|
73
75
|
/**
|
|
74
76
|
* 节点数据的唯一标识(创建的时候自动生成)
|
|
75
77
|
* @author lxm
|
|
@@ -92,7 +94,7 @@ export interface ITreeNodeData extends IData {
|
|
|
92
94
|
* @type {string}
|
|
93
95
|
* @memberof ITreeNodeData
|
|
94
96
|
*/
|
|
95
|
-
|
|
97
|
+
_nodeId: string;
|
|
96
98
|
|
|
97
99
|
/**
|
|
98
100
|
* 节点唯一标识,在父的id上加上自身的唯一标识,用>分隔
|
|
@@ -101,7 +103,7 @@ export interface ITreeNodeData extends IData {
|
|
|
101
103
|
* @type {string}
|
|
102
104
|
* @memberof ITreeNodeData
|
|
103
105
|
*/
|
|
104
|
-
|
|
106
|
+
_id: string;
|
|
105
107
|
|
|
106
108
|
/**
|
|
107
109
|
* 节点的值(可能是自己的主键,也可能是沿用父的值)
|
|
@@ -110,7 +112,7 @@ export interface ITreeNodeData extends IData {
|
|
|
110
112
|
* @type {string}
|
|
111
113
|
* @memberof ITreeNodeData
|
|
112
114
|
*/
|
|
113
|
-
|
|
115
|
+
_value?: string;
|
|
114
116
|
|
|
115
117
|
/**
|
|
116
118
|
* 节点显示名称
|
|
@@ -118,7 +120,7 @@ export interface ITreeNodeData extends IData {
|
|
|
118
120
|
* @type {string}
|
|
119
121
|
* @memberof ITreeNodeData
|
|
120
122
|
*/
|
|
121
|
-
|
|
123
|
+
_text: string;
|
|
122
124
|
|
|
123
125
|
/**
|
|
124
126
|
* 是否是叶子节点(没有子节点的节点)
|
|
@@ -126,7 +128,7 @@ export interface ITreeNodeData extends IData {
|
|
|
126
128
|
* @type {boolean}
|
|
127
129
|
* @memberof ITreeNodeData
|
|
128
130
|
*/
|
|
129
|
-
|
|
131
|
+
_leaf: boolean;
|
|
130
132
|
|
|
131
133
|
/**
|
|
132
134
|
* 资源路径相关上下文参数
|
|
@@ -136,7 +138,7 @@ export interface ITreeNodeData extends IData {
|
|
|
136
138
|
* @type {IParams}
|
|
137
139
|
* @memberof ITreeNodeData
|
|
138
140
|
*/
|
|
139
|
-
|
|
141
|
+
_context?: IParams;
|
|
140
142
|
|
|
141
143
|
/**
|
|
142
144
|
* 关系上转换的视图参数
|
|
@@ -144,7 +146,7 @@ export interface ITreeNodeData extends IData {
|
|
|
144
146
|
* @type {IParams}
|
|
145
147
|
* @memberof ITreeNodeData
|
|
146
148
|
*/
|
|
147
|
-
|
|
149
|
+
_params?: IParams;
|
|
148
150
|
|
|
149
151
|
/**
|
|
150
152
|
* 子节点集合(没有子节点则不存在)
|
|
@@ -152,7 +154,7 @@ export interface ITreeNodeData extends IData {
|
|
|
152
154
|
* @type {ITreeNodeData[]}
|
|
153
155
|
* @memberof ITreeNodeData
|
|
154
156
|
*/
|
|
155
|
-
|
|
157
|
+
_children?: ITreeNodeData[];
|
|
156
158
|
|
|
157
159
|
/**
|
|
158
160
|
* 父节点数据对象
|
|
@@ -160,7 +162,7 @@ export interface ITreeNodeData extends IData {
|
|
|
160
162
|
* @type {ITreeNodeData}
|
|
161
163
|
* @memberof ITreeNodeData
|
|
162
164
|
*/
|
|
163
|
-
|
|
165
|
+
_parent?: ITreeNodeData;
|
|
164
166
|
|
|
165
167
|
/**
|
|
166
168
|
* 实体数据
|
|
@@ -168,39 +170,39 @@ export interface ITreeNodeData extends IData {
|
|
|
168
170
|
* @type {IData}
|
|
169
171
|
* @memberof ITreeNodeData
|
|
170
172
|
*/
|
|
171
|
-
|
|
173
|
+
_deData?: IData;
|
|
172
174
|
|
|
173
175
|
/**
|
|
174
|
-
*
|
|
176
|
+
* 图标
|
|
175
177
|
* @author lxm
|
|
176
|
-
* @date 2023-
|
|
177
|
-
* @type {
|
|
178
|
+
* @date 2023-08-15 02:02:49
|
|
179
|
+
* @type {IIcon}
|
|
178
180
|
*/
|
|
179
|
-
|
|
181
|
+
_icon?: IIcon;
|
|
180
182
|
|
|
181
183
|
/**
|
|
182
|
-
*
|
|
184
|
+
* 节点文本的html显示
|
|
183
185
|
* @author lxm
|
|
184
|
-
* @date 2023-
|
|
186
|
+
* @date 2023-08-15 02:15:09
|
|
185
187
|
* @type {string}
|
|
186
188
|
*/
|
|
187
|
-
|
|
189
|
+
_textHtml?: string;
|
|
188
190
|
|
|
189
191
|
/**
|
|
190
|
-
*
|
|
192
|
+
* 作为实体数据时的主键
|
|
191
193
|
* @author lxm
|
|
192
|
-
* @date 2023-
|
|
193
|
-
* @type {
|
|
194
|
+
* @date 2023-05-29 09:28:59
|
|
195
|
+
* @type {string}
|
|
194
196
|
*/
|
|
195
|
-
|
|
197
|
+
srfkey?: string;
|
|
196
198
|
|
|
197
199
|
/**
|
|
198
|
-
*
|
|
200
|
+
* 作为实体数据时的主信息
|
|
199
201
|
* @author lxm
|
|
200
|
-
* @date 2023-
|
|
202
|
+
* @date 2023-05-29 09:29:00
|
|
201
203
|
* @type {string}
|
|
202
204
|
*/
|
|
203
|
-
|
|
205
|
+
srfmajortext?: string;
|
|
204
206
|
|
|
205
207
|
// todo 其他界面绘制相关属性
|
|
206
208
|
}
|
|
@@ -37,11 +37,22 @@ export class MethodDto {
|
|
|
37
37
|
*/
|
|
38
38
|
protected isCalcRs = false;
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Creates an instance of MethodDto.
|
|
42
|
+
* @author lxm
|
|
43
|
+
* @date 2024-01-04 05:39:07
|
|
44
|
+
* @param {IAppDEService} service
|
|
45
|
+
* @param {IAppDataEntity} entity
|
|
46
|
+
* @param {boolean} [isLocalMode]
|
|
47
|
+
* @param {IAppDEMethodDTO} [dto]
|
|
48
|
+
* @param {boolean} [inSelfLoop] 是否在自关系循环中
|
|
49
|
+
*/
|
|
40
50
|
constructor(
|
|
41
51
|
protected service: IAppDEService,
|
|
42
52
|
protected entity: IAppDataEntity,
|
|
43
53
|
protected isLocalMode?: boolean,
|
|
44
54
|
protected dto?: IAppDEMethodDTO,
|
|
55
|
+
protected inSelfLoop?: boolean,
|
|
45
56
|
) {
|
|
46
57
|
if (dto) {
|
|
47
58
|
this.app = ibiz.hub.getApp(entity.appId);
|
|
@@ -188,7 +199,7 @@ export class MethodDto {
|
|
|
188
199
|
* @return {*} {Promise<IDataEntity[]>}
|
|
189
200
|
*/
|
|
190
201
|
async sets(context: IContext, data: IData[]): Promise<IDataEntity[]> {
|
|
191
|
-
if (this.isLocalMode) {
|
|
202
|
+
if (this.isLocalMode && !this.inSelfLoop) {
|
|
192
203
|
this.service.local.clear();
|
|
193
204
|
}
|
|
194
205
|
await this.calcRs(context);
|
|
@@ -303,9 +314,10 @@ export class MethodDto {
|
|
|
303
314
|
entity.appDEMethodDTOs || [],
|
|
304
315
|
field.refAppDEMethodDTOId!,
|
|
305
316
|
)!;
|
|
317
|
+
const inSelfLoop = this.entity.codeName === entity.codeName;
|
|
306
318
|
const service = await this.app!.deService.getService(context, entity.id!);
|
|
307
319
|
service.isLocalMode = true;
|
|
308
|
-
const dto = new MethodDto(service, entity, true, methodDto);
|
|
320
|
+
const dto = new MethodDto(service, entity, true, methodDto, inSelfLoop);
|
|
309
321
|
this.dtoMap.set(field.codeName!, dto);
|
|
310
322
|
return dto;
|
|
311
323
|
}
|
|
@@ -19,9 +19,9 @@ export class GanttCodeListNodeData
|
|
|
19
19
|
|
|
20
20
|
totalDataItemValue: string | number;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
_children?: IGanttNodeData[] | undefined;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
_parent?: IGanttNodeData;
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
model: IDEGantt,
|
|
@@ -19,9 +19,9 @@ export class GanttDataSetNodeData
|
|
|
19
19
|
|
|
20
20
|
totalDataItemValue: string | number;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
_children?: IGanttNodeData[] | undefined;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
_parent?: IGanttNodeData;
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
model: IDEGantt,
|
|
@@ -19,9 +19,9 @@ export class GanttStaticNodeData
|
|
|
19
19
|
|
|
20
20
|
totalDataItemValue: string | number;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
_children?: IGanttNodeData[] | undefined;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
_parent?: IGanttNodeData;
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
model: IDEGantt,
|
|
@@ -15,11 +15,11 @@ export class TreeCodeListNodeData
|
|
|
15
15
|
extends TreeNodeData
|
|
16
16
|
implements ITreeNodeData
|
|
17
17
|
{
|
|
18
|
-
|
|
18
|
+
_text: string;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
_id!: string;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
_value: string;
|
|
23
23
|
|
|
24
24
|
constructor(
|
|
25
25
|
model: IDETreeDataSetNode,
|
|
@@ -33,14 +33,14 @@ export class TreeCodeListNodeData
|
|
|
33
33
|
) {
|
|
34
34
|
super(model, parentNodeData, opts);
|
|
35
35
|
const { data } = opts;
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
36
|
+
this._text = data.text;
|
|
37
|
+
this._value = data.value as string;
|
|
38
38
|
|
|
39
39
|
// id小写
|
|
40
|
-
const selfId = `${model.id}@${this.
|
|
41
|
-
Object.defineProperty(this, '
|
|
40
|
+
const selfId = `${model.id}@${this._value}`.toLowerCase();
|
|
41
|
+
Object.defineProperty(this, '_id', {
|
|
42
42
|
get() {
|
|
43
|
-
return this.
|
|
43
|
+
return this._parent ? `${this._parent._id}:${selfId}` : selfId;
|
|
44
44
|
},
|
|
45
45
|
enumerable: true,
|
|
46
46
|
configurable: true,
|
|
@@ -49,14 +49,14 @@ export class TreeCodeListNodeData
|
|
|
49
49
|
// 实体节点额外添加上自己的实体上下文
|
|
50
50
|
if (model.appDataEntityId) {
|
|
51
51
|
const deName = calcDeCodeNameById(model.appDataEntityId);
|
|
52
|
-
this.
|
|
53
|
-
[deName]: this.
|
|
52
|
+
this._context = Object.assign(this._context || {}, {
|
|
53
|
+
[deName]: this._value,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
this.srfkey = this.
|
|
58
|
-
this.srfmajortext = this.
|
|
57
|
+
this.srfkey = this._value;
|
|
58
|
+
this.srfmajortext = this._text;
|
|
59
59
|
|
|
60
|
-
this.
|
|
60
|
+
this._icon = this.calcIcon(model);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -16,13 +16,13 @@ import { fieldValueToBoolean } from '../../utils';
|
|
|
16
16
|
* @implements {ITreeNodeData}
|
|
17
17
|
*/
|
|
18
18
|
export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
19
|
-
|
|
19
|
+
_text: string;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
_id!: string;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
_value: string;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
_deData: IData;
|
|
26
26
|
|
|
27
27
|
constructor(
|
|
28
28
|
model: IDETreeDataSetNode,
|
|
@@ -36,19 +36,19 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
36
36
|
) {
|
|
37
37
|
super(model, parentNodeData, opts);
|
|
38
38
|
const { data } = opts;
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
39
|
+
this._deData = data;
|
|
40
|
+
this._text = model.textAppDEFieldId
|
|
41
41
|
? data[model.textAppDEFieldId]
|
|
42
42
|
: data.srfmajortext;
|
|
43
|
-
this.
|
|
43
|
+
this._value = model.idAppDEFieldId
|
|
44
44
|
? data[model.idAppDEFieldId]
|
|
45
45
|
: data.srfkey;
|
|
46
46
|
|
|
47
47
|
// id小写
|
|
48
48
|
const selfId = `${model.id}@${data.srfkey}`.toLowerCase();
|
|
49
|
-
Object.defineProperty(this, '
|
|
49
|
+
Object.defineProperty(this, '_id', {
|
|
50
50
|
get() {
|
|
51
|
-
return this.
|
|
51
|
+
return this._parent ? `${this._parent._id}:${selfId}` : selfId;
|
|
52
52
|
},
|
|
53
53
|
enumerable: true,
|
|
54
54
|
configurable: true,
|
|
@@ -57,30 +57,30 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
57
57
|
// 实体节点额外添加上自己的实体上下文
|
|
58
58
|
if (model.appDataEntityId) {
|
|
59
59
|
const deName = calcDeCodeNameById(model.appDataEntityId);
|
|
60
|
-
this.
|
|
60
|
+
this._context = Object.assign(this._context || {}, {
|
|
61
61
|
[deName]: data.srfkey,
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
this.icon = this.calcIcon(model);
|
|
69
|
-
this.textHtml = this.calcTextHtml(model);
|
|
65
|
+
this._icon = this.calcIcon(model);
|
|
66
|
+
this._textHtml = this.calcTextHtml(model);
|
|
70
67
|
|
|
71
68
|
// 识别叶子节点标识属性,根据后台数据赋值leaf
|
|
72
69
|
if (model.leafFlagAppDEFieldId) {
|
|
73
|
-
this.
|
|
70
|
+
this._leaf = fieldValueToBoolean(data[model.leafFlagAppDEFieldId]);
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
/** 数据项映射 */
|
|
77
|
-
const
|
|
74
|
+
const dataItemKeyMap = new Map<string | symbol, string | symbol>();
|
|
75
|
+
dataItemKeyMap.set('srfkey', 'srfkey');
|
|
76
|
+
dataItemKeyMap.set('srfmajortext', 'srfmajortext');
|
|
77
|
+
|
|
78
78
|
const dataItemDefaults: IData = {};
|
|
79
79
|
model.detreeNodeDataItems?.forEach(dataItem => {
|
|
80
80
|
const uiKey = dataItem.id!.toLowerCase();
|
|
81
81
|
// 后台实体属性
|
|
82
82
|
const deFieldKey = dataItem.appDEFieldId!.toLowerCase();
|
|
83
|
-
|
|
83
|
+
dataItemKeyMap.set(uiKey, deFieldKey);
|
|
84
84
|
if (dataItem.defaultValue) {
|
|
85
85
|
dataItemDefaults[uiKey] = dataItem.defaultValue;
|
|
86
86
|
}
|
|
@@ -88,25 +88,25 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
88
88
|
|
|
89
89
|
return new Proxy<TreeDataSetNodeData>(this, {
|
|
90
90
|
set(target, p, value): boolean {
|
|
91
|
-
if (Object.prototype.hasOwnProperty.call(target.
|
|
92
|
-
target.
|
|
93
|
-
} else if (
|
|
94
|
-
target.
|
|
91
|
+
if (Object.prototype.hasOwnProperty.call(target._deData, p)) {
|
|
92
|
+
target._deData[p] = value;
|
|
93
|
+
} else if (dataItemKeyMap.has(p)) {
|
|
94
|
+
target._deData[dataItemKeyMap.get(p)!] = value;
|
|
95
95
|
} else {
|
|
96
|
-
target[p] = value;
|
|
96
|
+
(target as IData)[p] = value;
|
|
97
97
|
}
|
|
98
98
|
return true;
|
|
99
99
|
},
|
|
100
100
|
|
|
101
101
|
get(target, p, _receiver): unknown {
|
|
102
|
-
if (target[p] !== undefined) {
|
|
103
|
-
return target[p];
|
|
102
|
+
if ((target as IData)[p] !== undefined) {
|
|
103
|
+
return (target as IData)[p];
|
|
104
104
|
}
|
|
105
|
-
if (
|
|
106
|
-
return target.
|
|
105
|
+
if (dataItemKeyMap.has(p)) {
|
|
106
|
+
return target._deData[dataItemKeyMap.get(p)!] || dataItemDefaults[p];
|
|
107
107
|
}
|
|
108
|
-
if (target.
|
|
109
|
-
return target.
|
|
108
|
+
if (target._deData[p] !== undefined) {
|
|
109
|
+
return target._deData[p];
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
|
|
@@ -115,8 +115,8 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
115
115
|
const allKeys = [
|
|
116
116
|
...new Set([
|
|
117
117
|
...Object.keys(target),
|
|
118
|
-
...
|
|
119
|
-
...Object.keys(target.
|
|
118
|
+
...dataItemKeyMap.keys(),
|
|
119
|
+
...Object.keys(target._deData),
|
|
120
120
|
]),
|
|
121
121
|
];
|
|
122
122
|
updateKeyDefine(target, allKeys);
|
|
@@ -128,12 +128,12 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
128
128
|
protected calcIcon(model: IDETreeDataSetNode): IIcon | undefined {
|
|
129
129
|
const icon = super.calcIcon(model) || {};
|
|
130
130
|
const { iconAppDEFieldId, detreeNodeDataItems } = model;
|
|
131
|
-
if (iconAppDEFieldId && this.
|
|
132
|
-
icon.imagePath = this.
|
|
131
|
+
if (iconAppDEFieldId && this._deData[iconAppDEFieldId]) {
|
|
132
|
+
icon.imagePath = this._deData[iconAppDEFieldId];
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
if (icon) {
|
|
136
|
-
this.
|
|
136
|
+
this._icon = icon;
|
|
137
137
|
}
|
|
138
138
|
const iconDataItem = detreeNodeDataItems?.find(item => item.id === 'icon');
|
|
139
139
|
if (iconDataItem) {
|
|
@@ -155,7 +155,7 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
155
155
|
): string | undefined {
|
|
156
156
|
if (dataItem.customCode && dataItem.scriptCode) {
|
|
157
157
|
return ScriptFactory.execScriptFn(
|
|
158
|
-
{ data: this.
|
|
158
|
+
{ data: this._deData },
|
|
159
159
|
dataItem.scriptCode,
|
|
160
160
|
{
|
|
161
161
|
isAsync: false,
|
|
@@ -14,61 +14,58 @@ export abstract class TreeNodeData implements ITreeNodeData {
|
|
|
14
14
|
|
|
15
15
|
_nodeType: string;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
_id!: string;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
_value?: string | undefined;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
_text!: string;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
_children?: ITreeNodeData[] | undefined;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
_deData?: IData | undefined;
|
|
26
26
|
|
|
27
27
|
srfkey?: string | undefined;
|
|
28
28
|
|
|
29
29
|
srfmajortext?: string | undefined;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
_nodeId: string;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
_leaf: boolean = false;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
_context?: IParams;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
_params?: IParams;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
_parent?: ITreeNodeData;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
_icon?: IIcon;
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
-
[key: string | symbol]: any;
|
|
43
|
+
_textHtml?: string;
|
|
47
44
|
|
|
48
45
|
constructor(
|
|
49
46
|
model: IDETreeNode,
|
|
50
47
|
parentNodeData: ITreeNodeData | undefined,
|
|
51
48
|
opts: { leaf: boolean; navContext?: IParams; navParams?: IParams },
|
|
52
49
|
) {
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
50
|
+
this._leaf = opts.leaf === true;
|
|
51
|
+
this._parent = parentNodeData;
|
|
55
52
|
this._nodeType = model.treeNodeType!;
|
|
56
53
|
|
|
57
54
|
// 所有节点都要继承父的上下文,如果父存在则复制父的资源上下文,否则返回空对象。
|
|
58
|
-
if (this.
|
|
59
|
-
this.
|
|
55
|
+
if (this._parent) {
|
|
56
|
+
this._context = { ...this._parent._context };
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
// 附加导航上下文和视图参数
|
|
63
60
|
if (opts.navContext) {
|
|
64
|
-
this.
|
|
61
|
+
this._context = Object.assign(this._context || {}, opts.navContext);
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
if (opts.navParams) {
|
|
68
|
-
this.
|
|
65
|
+
this._params = { ...opts.navParams };
|
|
69
66
|
}
|
|
70
67
|
|
|
71
|
-
this.
|
|
68
|
+
this._nodeId = model.id!;
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
/**
|
|
@@ -11,13 +11,13 @@ import { TreeNodeData } from './tree-node-data';
|
|
|
11
11
|
* @implements {ITreeNodeData}
|
|
12
12
|
*/
|
|
13
13
|
export class TreeStaticNodeData extends TreeNodeData implements ITreeNodeData {
|
|
14
|
-
|
|
14
|
+
_text: string;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
_id!: string;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
_value?: string;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
_deData?: IData;
|
|
21
21
|
|
|
22
22
|
constructor(
|
|
23
23
|
model: IDETreeStaticNode,
|
|
@@ -30,34 +30,35 @@ export class TreeStaticNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
30
30
|
|
|
31
31
|
// id小写
|
|
32
32
|
const selfId = `${model.id}`.toLowerCase();
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
Object.defineProperty(this, '_id', {
|
|
34
35
|
get() {
|
|
35
|
-
return this.
|
|
36
|
+
return this._parent ? `${this._parent._id}:${selfId}` : selfId;
|
|
36
37
|
},
|
|
37
38
|
enumerable: true,
|
|
38
39
|
configurable: true,
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
42
|
+
this._text = model.text!;
|
|
43
|
+
this._value = nodeValue;
|
|
43
44
|
|
|
44
45
|
// 静态节点数据去对应级别的父节点数据
|
|
45
46
|
if (parentNodeData && opts.parentValueLevel) {
|
|
46
47
|
// 根据父值级别查找父数据
|
|
47
48
|
let parent: ITreeNodeData | undefined = parentNodeData;
|
|
48
49
|
for (let index = 1; index < opts.parentValueLevel!; index++) {
|
|
49
|
-
parent = parent?.
|
|
50
|
+
parent = parent?._parent;
|
|
50
51
|
}
|
|
51
|
-
if (parent?.
|
|
52
|
-
this.
|
|
52
|
+
if (parent?._deData) {
|
|
53
|
+
this._deData = parent._deData;
|
|
53
54
|
}
|
|
54
55
|
// 静态节点值不存在时,取父数据的值
|
|
55
|
-
this.
|
|
56
|
+
this._value = nodeValue || parent?._value;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
this.srfkey = this.
|
|
59
|
-
this.srfmajortext = this.
|
|
59
|
+
this.srfkey = this._deData?.srfkey || this._value;
|
|
60
|
+
this.srfmajortext = this._deData?.srfmajortext || this._text;
|
|
60
61
|
|
|
61
|
-
this.
|
|
62
|
+
this._icon = this.calcIcon(model);
|
|
62
63
|
}
|
|
63
64
|
}
|