@ibiz-template/runtime 0.1.26 → 0.1.27

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.
Files changed (79) hide show
  1. package/dist/index.esm.js +452 -261
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/common/control/md-control.controller.d.ts +1 -0
  5. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  6. package/out/controller/common/control/md-control.controller.js +7 -0
  7. package/out/controller/control/data-view/data-view.controller.d.ts +42 -1
  8. package/out/controller/control/data-view/data-view.controller.d.ts.map +1 -1
  9. package/out/controller/control/data-view/data-view.controller.js +126 -0
  10. package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
  11. package/out/controller/control/exp-bar/exp-bar.controller.js +4 -1
  12. package/out/controller/control/form/edit-form/edit-form.controller.d.ts +1 -0
  13. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  14. package/out/controller/control/form/edit-form/edit-form.controller.js +7 -0
  15. package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
  16. package/out/controller/control/form/form-detail/form-item/form-item.controller.js +10 -68
  17. package/out/controller/control/form/search-form/search-form.controller.d.ts +1 -0
  18. package/out/controller/control/form/search-form/search-form.controller.d.ts.map +1 -1
  19. package/out/controller/control/form/search-form/search-form.controller.js +7 -0
  20. package/out/controller/control/grid/grid/grid-row.state.d.ts +1 -0
  21. package/out/controller/control/grid/grid/grid-row.state.d.ts.map +1 -1
  22. package/out/controller/control/grid/grid/grid.controller.d.ts +10 -0
  23. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  24. package/out/controller/control/grid/grid/grid.controller.js +61 -17
  25. package/out/controller/control/kanban/kanban.controller.d.ts +1 -34
  26. package/out/controller/control/kanban/kanban.controller.d.ts.map +1 -1
  27. package/out/controller/control/kanban/kanban.controller.js +0 -83
  28. package/out/controller/control/tab-exp-panel/tab-exp-panel.controller.d.ts +20 -0
  29. package/out/controller/control/tab-exp-panel/tab-exp-panel.controller.d.ts.map +1 -1
  30. package/out/controller/control/tab-exp-panel/tab-exp-panel.controller.js +45 -0
  31. package/out/controller/utils/index.d.ts +1 -0
  32. package/out/controller/utils/index.d.ts.map +1 -1
  33. package/out/controller/utils/index.js +1 -0
  34. package/out/controller/utils/value-default/value-default.d.ts +37 -0
  35. package/out/controller/utils/value-default/value-default.d.ts.map +1 -0
  36. package/out/controller/utils/value-default/value-default.js +65 -0
  37. package/out/de-logic/de-logic-node/end-node/end-node.d.ts.map +1 -1
  38. package/out/de-logic/de-logic-node/end-node/end-node.js +4 -0
  39. package/out/engine/md-view.engine.d.ts.map +1 -1
  40. package/out/engine/md-view.engine.js +7 -0
  41. package/out/interface/controller/state/control/i-control.state.d.ts +7 -0
  42. package/out/interface/controller/state/control/i-control.state.d.ts.map +1 -1
  43. package/out/interface/controller/state/control/i-data-view-control.state.d.ts +8 -0
  44. package/out/interface/controller/state/control/i-data-view-control.state.d.ts.map +1 -1
  45. package/out/interface/controller/state/control/i-grid.state.d.ts +7 -0
  46. package/out/interface/controller/state/control/i-grid.state.d.ts.map +1 -1
  47. package/out/interface/controller/state/control/i-kanban.state.d.ts +0 -8
  48. package/out/interface/controller/state/control/i-kanban.state.d.ts.map +1 -1
  49. package/out/interface/controller/state/control/i-md-control.state.d.ts +14 -0
  50. package/out/interface/controller/state/control/i-md-control.state.d.ts.map +1 -1
  51. package/out/interface/controller/state/control/i-tab-exp-panel.state.d.ts +8 -0
  52. package/out/interface/controller/state/control/i-tab-exp-panel.state.d.ts.map +1 -1
  53. package/out/model/layout/layout.d.ts.map +1 -1
  54. package/out/model/layout/layout.js +17 -1
  55. package/out/ui-logic/ui-logic-node/end-node/end-node.d.ts.map +1 -1
  56. package/out/ui-logic/ui-logic-node/end-node/end-node.js +4 -0
  57. package/package.json +4 -4
  58. package/src/controller/common/control/md-control.controller.ts +9 -0
  59. package/src/controller/control/data-view/data-view.controller.ts +147 -0
  60. package/src/controller/control/exp-bar/exp-bar.controller.ts +5 -1
  61. package/src/controller/control/form/edit-form/edit-form.controller.ts +9 -0
  62. package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +13 -67
  63. package/src/controller/control/form/search-form/search-form.controller.ts +9 -0
  64. package/src/controller/control/grid/grid/grid-row.state.ts +2 -0
  65. package/src/controller/control/grid/grid/grid.controller.ts +69 -18
  66. package/src/controller/control/kanban/kanban.controller.ts +1 -98
  67. package/src/controller/control/tab-exp-panel/tab-exp-panel.controller.ts +45 -0
  68. package/src/controller/utils/index.ts +1 -0
  69. package/src/controller/utils/value-default/value-default.ts +110 -0
  70. package/src/de-logic/de-logic-node/end-node/end-node.ts +6 -0
  71. package/src/engine/md-view.engine.ts +8 -0
  72. package/src/interface/controller/state/control/i-control.state.ts +8 -0
  73. package/src/interface/controller/state/control/i-data-view-control.state.ts +10 -1
  74. package/src/interface/controller/state/control/i-grid.state.ts +8 -0
  75. package/src/interface/controller/state/control/i-kanban.state.ts +0 -9
  76. package/src/interface/controller/state/control/i-md-control.state.ts +16 -0
  77. package/src/interface/controller/state/control/i-tab-exp-panel.state.ts +9 -0
  78. package/src/model/layout/layout.ts +16 -2
  79. package/src/ui-logic/ui-logic-node/end-node/end-node.ts +6 -0
