@ibiz-template/runtime 0.5.7-alpha.5 → 0.5.7-alpha.7

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 (32) hide show
  1. package/dist/index.esm.js +212 -89
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/control/calendar/calendar.service.d.ts.map +1 -1
  4. package/out/controller/control/calendar/calendar.service.js +7 -1
  5. package/out/controller/control/grid/grid/grid.controller.d.ts +1 -0
  6. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  7. package/out/controller/control/grid/grid/grid.controller.js +6 -0
  8. package/out/controller/notification/internal-message.controller.d.ts +7 -0
  9. package/out/controller/notification/internal-message.controller.d.ts.map +1 -1
  10. package/out/controller/notification/internal-message.controller.js +17 -0
  11. package/out/engine/md-view.engine.d.ts +28 -0
  12. package/out/engine/md-view.engine.d.ts.map +1 -1
  13. package/out/engine/md-view.engine.js +53 -11
  14. package/out/engine/view-base.engine.d.ts +38 -0
  15. package/out/engine/view-base.engine.d.ts.map +1 -1
  16. package/out/engine/view-base.engine.js +100 -52
  17. package/out/interface/common/i-drawer-options/i-drawer-options.d.ts +2 -2
  18. package/out/interface/common/i-modal-options/i-modal-options.d.ts +2 -2
  19. package/out/interface/common/i-popover-options/i-popover-options.d.ts +10 -10
  20. package/out/interface/common/i-popover-options/i-popover-options.d.ts.map +1 -1
  21. package/out/interface/util/i-notification-util/i-notification-util.d.ts +7 -0
  22. package/out/interface/util/i-notification-util/i-notification-util.d.ts.map +1 -1
  23. package/package.json +4 -3
  24. package/src/controller/control/calendar/calendar.service.ts +8 -2
  25. package/src/controller/control/grid/grid/grid.controller.ts +7 -0
  26. package/src/controller/notification/internal-message.controller.ts +20 -1
  27. package/src/engine/md-view.engine.ts +59 -11
  28. package/src/engine/view-base.engine.ts +109 -49
  29. package/src/interface/common/i-drawer-options/i-drawer-options.ts +2 -2
  30. package/src/interface/common/i-modal-options/i-modal-options.ts +2 -2
  31. package/src/interface/common/i-popover-options/i-popover-options.ts +10 -10
  32. package/src/interface/util/i-notification-util/i-notification-util.ts +8 -0
@@ -1,5 +1,6 @@
1
1
  import { IHttpResponse, RuntimeError } from '@ibiz-template/core';
2
2
  import { ISysCalendar } from '@ibiz/model-core';
3
+ import { clone } from 'ramda';
3
4
  import { ICalendarItemData } from '../../../interface';
4
5
  import { MDControlService, CalendarItemData } from '../../../service';
5
6
 
