@ibiz-template/runtime 0.5.3-beta.3 → 0.5.3-beta.5
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 +913 -174
- package/dist/index.system.min.js +1 -1
- package/out/command/app/open-app-view/open-app-view.js +2 -2
- package/out/controller/constant/control/index.d.ts +1 -0
- package/out/controller/constant/control/index.d.ts.map +1 -1
- package/out/controller/constant/control/index.js +1 -0
- package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.d.ts +5 -0
- package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.d.ts.map +1 -0
- package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.js +6 -0
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +4 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.d.ts +1 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.js +1 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.d.ts +10 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.js +12 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.d.ts +34 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.js +68 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.d.ts +205 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.d.ts.map +1 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.js +345 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.d.ts +3 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.js +14 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.d.ts +16 -8
- package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.js +26 -12
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts +59 -0
- 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 +238 -1
- package/out/interface/controller/controller/control/i-tree-grid-ex.controller.d.ts +23 -1
- package/out/interface/controller/controller/control/i-tree-grid-ex.controller.d.ts.map +1 -1
- package/out/interface/controller/event/control/i-tree-grid-ex.event.d.ts +17 -0
- package/out/interface/controller/event/control/i-tree-grid-ex.event.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree-grid-ex.state.d.ts +60 -2
- package/out/interface/controller/state/control/i-tree-grid-ex.state.d.ts.map +1 -1
- package/out/interface/provider/i-async-action.provider.d.ts +3 -2
- package/out/interface/provider/i-async-action.provider.d.ts.map +1 -1
- package/out/plugin/index.d.ts +1 -1
- package/out/plugin/index.d.ts.map +1 -1
- package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts +41 -3
- package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts.map +1 -1
- package/out/register/helper/app-menu-item-register.d.ts.map +1 -1
- package/out/register/helper/app-menu-item-register.js +1 -6
- package/out/service/dto/method.dto.js +1 -1
- package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts +1 -1
- package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts.map +1 -1
- package/out/service/utils/dynamic-code-list/dynamic-code-list.js +16 -17
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +6 -0
- 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 +93 -41
- package/package.json +4 -4
- package/src/command/app/open-app-view/open-app-view.ts +2 -2
- package/src/controller/constant/control/index.ts +1 -0
- package/src/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.ts +5 -0
- package/src/controller/control/form/form/form.controller.ts +11 -1
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/index.ts +1 -0
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.ts +22 -0
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.ts +88 -2
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.ts +522 -0
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.ts +18 -1
- package/src/controller/control/tree-grid-ex/tree-grid-ex-row.state.ts +43 -12
- package/src/controller/control/tree-grid-ex/tree-grid-ex.controller.ts +296 -1
- package/src/interface/controller/controller/control/i-tree-grid-ex.controller.ts +27 -2
- package/src/interface/controller/event/control/i-tree-grid-ex.event.ts +15 -1
- package/src/interface/controller/state/control/i-tree-grid-ex.state.ts +64 -2
- package/src/interface/provider/i-async-action.provider.ts +3 -2
- package/src/plugin/index.ts +4 -1
- package/src/plugin/remote-plugin-item/remote-plugin-item.ts +38 -3
- package/src/register/helper/app-menu-item-register.ts +1 -5
- package/src/service/dto/method.dto.ts +1 -1
- package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +15 -23
- package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +111 -46
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IAppCodeList,
|
|
3
|
+
IDETreeNode,
|
|
4
|
+
IDETreeNodeDataItem,
|
|
5
|
+
IDETreeNodeEditItem,
|
|
6
|
+
IDETreeNodeFieldColumn,
|
|
7
|
+
IUIActionGroupDetail,
|
|
8
|
+
} from '@ibiz/model-core';
|
|
9
|
+
import {
|
|
10
|
+
DataTypes,
|
|
11
|
+
RuntimeError,
|
|
12
|
+
RuntimeModelError,
|
|
13
|
+
} from '@ibiz-template/core';
|
|
14
|
+
import { clone } from 'ramda';
|
|
15
|
+
import dayjs from 'dayjs';
|
|
16
|
+
import {
|
|
17
|
+
CodeListItem,
|
|
18
|
+
IEditorContainerController,
|
|
19
|
+
IEditorController,
|
|
20
|
+
IEditorProvider,
|
|
21
|
+
IModalData,
|
|
22
|
+
ITreeGridExRowState,
|
|
23
|
+
} from '../../../../../interface';
|
|
24
|
+
import { TreeGridExFieldColumnController } from './tree-grid-ex-field-column.controller';
|
|
25
|
+
import { getEditorProvider } from '../../../../../register';
|
|
26
|
+
import { convertNavData, getWFContext } from '../../../../../utils';
|
|
27
|
+
import { OpenAppViewCommand } from '../../../../../command';
|
|
28
|
+
import { parseUserParams } from '../../../../../model';
|
|
29
|
+
import { UIActionUtil } from '../../../../../ui-action';
|
|
30
|
+
import {
|
|
31
|
+
ButtonContainerState,
|
|
32
|
+
UIActionButtonState,
|
|
33
|
+
ValueExUtil,
|
|
34
|
+
} from '../../../../utils';
|
|
35
|
+
import { TreeGridExController } from '../../tree-grid-ex.controller';
|
|
36
|
+
import { TreeGridExNotifyState } from '../../../../constant';
|
|
37
|
+
import { TreeGridExRowState } from '../../tree-grid-ex-row.state';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 树表格的某一个属性列对应某一种实体节点的节点数据的控制器
|
|
41
|
+
* @author lxm
|
|
42
|
+
* @date 2024-01-09 10:07:02
|
|
43
|
+
* @export
|
|
44
|
+
* @class TreeGridExNodeColumnController
|
|
45
|
+
* @implements {IEditorContainerController}
|
|
46
|
+
*/
|
|
47
|
+
export class TreeGridExNodeColumnController
|
|
48
|
+
implements IEditorContainerController
|
|
49
|
+
{
|
|
50
|
+
/**
|
|
51
|
+
* 树节点表格列(必有,没有不会创建该控制器)
|
|
52
|
+
* @author lxm
|
|
53
|
+
* @date 2024-01-09 10:08:17
|
|
54
|
+
* @type {IDETreeNodeFieldColumn}
|
|
55
|
+
*/
|
|
56
|
+
nodeColumn!: IDETreeNodeFieldColumn;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 节点数据项
|
|
60
|
+
* @author lxm
|
|
61
|
+
* @date 2024-01-09 10:08:28
|
|
62
|
+
* @type {IDETreeNodeDataItem}
|
|
63
|
+
*/
|
|
64
|
+
nodeDataItem!: IDETreeNodeDataItem;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 节点编辑项(启用了行编辑才有)
|
|
68
|
+
* @author lxm
|
|
69
|
+
* @date 2024-01-09 10:09:15
|
|
70
|
+
* @type {IDETreeNodeEditItem}
|
|
71
|
+
*/
|
|
72
|
+
nodeEditItem?: IDETreeNodeEditItem;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 编辑器适配器
|
|
76
|
+
*
|
|
77
|
+
* @author lxm
|
|
78
|
+
* @date 2022-08-24 20:08:42
|
|
79
|
+
* @type {EditorController}
|
|
80
|
+
*/
|
|
81
|
+
editorProvider?: IEditorProvider;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 编辑器控制器
|
|
85
|
+
*
|
|
86
|
+
* @author lxm
|
|
87
|
+
* @date 2022-08-24 20:08:42
|
|
88
|
+
* @type {IEditorController}
|
|
89
|
+
*/
|
|
90
|
+
editor?: IEditorController;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 代码表项
|
|
94
|
+
*
|
|
95
|
+
* @author lxm
|
|
96
|
+
* @date 2022-09-28 16:09:51
|
|
97
|
+
* @type {readonly}
|
|
98
|
+
*/
|
|
99
|
+
codeListItems?: readonly CodeListItem[];
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 代码表模型
|
|
103
|
+
* @return {*}
|
|
104
|
+
* @author: zhujiamin
|
|
105
|
+
* @Date: 2023-05-24 10:55:50
|
|
106
|
+
*/
|
|
107
|
+
codeList: IAppCodeList | undefined = undefined;
|
|
108
|
+
|
|
109
|
+
get unitName(): string | undefined {
|
|
110
|
+
return this.nodeEditItem?.unitName;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
get valueFormat(): string | undefined {
|
|
114
|
+
return this.nodeColumn.valueFormat;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
get context(): IContext {
|
|
118
|
+
return this.fieldColumn.context;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
get params(): IParams {
|
|
122
|
+
return this.fieldColumn.params;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
get dataType(): number | undefined {
|
|
126
|
+
return this.nodeDataItem?.dataType;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 树表格列标识(用于取数和各种比较判断)
|
|
131
|
+
* @author lxm
|
|
132
|
+
* @date 2024-01-09 11:33:37
|
|
133
|
+
* @readonly
|
|
134
|
+
* @type {string}
|
|
135
|
+
*/
|
|
136
|
+
get name(): string {
|
|
137
|
+
return this.fieldColumn.name;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
*树表格增强部件
|
|
142
|
+
* @author lxm
|
|
143
|
+
* @date 2024-01-10 11:49:23
|
|
144
|
+
* @readonly
|
|
145
|
+
* @type {TreeGridExController}
|
|
146
|
+
*/
|
|
147
|
+
get treeGrid(): TreeGridExController {
|
|
148
|
+
return this.fieldColumn.treeGrid;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 是否是链接列
|
|
153
|
+
*
|
|
154
|
+
* @author lxm
|
|
155
|
+
* @date 2022-09-28 17:09:15
|
|
156
|
+
* @returns {*}
|
|
157
|
+
*/
|
|
158
|
+
get isLinkColumn(): boolean {
|
|
159
|
+
return !!this.nodeColumn.enableLinkView && !!this.nodeColumn.linkAppViewId;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 是否有触发界面行为
|
|
164
|
+
*
|
|
165
|
+
* @author lxm
|
|
166
|
+
* @date 2022-12-08 14:12:37
|
|
167
|
+
* @readonly
|
|
168
|
+
* @type {boolean}
|
|
169
|
+
*/
|
|
170
|
+
get hasClickAction(): boolean {
|
|
171
|
+
return !!this.nodeColumn.deuiactionId;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 单元格超出呈现模式
|
|
176
|
+
* @author lxm
|
|
177
|
+
* @date 2024-01-09 05:36:36
|
|
178
|
+
* @readonly
|
|
179
|
+
* @type {('wrap' | 'ellipsis')}
|
|
180
|
+
*/
|
|
181
|
+
get overflowMode(): 'wrap' | 'ellipsis' {
|
|
182
|
+
return this.fieldColumn.treeGrid.overflowMode;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @author lxm
|
|
187
|
+
* @date 2024-01-09 10:04:05
|
|
188
|
+
* @param {TreeGridExFieldColumnController} fieldColumn 树表格属性列控制器
|
|
189
|
+
* @param {IDETreeNode} nodeModel 对应实体节点模型
|
|
190
|
+
*/
|
|
191
|
+
constructor(
|
|
192
|
+
public fieldColumn: TreeGridExFieldColumnController,
|
|
193
|
+
public nodeModel: IDETreeNode,
|
|
194
|
+
) {
|
|
195
|
+
const { detreeNodeColumns, detreeNodeDataItems, detreeNodeEditItems } =
|
|
196
|
+
nodeModel;
|
|
197
|
+
|
|
198
|
+
const nodeColumn = detreeNodeColumns?.find(column => {
|
|
199
|
+
return column.detreeColumnId === this.fieldColumn.model.id;
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const nodeDataItem = detreeNodeDataItems?.find(
|
|
203
|
+
(treeNodeDataItem: IDETreeNodeDataItem) => {
|
|
204
|
+
return treeNodeDataItem.id === nodeColumn!.dataItemName;
|
|
205
|
+
},
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
if (!nodeColumn || !nodeDataItem) {
|
|
209
|
+
throw new RuntimeModelError(
|
|
210
|
+
nodeModel,
|
|
211
|
+
`节点没有配置对应表格列${this.fieldColumn.name}的数据项`,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
this.nodeColumn = nodeColumn;
|
|
216
|
+
this.nodeDataItem = nodeDataItem;
|
|
217
|
+
|
|
218
|
+
// 启用了行编辑就会有行编辑项
|
|
219
|
+
if (nodeColumn.enableRowEdit) {
|
|
220
|
+
const nodeEditItem = detreeNodeEditItems?.find(
|
|
221
|
+
(treeNodeEditItem: IDETreeNodeEditItem) => {
|
|
222
|
+
return treeNodeEditItem.id === nodeColumn.id;
|
|
223
|
+
},
|
|
224
|
+
);
|
|
225
|
+
if (!nodeEditItem) {
|
|
226
|
+
throw new RuntimeModelError(
|
|
227
|
+
nodeModel,
|
|
228
|
+
`没有找到对应表格列${this.fieldColumn.name}的编辑项模型`,
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
this.nodeEditItem = nodeEditItem;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* 初始化
|
|
237
|
+
* @author lxm
|
|
238
|
+
* @date 2024-01-09 10:02:16
|
|
239
|
+
* @return {*} {Promise<void>}
|
|
240
|
+
*/
|
|
241
|
+
async init(): Promise<void> {
|
|
242
|
+
if (
|
|
243
|
+
this.nodeEditItem?.editor &&
|
|
244
|
+
this.nodeEditItem.editor.editorType !== 'HIDDEN'
|
|
245
|
+
) {
|
|
246
|
+
this.editorProvider = await getEditorProvider(this.nodeEditItem.editor);
|
|
247
|
+
if (this.editorProvider) {
|
|
248
|
+
this.editor = await this.editorProvider.createController(
|
|
249
|
+
this.nodeEditItem.editor,
|
|
250
|
+
this,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// 没有编辑项的时候加载代码表,否则由编辑器去解析
|
|
256
|
+
if (!this.nodeEditItem) {
|
|
257
|
+
await this.loadCodeList();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* 初始化属性列界面行为组按钮状态
|
|
263
|
+
*
|
|
264
|
+
* @author lxm
|
|
265
|
+
* @date 2022-09-07 21:09:43
|
|
266
|
+
* @param {GridRowState} row
|
|
267
|
+
*/
|
|
268
|
+
initActionStates(row: ITreeGridExRowState): void {
|
|
269
|
+
// 属性列界面行为按钮状态
|
|
270
|
+
const { deuiactionGroup } = this.nodeColumn;
|
|
271
|
+
if (deuiactionGroup && deuiactionGroup.uiactionGroupDetails) {
|
|
272
|
+
const containerState = new ButtonContainerState();
|
|
273
|
+
deuiactionGroup.uiactionGroupDetails.forEach(detail => {
|
|
274
|
+
const actionid = detail.uiactionId;
|
|
275
|
+
if (actionid) {
|
|
276
|
+
const buttonState = new UIActionButtonState(
|
|
277
|
+
detail.id!,
|
|
278
|
+
this.context.srfappid!,
|
|
279
|
+
actionid,
|
|
280
|
+
);
|
|
281
|
+
containerState.addState(detail.id!, buttonState);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
row.columnActionsStates[this.name!] = containerState;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 文本点击事件
|
|
290
|
+
*
|
|
291
|
+
* @author zk
|
|
292
|
+
* @date 2023-07-13 12:07:53
|
|
293
|
+
* @param {MouseEvent} event
|
|
294
|
+
*/
|
|
295
|
+
onTextClick(row: ITreeGridExRowState, event: MouseEvent): void {
|
|
296
|
+
// 阻止触发行点击
|
|
297
|
+
if (this.isLinkColumn) {
|
|
298
|
+
event.stopPropagation();
|
|
299
|
+
this.openLinkView(row, event);
|
|
300
|
+
} else if (this.hasClickAction) {
|
|
301
|
+
event.stopPropagation();
|
|
302
|
+
this.triggerAction(row, event);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* 打开链接视图
|
|
308
|
+
*
|
|
309
|
+
* @author lxm
|
|
310
|
+
* @date 2024-01-09 02:45:34
|
|
311
|
+
* @param {ITreeGridExRowState} row
|
|
312
|
+
* @param {MouseEvent} event
|
|
313
|
+
* @return {*} {Promise<void>}
|
|
314
|
+
*/
|
|
315
|
+
async openLinkView(
|
|
316
|
+
row: ITreeGridExRowState,
|
|
317
|
+
event: MouseEvent,
|
|
318
|
+
): Promise<void> {
|
|
319
|
+
const curValue = (row.data as IData)[this.fieldColumn.name];
|
|
320
|
+
if (!curValue) {
|
|
321
|
+
// 当前值不存在,不继续走打开链接视图逻辑
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const valueItem = this.nodeColumn.linkValueItem || 'srfkey';
|
|
325
|
+
const value = (row.data as IData)[valueItem];
|
|
326
|
+
if (value == null) {
|
|
327
|
+
throw new RuntimeError(`未在行数据中取到 ${valueItem} 的值`);
|
|
328
|
+
}
|
|
329
|
+
const { linkAppViewId } = this.nodeColumn;
|
|
330
|
+
if (!linkAppViewId) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const wfContext = getWFContext(row.data);
|
|
334
|
+
const tempContext = Object.assign(this.context.clone(), {
|
|
335
|
+
srfkey: value,
|
|
336
|
+
...wfContext,
|
|
337
|
+
});
|
|
338
|
+
const tempParams = clone(this.params);
|
|
339
|
+
|
|
340
|
+
// *自定义参数转换额外的上下文和视图参数
|
|
341
|
+
const { userParam } = this.nodeColumn;
|
|
342
|
+
if (userParam) {
|
|
343
|
+
const { navigateContexts, navigateParams } = parseUserParams(userParam);
|
|
344
|
+
let selfContext = {};
|
|
345
|
+
if (navigateContexts && row.data) {
|
|
346
|
+
selfContext = convertNavData(
|
|
347
|
+
navigateContexts!,
|
|
348
|
+
row.data,
|
|
349
|
+
tempParams,
|
|
350
|
+
tempContext,
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
Object.assign(tempContext, selfContext);
|
|
354
|
+
let selfParams = {};
|
|
355
|
+
if (navigateParams && row.data) {
|
|
356
|
+
selfParams = convertNavData(
|
|
357
|
+
navigateParams!,
|
|
358
|
+
row.data,
|
|
359
|
+
tempParams,
|
|
360
|
+
tempContext,
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
Object.assign(tempParams, selfParams);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// 打开视图
|
|
367
|
+
const res: IModalData = await ibiz.commands.execute(
|
|
368
|
+
OpenAppViewCommand.TAG,
|
|
369
|
+
linkAppViewId,
|
|
370
|
+
tempContext,
|
|
371
|
+
tempParams,
|
|
372
|
+
{ event },
|
|
373
|
+
);
|
|
374
|
+
if (res?.ok) {
|
|
375
|
+
this.fieldColumn.treeGrid.refresh();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* 触发表格列附加界面行为
|
|
381
|
+
*
|
|
382
|
+
* @author lxm
|
|
383
|
+
* @date 2022-12-08 15:12:35
|
|
384
|
+
* @param {GridRowState} row 行数据
|
|
385
|
+
* @param {MouseEvent} event 鼠标事件
|
|
386
|
+
* @returns {*} {Promise<void>}
|
|
387
|
+
*/
|
|
388
|
+
async triggerAction(
|
|
389
|
+
row: ITreeGridExRowState,
|
|
390
|
+
event: MouseEvent,
|
|
391
|
+
): Promise<void> {
|
|
392
|
+
const actionId = this.nodeColumn.deuiactionId;
|
|
393
|
+
await UIActionUtil.execAndResolved(
|
|
394
|
+
actionId!,
|
|
395
|
+
{
|
|
396
|
+
context: this.context,
|
|
397
|
+
params: this.params,
|
|
398
|
+
data: [row.data],
|
|
399
|
+
view: this.treeGrid.view,
|
|
400
|
+
event,
|
|
401
|
+
},
|
|
402
|
+
this.nodeColumn.appId,
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* 触发界面行为组点击事件
|
|
408
|
+
*
|
|
409
|
+
* @author lxm
|
|
410
|
+
* @date 2024-01-11 02:26:12
|
|
411
|
+
* @param {IUIActionGroupDetail} detail
|
|
412
|
+
* @param {ITreeGridExRowState} row
|
|
413
|
+
* @param {MouseEvent} event
|
|
414
|
+
* @return {*} {Promise<void>}
|
|
415
|
+
*/
|
|
416
|
+
async onActionClick(
|
|
417
|
+
detail: IUIActionGroupDetail,
|
|
418
|
+
row: ITreeGridExRowState,
|
|
419
|
+
event: MouseEvent,
|
|
420
|
+
): Promise<void> {
|
|
421
|
+
const actionId = detail.uiactionId;
|
|
422
|
+
await UIActionUtil.execAndResolved(
|
|
423
|
+
actionId!,
|
|
424
|
+
{
|
|
425
|
+
context: this.context,
|
|
426
|
+
params: this.params,
|
|
427
|
+
data: [row.data],
|
|
428
|
+
view: this.treeGrid.view,
|
|
429
|
+
event,
|
|
430
|
+
},
|
|
431
|
+
detail.appId,
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* 值格式化
|
|
437
|
+
* @author lxm
|
|
438
|
+
* @date 2024-01-09 03:37:34
|
|
439
|
+
* @param {unknown} [value='']
|
|
440
|
+
* @return {*} {string}
|
|
441
|
+
*/
|
|
442
|
+
formatValue(value: unknown = ''): string {
|
|
443
|
+
// 根据数据类型增强转换显示文本
|
|
444
|
+
if (this.nodeColumn.valueType !== 'SIMPLE') {
|
|
445
|
+
return ValueExUtil.toText(this.nodeColumn, value);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// 根据格式化配置格式化显示
|
|
449
|
+
const strVal = `${value}`;
|
|
450
|
+
if (!this.valueFormat) {
|
|
451
|
+
return strVal;
|
|
452
|
+
}
|
|
453
|
+
const isDate = DataTypes.isDate(this.dataType!);
|
|
454
|
+
if (isDate || this.fieldColumn.name === 'createdate') {
|
|
455
|
+
const formatVal = dayjs(strVal).format(this.valueFormat);
|
|
456
|
+
if (formatVal !== 'Invalid Date') {
|
|
457
|
+
return formatVal;
|
|
458
|
+
}
|
|
459
|
+
return strVal;
|
|
460
|
+
}
|
|
461
|
+
return ibiz.util.text.format(strVal, this.valueFormat);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* 加载代码表数据
|
|
466
|
+
*
|
|
467
|
+
* @author lxm
|
|
468
|
+
* @date 2022-09-28 15:09:38
|
|
469
|
+
* @returns {*}
|
|
470
|
+
*/
|
|
471
|
+
async loadCodeList(): Promise<Readonly<CodeListItem[]> | undefined> {
|
|
472
|
+
const appCodeListId = this.nodeColumn.appCodeListId!;
|
|
473
|
+
if (!appCodeListId) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
const app = ibiz.hub.getApp(this.context.srfappid);
|
|
477
|
+
|
|
478
|
+
// 顺便加载代码表模型
|
|
479
|
+
if (!this.codeList) {
|
|
480
|
+
this.codeList = app.codeList.getCodeList(appCodeListId);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const dataItems = await app.codeList.get(
|
|
484
|
+
appCodeListId,
|
|
485
|
+
this.context,
|
|
486
|
+
this.params,
|
|
487
|
+
);
|
|
488
|
+
this.codeListItems = dataItems;
|
|
489
|
+
return dataItems;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
gridStateNotify(row: TreeGridExRowState, state: TreeGridExNotifyState): void {
|
|
493
|
+
if (
|
|
494
|
+
state === TreeGridExNotifyState.LOAD ||
|
|
495
|
+
state === TreeGridExNotifyState.SAVE
|
|
496
|
+
) {
|
|
497
|
+
const uaColState = row.columnActionsStates[this.name];
|
|
498
|
+
if (uaColState && row.data._nodeType === 'DE') {
|
|
499
|
+
// 实体节点更新操作列状态
|
|
500
|
+
uaColState.update(row.data._deData);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* 设置行属性的值
|
|
507
|
+
*
|
|
508
|
+
* @author lxm
|
|
509
|
+
* @date 2022-08-24 10:08:40
|
|
510
|
+
* @param {GridRowState} row 行状态控制器
|
|
511
|
+
* @param {unknown} value 要设置的值
|
|
512
|
+
* @param {string} name 要设置的表单数据的属性名称
|
|
513
|
+
*/
|
|
514
|
+
async setRowValue(
|
|
515
|
+
row: TreeGridExRowState,
|
|
516
|
+
value: unknown,
|
|
517
|
+
name?: string,
|
|
518
|
+
): Promise<void> {
|
|
519
|
+
name = name || this.name;
|
|
520
|
+
await this.treeGrid.setRowValue(row, name, value);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
@@ -5,6 +5,8 @@ import { UIActionUtil } from '../../../../../ui-action';
|
|
|
5
5
|
import { ButtonContainerState, UIActionButtonState } from '../../../../utils';
|
|
6
6
|
import { TreeGridExColumnController } from '../tree-grid-ex-column/tree-grid-ex-column.controller';
|
|
7
7
|
import { ITreeGridExRowState } from '../../../../../interface';
|
|
8
|
+
import { TreeGridExNotifyState } from '../../../../constant';
|
|
9
|
+
import { TreeGridExRowState } from '../../tree-grid-ex-row.state';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* 树表格(增强)操作列控制器
|
|
@@ -26,6 +28,7 @@ export class TreeGridExUAColumnController extends TreeGridExColumnController<IDE
|
|
|
26
28
|
// 操作列按钮状态控制
|
|
27
29
|
const { deuiactionGroup } = this.model;
|
|
28
30
|
if (!deuiactionGroup) {
|
|
31
|
+
return;
|
|
29
32
|
throw new RuntimeModelError(this.model, '操作列没有配置界面行为组');
|
|
30
33
|
}
|
|
31
34
|
if (!deuiactionGroup.uiactionGroupDetails?.length) {
|
|
@@ -44,7 +47,7 @@ export class TreeGridExUAColumnController extends TreeGridExColumnController<IDE
|
|
|
44
47
|
containerState.addState(detail.id!, buttonState);
|
|
45
48
|
}
|
|
46
49
|
});
|
|
47
|
-
row.
|
|
50
|
+
row.columnActionsStates[this.model.id!] = containerState;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
/**
|
|
@@ -73,4 +76,18 @@ export class TreeGridExUAColumnController extends TreeGridExColumnController<IDE
|
|
|
73
76
|
detail.appId,
|
|
74
77
|
);
|
|
75
78
|
}
|
|
79
|
+
|
|
80
|
+
gridStateNotify(row: TreeGridExRowState, state: TreeGridExNotifyState): void {
|
|
81
|
+
super.gridStateNotify(row, state);
|
|
82
|
+
if (
|
|
83
|
+
state === TreeGridExNotifyState.LOAD ||
|
|
84
|
+
state === TreeGridExNotifyState.SAVE
|
|
85
|
+
) {
|
|
86
|
+
const uaColState = row.columnActionsStates[this.model.id!];
|
|
87
|
+
if (uaColState && row.data._nodeType === 'DE') {
|
|
88
|
+
// 实体节点更新操作列状态
|
|
89
|
+
uaColState.update(row.data._deData);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
76
93
|
}
|
|
@@ -17,20 +17,51 @@ import { TreeGridExController } from './tree-grid-ex.controller';
|
|
|
17
17
|
export class TreeGridExRowState implements ITreeGridExRowState {
|
|
18
18
|
data: ITreeNodeData;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
cacheData?: ITreeNodeData;
|
|
21
|
+
|
|
22
|
+
errors: { [p: string]: string | null } = {};
|
|
23
|
+
|
|
24
|
+
columnActionsStates: { [p: string]: IButtonContainerState } = {};
|
|
25
|
+
|
|
26
|
+
editColStates: {
|
|
27
|
+
[p: string]: {
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
readonly: boolean;
|
|
30
|
+
editable: boolean;
|
|
31
|
+
required: boolean;
|
|
32
|
+
};
|
|
33
|
+
} = {};
|
|
34
|
+
|
|
35
|
+
modified: boolean = false;
|
|
36
|
+
|
|
37
|
+
showRowEdit: boolean = false;
|
|
38
|
+
|
|
39
|
+
processing: boolean = false;
|
|
28
40
|
|
|
29
41
|
constructor(data: ITreeNodeData, treeGrid: TreeGridExController) {
|
|
30
42
|
this.data = data;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
|
|
44
|
+
// 实体类型节点才需要初始化这些
|
|
45
|
+
if (data._nodeType === 'DE') {
|
|
46
|
+
// 初始化操作列状态
|
|
47
|
+
Object.values(treeGrid.uaColumns).forEach(column => {
|
|
48
|
+
column.initActionStates(this);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// 初始化属性列的界面行为组状态
|
|
52
|
+
Object.values(treeGrid.fieldColumns).forEach(column => {
|
|
53
|
+
column.initActionStates(this);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// 初始化编辑项状态
|
|
57
|
+
Object.values(treeGrid.fieldColumns).forEach(fieldColumn => {
|
|
58
|
+
this.editColStates[fieldColumn.name] = {
|
|
59
|
+
disabled: false,
|
|
60
|
+
readonly: false,
|
|
61
|
+
editable: ibiz.config.grid.editShowMode === 'all',
|
|
62
|
+
required: false,
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
35
66
|
}
|
|
36
67
|
}
|