@@ -1,5 +1,5 @@
1
1
  import { RuntimeError, RuntimeModelError } from '@ibiz-template/core';
2
- import { IDEKanban, IUIActionGroupDetail } from '@ibiz/model-core';
2
+ import { IDEKanban } from '@ibiz/model-core';
3
3
  import { isNil } from 'ramda';
4
4
  import {
5
5
  IDragChangeInfo,
@@ -10,8 +10,6 @@ import {
10
10
  } from '../../../interface';
11
11
  import { calcDeCodeNameById } from '../../../model';
12
12
  import { ControlVO } from '../../../service';
13
- import { UIActionUtil } from '../../../ui-action';
14
- import { ButtonContainerState, UIActionButtonState } from '../../utils';
15
13
  import { DataViewControlController } from '../data-view';
16
14
  import { KanbanService } from './kanban.service';
17
15
 
@@ -49,17 +47,6 @@ export class KanbanController
49
47
  return this.model.enableCardEditGroup === true;
50
48
  }
51
49
 
52
- /**
53
- * 是否允许新建
54
- * @author lxm
55
- * @date 2023-09-11 04:05:25
56
- * @readonly
57
- * @type {boolean}
58
- */
59
- get enableNew(): boolean {
60
- return this.model.enableCardNew === true;
61
- }
62
-
63
50
  protected async initControlService(): Promise<void> {
64
51
  this.service = new KanbanService(this.model);
65
52
  await this.service.init(this.context);
@@ -82,48 +69,6 @@ export class KanbanController
82
69
  */
83
70
  protected async onCreated(): Promise<void> {
84
71
  await super.onCreated();
85
- await this.initGroupActionStates();
86
- }
87
-
88
- /**
89
- * 初始化分组右侧界面行为按钮的状态
90
- *
91
- * @author chitanda
92
- * @date 2023-08-02 17:08:04
93
- * @return {*} {Promise<void>}
94
- */
95
- async initGroupActionStates(): Promise<void> {
96
- const { groupUIActionGroup } = this.model;
97
- if (!groupUIActionGroup?.uiactionGroupDetails?.length) {
98
- return;
99
- }
100
- const containerState = new ButtonContainerState();
101
- groupUIActionGroup.uiactionGroupDetails.forEach(detail => {
102
- const actionid = detail.uiactionId;
103
- if (actionid) {
104
- const buttonState = new UIActionButtonState(
105
- detail.id!,
106
- this.context.srfappid!,
107
- actionid,
108
- );
109
- containerState.addState(detail.id!, buttonState);
110
- }
111
- });
112
- await containerState.update();
113
- this.state.groupActionGroupState = containerState;
114
-
115
- this.evt.on('onSelectionChange', event => {
116
- let data = event.data[0];
117
- if (data && data instanceof ControlVO) {
118
- data = data.getOrigin();
119
- }
120
- if (data) {
121
- this.state.groupActionGroupState!.update(
122
- data,
123
- this.model.appDataEntityId!,
124
- );
125
- }
126
- });
127
72
  }
128
73
 
129
74
  /**
@@ -325,46 +270,4 @@ export class KanbanController
325
270
  await this.afterLoad({}, this.state.items);
326
271
  }
327
272
  }
328
-
329
- /**
330
- * 点击新建
331
- * @author lxm
332
- * @date 2023-09-11 07:22:33
333
- * @param {MouseEvent} event
334
- * @param {(string | number)} group 分组标识
335
- */
336
- onClickNew(event: MouseEvent, group: string | number): void {
337
- const params = { ...this.params, srfgroup: group };
338
- UIActionUtil.execAndResolved('new', {
339
- context: this.context,
340
- params,
341
- data: [],
342
- view: this.view,
343
- event,
344
- });
345
- }
346
-
347
- /**
348
- * 分组工具栏点击处理回调
349
- * @author lxm
350
- * @date 2023-09-11 04:48:06
351
- * @param {IUIActionGroupDetail} detail
352
- * @param {MouseEvent} event
353
- * @return {*} {Promise<void>}
354
- */
355
- async onGroupToolbarClick(
356
- detail: IUIActionGroupDetail,
357
- event: MouseEvent,
358
- group: string | number,
359
- ): Promise<void> {
360
- const actionId = detail.uiactionId;
361
- const params = { ...this.params, srfgroup: group };
362
- await UIActionUtil.execAndResolved(actionId!, {
363
- context: this.context,
364
- params,
365
- data: this.state.selectedData,
366
- view: this.view,
367
- event,
368
- });
369
- }
370
273
  }