@@ -34,10 +35,15 @@ export class CalendarService extends MDControlService<ISysCalendar> {
34
35
  const promises = sysCalendarItems.map(
35
36
  async (item): Promise<IHttpResponse> => {
36
37
  const fetchAction = item.appDEDataSetId || 'fetchdefault';
38
+ const tempContext = context.clone();
39
+ const tempParams = clone(params);
40
+ if (item.maxSize) {
41
+ tempParams.size = item.maxSize;
42
+ }
37
43
  return this.exec2(
38
44
  fetchAction,
39
- context,
40
- params,
45
+ tempContext,
46
+ tempParams,
41
47
  undefined,
42
48
  item.appDataEntityId!,
43
49
  );
@@ -475,6 +475,13 @@ export class GridController<
475
475
  }
476
476
  }
477
477
 
478
+ async getFetchParams(extraParams: IParams = {}): Promise<IParams> {
479
+ if (this.model.enableItemPrivilege === true) {
480
+ extraParams.srfdataaccessaction = true;
481
+ }
482
+ return super.getFetchParams(extraParams);
483
+ }
484
+
478
485
  /**
479
486
  * 计算当前页的聚合数据
480
487
  * @author lxm
@@ -1,4 +1,4 @@
1
- import { IInternalMessage } from '@ibiz-template/core';
1
+ import { IInternalMessage, IPortalMessage } from '@ibiz-template/core';
2
2
  import { QXEvent } from 'qx-util';
3
3
  import {
4
4
  IInternalMessageController,
@@ -27,6 +27,7 @@ export class InternalMessageController implements IInternalMessageController {
27
27
 
28
28
  async init(): Promise<void> {
29
29
  this.load();
30
+ this.listenMqtt();
30
31
  }
31
32
 
32
33
  async load(): Promise<void> {
@@ -61,4 +62,22 @@ export class InternalMessageController implements IInternalMessageController {
61
62
  }
62
63
  this.evt.emit('dataChange');
63
64
  }
65
+
66
+ /**
67
+ * 监听mqtt消息
68
+ * @author lxm
69
+ * @date 2024-01-30 01:53:44
70
+ * @protected
71
+ */
72
+ protected listenMqtt(): void {
73
+ ibiz.mc.command.internalMessage.on(async (msg: IPortalMessage) => {
74
+ ibiz.log.debug('mqtt internalMessage: ', msg);
75
+ if (msg.subtype !== 'INTERNALMESSAGE') {
76
+ return;
77
+ }
78
+
79
+ // todo 目前会有一种情况,不带data,弹右下角消息提示
80
+ ibiz.notification.info({ desc: msg.content, position: 'bottom-right' });
81
+ });
82
+ }
64
83
  }
@@ -1,5 +1,5 @@
1
1
  import { RuntimeModelError } from '@ibiz-template/core';
2
- import { IAppDEMultiDataView } from '@ibiz/model-core';
2
+ import { IAppDEMultiDataView, ISearchBar } from '@ibiz/model-core';
3
3
  import { clone } from 'ramda';
4
4
  import { SysUIActionTag, ViewCallTag } from '../constant';
5
5
  import { ViewController } from '../controller';
@@ -14,7 +14,7 @@ import {
14
14
  EventBase,
15
15
  IUIActionResult,
16
16
  } from '../interface';
17
- import { calcDeCodeNameById } from '../model';
17
+ import { calcDeCodeNameById, getControl } from '../model';
18
18
  import { ViewEngineBase } from './view-base.engine';
19
19
 
20
20
  /**
@@ -398,18 +398,46 @@ export class MDViewEngine extends ViewEngineBase {
398
398
  this.newData(Object.assign(args, { copyMode: true }));
399
399
  }
400
400
 
401
+ /**
402
+ * 计算头部显示
403
+ *
404
+ * @author zk
405
+ * @date 2024-01-29 05:01:30
406
+ * @protected
407
+ * @return {*} {boolean}
408
+ * @memberof MDViewEngine
409
+ */
401
410
  protected calcViewHeaderVisible(): boolean {
402
- let showHeader = super.calcViewHeaderVisible();
411
+ const showHeader = super.calcViewHeaderVisible();
403
412
  // 搜索栏
404
- if (!this.searchBar || !this.searchBar.state.visible) {
405
- const controller = this.viewLayoutPanel!.panelItems.view_searchbar;
406
- if (controller) {
407
- controller.state.visible = false;
408
- }
409
- } else {
410
- showHeader = true;
413
+ const visible = this.calcViewSearchBarVisible();
414
+ return visible || showHeader;
415
+ }
416
+
417
+ /**
418
+ * 计算搜索栏显示
419
+ *
420
+ * @author zk
421
+ * @date 2024-01-29 05:01:36
422
+ * @protected
423
+ * @return {*} {boolean}
424
+ * @memberof MDViewEngine
425
+ */
426
+ protected calcViewSearchBarVisible(): boolean {
427
+ const { model } = this.view;
428
+ // 搜索栏
429
+
430
+ const has: boolean = this.isExistAndInLayout('searchbar');
431
+ if (!has) {
432
+ return has;
411
433
  }
412
- return showHeader;
434
+ const searchBar: ISearchBar = getControl(model, 'searchbar')!;
435
+ const visible = !!(
436
+ searchBar.enableQuickSearch ||
437
+ searchBar.enableGroup ||
438
+ searchBar.enableFilter === true
439
+ );
440
+ return visible;
413
441
  }
414
442
 
415
443
  /**
@@ -427,4 +455,24 @@ export class MDViewEngine extends ViewEngineBase {
427
455
  }
428
456
  }
429
457
  }
458
+
459
+ /**
460
+ * 计算移除的模型名称
461
+ *
462
+ * @author zk
463
+ * @date 2024-01-29 03:01:42
464
+ * @return {*} {string[]}
465
+ * @memberof MDViewEngine
466
+ */
467
+ calcRemoveLayoutModel(): string[] {
468
+ const { model } = this.view;
469
+ const names = super.calcRemoveLayoutModel();
470
+ if (!getControl(model, 'searchform')) {
471
+ names.push('searchform');
472
+ }
473
+ if (!this.calcViewSearchBarVisible()) {
474
+ names.push('view_searchbar');
475
+ }
476
+ return names;
477
+ }
430
478
  }