@@ -22,6 +22,22 @@ export class TabExpPanelController
22
22
  extends ControlController<ITabExpPanel, ITabExpPanelState, ITabExpPanelEvent>
23
23
  implements ITabExpPanelController
24
24
  {
25
+ /**
26
+ * 是否显示文本
27
+ * @return {*}
28
+ * @author: zhujiamin
29
+ * @Date: 2023-09-20 10:36:35
30
+ */
31
+ isShowCaption = true;
32
+
33
+ /**
34
+ * 是否显示图标
35
+ * @return {*}
36
+ * @author: zhujiamin
37
+ * @Date: 2023-09-20 10:36:46
38
+ */
39
+ isShowIcon = false;
40
+
25
41
  /**
26
42
  * 初始化state的属性
27
43
  *
@@ -46,6 +62,7 @@ export class TabExpPanelController
46
62
  this.layoutPanel = this.view.layoutPanel!;
47
63
 
48
64
  this.initTabPages();
65
+ this.initIconCaption();
49
66
  }
50
67
 
51
68
  /**
@@ -61,6 +78,7 @@ export class TabExpPanelController
61
78
  caption: panel.caption!,
62
79
  tabTag: panel.id!,
63
80
  class: panel.sysCss ? [panel.sysCss.cssName!] : [],
81
+ sysImage: panel.sysImage,
64
82
  });
65
83
  });
66
84
  this.state.tabPages = tabPages;
@@ -69,6 +87,33 @@ export class TabExpPanelController
69
87
  }
70
88
  }
71
89
 
90
+ /**
91
+ * 初始化图标和文本显示
92
+ *
93
+ * @memberof TabExpPanelController
94
+ */
95
+ initIconCaption(): void {
96
+ // 临时处理,视图参数那边配置showMode决定显示
97
+ if (this.params.showmode) {
98
+ switch (this.params.showmode) {
99
+ case 'ICONANDSHORTWORD':
100
+ this.isShowIcon = true;
101
+ this.isShowCaption = true;
102
+ break;
103
+ case 'ICON':
104
+ this.isShowIcon = true;
105
+ this.isShowCaption = false;
106
+ break;
107
+ case 'SHORTWORD':
108
+ this.isShowIcon = false;
109
+ this.isShowCaption = true;
110
+ break;
111
+ default:
112
+ break;
113
+ }
114
+ }
115
+ }
116
+
72
117
  /**
73
118
  * 初始化默认分页
74
119
  *
@@ -5,3 +5,4 @@ export * from './event';
5
5
  export * from './util/util';
6
6
  export * from './value-rule/value-rule';
7
7
  export * from './value-ex/value-ex';
8
+ export * from './value-default/value-default';
@@ -0,0 +1,110 @@
1
+ import { RuntimeError, ModelError } from '@ibiz-template/core';
2
+ import dayjs from 'dayjs';
3
+ import { createUUID } from 'qx-util';
4
+ import { isNil, isNotNil } from 'ramda';
5
+
6
+ export type DefaultValueOrigins = {
7
+ data: IData;
8
+ context: IParams;
9
+ params: IParams;
10
+ };
11
+
12
+ export type DefaultValueOpts = {
13
+ /**
14
+ * 属性名称
15
+ * @author lxm
16
+ * @date 2023-09-18 03:47:18
17
+ * @type {string}
18
+ */
19
+ name: string;
20
+ /**
21
+ * 默认值类型
22
+ * @author lxm
23
+ * @date 2023-09-18 03:47:24
24
+ * @type {string}
25
+ */
26
+ valueType?: string;
27
+ /**
28
+ * 默认值
29
+ * @author lxm
30
+ * @date 2023-09-18 03:47:31
31
+ * @type {string}
32
+ */
33
+ defaultValue?: string;
34
+ /**
35
+ * 值格式化
36
+ * @author lxm
37
+ * @date 2023-09-18 03:47:36
38
+ * @type {string}
39
+ */
40
+ valueFormat?: string;
41
+ };
42
+
43
+ export function getDefaultValue(
44
+ opts: DefaultValueOpts,
45
+ origins: DefaultValueOrigins,
46
+ ): unknown {
47
+ const { name, valueType, defaultValue, valueFormat } = opts;
48
+ const { data, context, params } = origins;
49
+
50
+ // 没有配置默认值,不处理返回undefined
51
+ if (isNil(valueType) && isNil(defaultValue)) {
52
+ return;
53
+ }
54
+
55
+ // 类型为置空的时候
56
+ if (valueType === 'RESET') {
57
+ return null;
58
+ }
59
+
60
+ const value = data[name];
61
+ // 除置空之外的默认值类型,有值的时候不处理返回undefined
62
+ if (isNotNil(value)) {
63
+ return;
64
+ }
65
+
66
+ // 没有配类型,配了默认值的直接赋值默认值
67
+ if (!valueType && defaultValue) {
68
+ return defaultValue;
69
+ }
70
+
71
+ switch (valueType) {
72
+ // 当前应用数据,优先取视图参数,视图参数没有取上下文
73
+ case 'APPDATA':
74
+ if (Object.prototype.hasOwnProperty.call(params, defaultValue!)) {
75
+ return params[defaultValue!];
76
+ }
77
+ if (Object.prototype.hasOwnProperty.call(context, defaultValue!)) {
78
+ return context[defaultValue!];
79
+ }
80
+ break;
81
+ // 当前操作用户(名称)
82
+ case 'OPERATORNAME':
83
+ return context.srfusername;
84
+ // 当前操作用户(编号)
85
+ case 'OPERATOR':
86
+ return context.srfuserid;
87
+ // 当前时间
88
+ case 'CURTIME':
89
+ return dayjs().format(valueFormat);
90
+ // 数据对象属性
91
+ case 'PARAM':
92
+ return data[defaultValue!];
93
+ case 'SESSION': // 用户全局对象
94
+ case 'APPLICATION': // 系统全局对象
95
+ // 取appData里的上下文
96
+ if (!ibiz.appData?.context) {
97
+ throw new RuntimeError('appdata.context不存在');
98
+ }
99
+ return ibiz.appData.context[defaultValue!];
100
+ // 网页请求用视图参数
101
+ case 'CONTEXT':
102
+ return params[defaultValue!];
103
+ // 唯一编码
104
+ case 'UNIQUEID':
105
+ return createUUID();
106
+ default:
107
+ // 未支持类型
108
+ throw new ModelError({}, `默认值类型[${valueType}]未支持`);
109
+ }
110
+ }
@@ -18,6 +18,12 @@ export class EndNode extends DELogicNode {
18
18
  async exec(ctx: DELogicContext): Promise<void> {
19
19
  ctx.isEndNode = true;
20
20
  const { returnParamId, returnType, rawValue } = this.model;
21
+
22
+ // 没配置不做处理
23
+ if (!returnType) {
24
+ return;
25
+ }
26
+
21
27
  switch (returnType) {
22
28
  case 'NONEVALUE': // 无值(NONE)
23
29
  ctx.result = undefined;
@@ -78,6 +78,14 @@ export class MDViewEngine extends ViewEngineBase {
78
78
  await super.onCreated();
79
79
  const { childNames } = this.view;
80
80
  childNames.push(this.xdataControlName!, 'searchform', 'searchbar');
81
+
82
+ // 存在xdataControlName名称时就是普通多数据视图,给对应的多数据部件传递noLoadDefault
83
+ if (this.xdataControlName) {
84
+ if (!this.view.slotProps[this.xdataControlName]) {
85
+ this.view.slotProps[this.xdataControlName] = {};
86
+ }
87
+ this.view.slotProps[this.xdataControlName].loadDefault = false;
88
+ }
81
89
  }
82
90
 
83
91
  async onMounted(): Promise<void> {
@@ -17,4 +17,12 @@ export interface IControlState extends IControllerState {
17
17
  * @type {boolean}
18
18
  */
19
19
  isLoading: boolean;
20
+
21
+ /**
22
+ * 默认加载
23
+ * @author lxm
24
+ * @date 2023-07-28 04:29:49
25
+ * @type {boolean}
26
+ */
27
+ loadDefault: boolean;
20
28
  }
@@ -1,3 +1,4 @@
1
+ import { IButtonContainerState } from '../../common';
1
2
  import { IMDControlState } from './i-md-control.state';
2
3
 
3
4
  /**
@@ -7,4 +8,12 @@ import { IMDControlState } from './i-md-control.state';
7
8
  * @interface IDataViewControlState
8
9
  * @extends {IMDControlState}
9
10
  */
10
- export interface IDataViewControlState extends IMDControlState {}
11
+ export interface IDataViewControlState extends IMDControlState {
12
+ /**
13
+ * 分组界面行为组状态
14
+ *
15
+ * @type {(IButtonContainerState)}
16
+ * @memberof PortletPartState
17
+ */
18
+ groupActionGroupState?: IButtonContainerState;
19
+ }
@@ -115,6 +115,14 @@ export interface IGridRowState {
115
115
  * @memberof GridRowState
116
116
  */
117
117
  processing: boolean;
118
+
119
+ /**
120
+ * 缓存的数据对象
121
+ * @author lxm
122
+ * @date 2023-09-18 05:11:32
123
+ * @type {IData}
124
+ */
125
+ cacheData?: ControlVO;
118
126
  }
119
127
 
120
128
  /**
@@ -1,4 +1,3 @@
1
- import { IButtonContainerState } from '../../common';
2
1
  import { IDataViewControlState } from './i-data-view-control.state';
3
2
 
4
3
  /**
@@ -24,12 +23,4 @@ export interface IKanbanState extends IDataViewControlState {
24
23
  * @type {boolean}
25
24
  */
26
25
  updating: boolean;
27
-
28
- /**
29
- * 分组界面行为组状态
30
- *
31
- * @type {(IButtonContainerState)}
32
- * @memberof PortletPartState
33
- */
34
- groupActionGroupState?: IButtonContainerState;
35
26
  }
@@ -1,3 +1,4 @@
1
+ import { IButtonContainerState } from '../../common';
1
2
  import { IControlState } from './i-control.state';
2
3
 
3
4
  export interface IMDControlState extends IControlState {
@@ -114,4 +115,19 @@ export interface IMDControlGroupState {
114
115
  * @type {string}
115
116
  */
116
117
  key: string | number;
118
+
119
+ /**
120
+ * 分组界面行为组状态
121
+ *
122
+ * @type {(IButtonContainerState)}
123
+ * @memberof IMDControlGroupState
124
+ */
125
+ groupActionGroupState?: IButtonContainerState;
126
+
127
+ /**
128
+ * 当前分组已选中的数据集合
129
+ *
130
+ * @type {IData[]}
131
+ */
132
+ selectedData?: IData[];
117
133
  }
@@ -1,3 +1,4 @@
1
+ import { ISysImage } from '@ibiz/model-core';
1
2
  import { IControlState } from './i-control.state';
2
3
 
3
4
  /**
@@ -72,4 +73,12 @@ export interface ITabExpPanelPagesState {
72
73
  * @type {string[]}
73
74
  */
74
75
  class: string[];
76
+
77
+ /**
78
+ * 标题图标
79
+ * @author lxm
80
+ * @date 2023-07-25 02:51:28
81
+ * @type {string[]}
82
+ */
83
+ sysImage?: ISysImage;
75
84
  }
@@ -1,4 +1,5 @@
1
1
  import { IGridLayoutPos, ILayoutPos } from '@ibiz/model-core';
2
+ import { isArray, isObject, isString } from 'lodash-es';
2
3
  import type { GridLayoutAttrs, ScreenSize } from '../../interface';
3
4
  import { ScriptFactory } from '../../utils';
4
5
 
@@ -145,8 +146,21 @@ export function calcGridLayoutPos(
145
146
  * @return {*} {string[]}
146
147
  */
147
148
  export function calcDynaClass(expression: string, data: IData): string[] {
148
- return ScriptFactory.execScriptFn({ data }, expression, {
149
+ const classArr: string[] = [];
150
+ const result = ScriptFactory.execScriptFn({ data }, expression, {
149
151
  singleRowReturn: true,
150
152
  isAsync: false,
151
- }) as string[];
153
+ });
154
+ if (isString(result)) {
155
+ classArr.push(result);
156
+ } else if (isArray(result)) {
157
+ classArr.push(...result);
158
+ } else if (isObject(result)) {
159
+ Object.keys(result).forEach(key => {
160
+ if ((result as IData)[key]) {
161
+ classArr.push(key);
162
+ }
163
+ });
164
+ }
165
+ return classArr;
152
166
  }
@@ -18,6 +18,12 @@ export class EndNode extends UILogicNode {
18
18
  async exec(ctx: UILogicContext): Promise<void> {
19
19
  ctx.isEndNode = true;
20
20
  const { returnType, rawValue, returnParamId } = this.model;
21
+
22
+ // 没配置不做处理
23
+ if (!returnType) {
24
+ return;
25
+ }
26
+
21
27
  switch (returnType) {
22
28
  case 'NONEVALUE': // 无值(NONE)
23
29
  ctx.result = undefined;