@@ -1,4 +1,5 @@
1
- import { RuntimeError } from '@ibiz-template/core';
1
+ import { RuntimeError, findRecursiveChild } from '@ibiz-template/core';
2
+ import { IPanel, IPanelContainer } from '@ibiz/model-core';
2
3
  import { ViewCallTag } from '../constant';
3
4
  import {
4
5
  IViewController,
@@ -6,6 +7,7 @@ import {
6
7
  IViewLayoutPanelController,
7
8
  } from '../interface';
8
9
  import { IViewEngine } from '../interface/engine';
10
+ import { getControl } from '../model';
9
11
 
10
12
  /**
11
13
  * 视图引擎基类
@@ -88,31 +90,93 @@ export class ViewEngineBase implements IViewEngine {
88
90
  async onCreated(): Promise<void> {
89
91
  const { childNames } = this.view;
90
92
  childNames.push('captionbar', 'toolbar');
93
+ this.calcDynamicLayout();
91
94
  }
92
95
 
93
- async onMounted(): Promise<void> {
94
- // 子类重写
95
- const { model, childNames } = this.view;
96
- ibiz.log.debug(`${model.id}的子组件:${childNames.join(';')}都已mounted`);
96
+ /**
97
+ * 计算动态布局模型
98
+ *
99
+ * @author zk
100
+ * @date 2024-01-29 02:01:47
101
+ * @memberof ViewEngineBase
102
+ */
103
+ protected calcDynamicLayout(): void {
104
+ const names = this.calcRemoveLayoutModel();
105
+ ibiz.log.debug(`${this.view.model.codeName}删除模型:${names.join(';')}`);
106
+ this.removeLayoutModel(names);
107
+ }
108
+
109
+ /**
110
+ * 计算移除的模型名称
111
+ *
112
+ * @author zk
113
+ * @date 2024-01-29 02:01:21
114
+ * @return {*} {string[]}
115
+ * @memberof ViewEngineBase
116
+ */
117
+ protected calcRemoveLayoutModel(): string[] {
118
+ const { model } = this.view;
119
+ const names = [];
97
120
 
98
- const showHeader = this.calcViewHeaderVisible();
99
- if (!showHeader) {
100
- const controller = this.viewLayoutPanel?.panelItems.view_header;
101
- if (controller) {
102
- controller.state.visible = false;
121
+ if (model.showCaptionBar === false) {
122
+ names.push('view_captionbar');
123
+ }
124
+ if (!getControl(model, 'toolbar')) {
125
+ names.push('view_toolbar', 'toolbar');
126
+ }
127
+ const toolBarList = ['lefttoolbar', 'righttoolbar', 'footertoolbar'];
128
+ toolBarList.forEach(name => {
129
+ if (!getControl(model, name)) {
130
+ names.push(name);
103
131
  }
132
+ });
133
+ if (!this.calcViewHeaderVisible()) {
134
+ names.push('view_header');
104
135
  }
105
136
 
106
137
  if (ibiz.env.isMob) {
107
- // 显示隐藏底部栏
108
- const showFooter = this.calcViewFooterVisible();
109
- if (!showFooter) {
110
- const controller = this.viewLayoutPanel?.panelItems.view_footer;
111
- if (controller) {
112
- controller.state.visible = false;
113
- }
138
+ if (!this.calcViewFooterVisible()) {
139
+ names.push('view_footer');
114
140
  }
115
141
  }
142
+ return names;
143
+ }
144
+
145
+ /**
146
+ * 删除布局模型
147
+ *
148
+ * @author zk
149
+ * @date 2024-01-29 02:01:29
150
+ * @param {string[]} names
151
+ * @param {(IPanelContainer | undefined)} [container=this.view.model.viewLayoutPanel]
152
+ * @return {*} {void}
153
+ * @memberof ViewEngineBase
154
+ */
155
+ private removeLayoutModel(
156
+ names: string[],
157
+ container: IPanelContainer | undefined = this.view.model.viewLayoutPanel,
158
+ ): void {
159
+ if (!container) {
160
+ return;
161
+ }
162
+ const items =
163
+ (container as IPanel)!.rootPanelItems || container.panelItems || [];
164
+ const index = items.findIndex(item => names.includes(item.id!));
165
+ if (index !== -1) {
166
+ items.splice(index, 1);
167
+ }
168
+ // 过滤深层的子成员
169
+ items.forEach(item => {
170
+ if (item.itemType === 'CONTAINER') {
171
+ this.removeLayoutModel(names, item);
172
+ }
173
+ });
174
+ }
175
+
176
+ async onMounted(): Promise<void> {
177
+ // 子类重写
178
+ const { model, childNames } = this.view;
179
+ ibiz.log.debug(`${model.id}的子组件:${childNames.join(';')}都已mounted`);
116
180
  }
117
181
 
118
182
  async onDestroyed(): Promise<void> {
@@ -159,49 +223,46 @@ export class ViewEngineBase implements IViewEngine {
159
223
  const { model } = this.view;
160
224
 
161
225
  // 标题栏
162
- if (model.showCaptionBar === false) {
163
- // 隐藏标题栏容器
164
- const controller = this.viewLayoutPanel?.panelItems.view_captionbar;
165
- if (controller) {
166
- controller.state.visible = false;
167
- }
168
- } else {
226
+ if (model.showCaptionBar) {
169
227
  showHeader = true;
170
228
  }
171
-
172
229
  if (ibiz.env.isMob) {
173
- if (!this.leftToolbar) {
174
- // 隐藏左工具栏
175
- const controller = this.viewLayoutPanel?.panelItems.lefttoolbar;
176
- if (controller) {
177
- controller.state.visible = false;
178
- }
179
- } else {
230
+ if (this.isExistAndInLayout('lefttoolbar')) {
180
231
  showHeader = true;
181
232
  }
182
233
 
183
- if (!this.rightToolbar) {
184
- // 隐藏右工具栏
185
- const controller = this.viewLayoutPanel?.panelItems.righttoolbar;
186
- if (controller) {
187
- controller.state.visible = false;
188
- }
189
- } else {
234
+ if (this.isExistAndInLayout('righttoolbar')) {
190
235
  showHeader = true;
191
236
  }
192
- } else if (!this.toolbar) {
193
- // 隐藏工具栏容器
194
- const controller = this.viewLayoutPanel?.panelItems.view_toolbar;
195
- if (controller) {
196
- controller.state.visible = false;
197
- }
198
- } else {
237
+ } else if (this.isExistAndInLayout('toolbar')) {
199
238
  showHeader = true;
200
239
  }
201
-
202
240
  return showHeader;
203
241
  }
204
242
 
243
+ /**
244
+ * 是否存在模型 并且 布局中有占位
245
+ *
246
+ * @author zk
247
+ * @date 2024-01-30 11:01:33
248
+ * @param {string} name
249
+ * @return {*} {(IData | undefined)}
250
+ * @memberof ViewEngineBase
251
+ */
252
+ isExistAndInLayout(name: string): boolean {
253
+ const layout = this.view.model.viewLayoutPanel;
254
+ if (!layout) {
255
+ return false;
256
+ }
257
+ const ins = findRecursiveChild(layout, name, {
258
+ compareField: 'id',
259
+ childrenFields: ['panelItems', 'rootPanelItems'],
260
+ });
261
+ const { model } = this.view;
262
+ const has = getControl(model, name);
263
+ return !!(ins && has);
264
+ }
265
+
205
266
  /**
206
267
  * 计算底部的显示与否
207
268
  * @author lxm
@@ -213,10 +274,9 @@ export class ViewEngineBase implements IViewEngine {
213
274
  let showFooter: boolean = false;
214
275
 
215
276
  // 工具栏
216
- if (this.footerToolbar) {
277
+ if (this.isExistAndInLayout('footertoolbar')) {
217
278
  showFooter = true;
218
279
  }
219
-
220
280
  return showFooter;
221
281
  }
222
282
 
@@ -1,7 +1,7 @@
1
1
  export interface IDrawerOptions {
2
2
  /**
3
3
  * 抽屉宽度
4
- * 左、右方向时可用。目前只支持像素
4
+ * 左、右方向时可用。0-100的时候算百分比,100以上算像素px
5
5
  *
6
6
  * @author lxm
7
7
  * @date 2022-09-12 20:09:20
@@ -10,7 +10,7 @@ export interface IDrawerOptions {
10
10
  width?: number;
11
11
  /**
12
12
  * 抽屉高度
13
- * 上、下方向时可用。目前只支持像素
13
+ * 上、下方向时可用。0-100的时候算百分比,100以上算像素px
14
14
  *
15
15
  * @author lxm
16
16
  * @date 2022-09-12 20:09:22
@@ -1,6 +1,6 @@
1
1
  export interface IModalOptions {
2
2
  /**
3
- * 宽度
3
+ * 宽度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
4
4
  *
5
5
  * @author lxm
6
6
  * @date 2022-09-12 20:09:20
@@ -8,7 +8,7 @@ export interface IModalOptions {
8
8
  */
9
9
  width?: string | number;
10
10
  /**
11
- * 高度
11
+ * 高度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
12
12
  *
13
13
  * @author lxm
14
14
  * @date 2022-09-12 20:09:22
@@ -32,21 +32,21 @@ interface AxesOffsets {
32
32
  */
33
33
  export interface IPopoverOptions<O = unknown> {
34
34
  /**
35
- * 宽度
35
+ * 宽度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
36
36
  *
37
- * @author chitanda
38
- * @date 2022-11-08 16:11:26
39
- * @type {string}
37
+ * @author lxm
38
+ * @date 2022-09-12 20:09:20
39
+ * @type {string | number}
40
40
  */
41
- width?: string;
41
+ width?: string | number;
42
42
  /**
43
- * 高度
43
+ * 高度 数字0-100的时候算百分比,100以上算像素px,字符串原样设置
44
44
  *
45
- * @author chitanda
46
- * @date 2022-11-08 16:11:33
47
- * @type {string}
45
+ * @author lxm
46
+ * @date 2022-09-12 20:09:22
47
+ * @type {string | number}
48
48
  */
49
- height?: string;
49
+ height?: string | number;
50
50
  /**
51
51
  * 展示方向
52
52
  *
@@ -32,6 +32,14 @@ export interface NotificationParams {
32
32
  * @type {number}
33
33
  */
34
34
  duration?: number;
35
+
36
+ /**
37
+ * 位置
38
+ * @author lxm
39
+ * @date 2024-01-30 11:43:21
40
+ * @type {('top-right' | 'top-left' | 'bottom-right' | 'bottom-left')}
41
+ */
42
+ position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
35
43
  }
36
44
 
37
45
  /**