@ibiz-template/runtime 0.4.14 → 0.4.16

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 (44) hide show
  1. package/dist/index.esm.js +364 -7
  2. package/dist/index.system.min.js +2 -2
  3. package/out/app-hub.js +1 -1
  4. package/out/controller/control/gantt/gantt.controller.d.ts +34 -1
  5. package/out/controller/control/gantt/gantt.controller.d.ts.map +1 -1
  6. package/out/controller/control/gantt/gantt.controller.js +74 -0
  7. package/out/controller/control/gantt/gantt.service.d.ts +13 -0
  8. package/out/controller/control/gantt/gantt.service.d.ts.map +1 -1
  9. package/out/controller/control/gantt/gantt.service.js +14 -0
  10. package/out/controller/control/kanban/kanban.controller.d.ts +104 -2
  11. package/out/controller/control/kanban/kanban.controller.d.ts.map +1 -1
  12. package/out/controller/control/kanban/kanban.controller.js +220 -0
  13. package/out/hub/config/app-config-service.d.ts +1 -0
  14. package/out/hub/config/app-config-service.d.ts.map +1 -1
  15. package/out/hub/config/app-config-service.js +1 -0
  16. package/out/hub/config/app-view-config-service.d.ts +20 -1
  17. package/out/hub/config/app-view-config-service.d.ts.map +1 -1
  18. package/out/hub/config/app-view-config-service.js +39 -6
  19. package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts +8 -0
  20. package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts.map +1 -1
  21. package/out/interface/controller/controller/control/i-kanban.controller.d.ts +27 -0
  22. package/out/interface/controller/controller/control/i-kanban.controller.d.ts.map +1 -1
  23. package/out/interface/controller/state/control/i-gantt.state.d.ts +23 -0
  24. package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
  25. package/out/interface/controller/state/control/i-kanban.state.d.ts +29 -0
  26. package/out/interface/controller/state/control/i-kanban.state.d.ts.map +1 -1
  27. package/out/interface/provider/i-grid-column.provider.d.ts +2 -3
  28. package/out/interface/provider/i-grid-column.provider.d.ts.map +1 -1
  29. package/out/service/service/control/md-control.service.d.ts +10 -0
  30. package/out/service/service/control/md-control.service.d.ts.map +1 -1
  31. package/out/service/service/control/md-control.service.js +16 -0
  32. package/package.json +4 -4
  33. package/src/app-hub.ts +1 -1
  34. package/src/controller/control/gantt/gantt.controller.ts +91 -0
  35. package/src/controller/control/gantt/gantt.service.ts +26 -1
  36. package/src/controller/control/kanban/kanban.controller.ts +258 -1
  37. package/src/hub/config/app-config-service.ts +1 -0
  38. package/src/hub/config/app-view-config-service.ts +39 -6
  39. package/src/interface/common/i-app-view-config-service/i-app-view-config-service.ts +8 -0
  40. package/src/interface/controller/controller/control/i-kanban.controller.ts +31 -1
  41. package/src/interface/controller/state/control/i-gantt.state.ts +26 -0
  42. package/src/interface/controller/state/control/i-kanban.state.ts +33 -0
  43. package/src/interface/provider/i-grid-column.provider.ts +7 -3
  44. package/src/service/service/control/md-control.service.ts +24 -0
@@ -1,18 +1,21 @@
1
1
  import { RuntimeError, RuntimeModelError } from '@ibiz-template/core';
2
- import { IDEKanban } from '@ibiz/model-core';
2
+ import { IDEKanban, IUIActionGroupDetail } from '@ibiz/model-core';
3
3
  import { isNil } from 'ramda';
4
4
  import {
5
+ IController,
5
6
  IDragChangeInfo,
6
7
  IKanbanController,
7
8
  IKanbanEvent,
8
9
  IKanbanGroupState,
9
10
  IKanbanState,
11
+ IToolbarController,
10
12
  MDCtrlLoadParams,
11
13
  } from '../../../interface';
12
14
  import { calcDeCodeNameById } from '../../../model';
13
15
  import { ControlVO } from '../../../service';
14
16
  import { DataViewControlController } from '../data-view';
15
17
  import { KanbanService } from './kanban.service';
18
+ import { UIActionUtil } from '../../../ui-action';
16
19
 
17
20
  export class KanbanController
18
21
  extends DataViewControlController<IDEKanban, IKanbanState, IKanbanEvent>
@@ -57,6 +60,8 @@ export class KanbanController
57
60
  super.initState();
58
61
  this.state.size = this.model.pagingSize || 1000;
59
62
  this.state.updating = false;
63
+ this.state.batching = false;
64
+ this.state.selectGroupKey = '';
60
65
  // 支持调整顺序和分组时
61
66
  this.state.draggable = this.enableEditOrder || this.enableEditGroup;
62
67
  }
@@ -70,6 +75,7 @@ export class KanbanController
70
75
  */
71
76
  protected async onCreated(): Promise<void> {
72
77
  await super.onCreated();
78
+ this.setToolbarHooks();
73
79
  }
74
80
 
75
81
  /**
@@ -116,6 +122,90 @@ export class KanbanController
116
122
  return super.afterLoad(args, items);
117
123
  }
118
124
 
125
+ /**
126
+ * 当展开批操作工具栏时需进行行点击拦截
127
+ *
128
+ * @param {IData} data
129
+ * @return {*} {Promise<void>}
130
+ * @memberof KanbanController
131
+ */
132
+ async onRowClick(data: IData): Promise<void> {
133
+ const { groupAppDEFieldId } = this.model;
134
+ if (this.state.batching && groupAppDEFieldId) {
135
+ const groupVal = data[groupAppDEFieldId];
136
+ if (groupVal !== this.state.selectGroupKey) {
137
+ // 激活事件
138
+ if (this.state.mdctrlActiveMode === 1) {
139
+ await this.setActive(data);
140
+ }
141
+ return;
142
+ }
143
+ }
144
+ super.onRowClick(data);
145
+ }
146
+
147
+ /**
148
+ * 点击新建时设置选中分组
149
+ *
150
+ * @param {MouseEvent} event
151
+ * @param {(string | number)} group
152
+ * @memberof KanbanController
153
+ */
154
+ onClickNew(event: MouseEvent, group: string | number): void {
155
+ this.setSelectGroup(group);
156
+ super.onClickNew(event, group);
157
+ }
158
+
159
+ /**
160
+ * 分组工具栏需设置选中分组
161
+ *
162
+ * @param {IUIActionGroupDetail} detail
163
+ * @param {MouseEvent} event
164
+ * @param {IKanbanGroupState} group
165
+ * @return {*} {Promise<void>}
166
+ * @memberof KanbanController
167
+ */
168
+ async onGroupToolbarClick(
169
+ detail: IUIActionGroupDetail,
170
+ event: MouseEvent,
171
+ group: IKanbanGroupState,
172
+ ): Promise<void> {
173
+ this.setSelectGroup(group.key);
174
+ super.onGroupToolbarClick(detail, event, group);
175
+ }
176
+
177
+ /**
178
+ * 分组行为项点击,需携带分组标识
179
+ *
180
+ * @param {IUIActionGroupDetail} detail
181
+ * @param {IData} item
182
+ * @param {MouseEvent} event
183
+ * @param {IKanbanGroupState} group
184
+ * @return {*} {Promise<void>}
185
+ * @memberof KanbanController
186
+ */
187
+ async onGroupActionClick(
188
+ detail: IUIActionGroupDetail,
189
+ item: IData,
190
+ event: MouseEvent,
191
+ group: IKanbanGroupState,
192
+ ): Promise<void> {
193
+ this.setSelectGroup(group.key);
194
+ const params = { ...this.params, srfgroup: group };
195
+ const actionId = detail.uiactionId;
196
+ await UIActionUtil.execAndResolved(
197
+ actionId!,
198
+ {
199
+ context: this.context,
200
+ params,
201
+ data: [item],
202
+ view: this.view,
203
+ event,
204
+ },
205
+ detail.appId,
206
+ );
207
+ }
208
+
119
209
  handleDataGroup(): Promise<void> {
120
210
  if (!this.model.enableGroup || this.model.groupMode === 'NONE') {
121
211
  throw new RuntimeError('看板部件必须开启分组');
@@ -351,4 +441,171 @@ export class KanbanController
351
441
  await this.afterLoad({}, this.state.items);
352
442
  }
353
443
  }
444
+
445
+ /**
446
+ * 获取是否全屏
447
+ *
448
+ * @return {*} {boolean}
449
+ * @memberof KanbanController
450
+ */
451
+ getFullscreen(): boolean {
452
+ const value =
453
+ (document as IData).isFullScreen ||
454
+ (document as IData).mozIsFullScreen ||
455
+ (document as IData).webkitIsFullScreen;
456
+ return value;
457
+ }
458
+
459
+ /**
460
+ * 触发全屏
461
+ *
462
+ * @param {IData} container
463
+ * @memberof KanbanController
464
+ */
465
+ onFullScreen(container: IData): boolean {
466
+ const isFull = this.getFullscreen();
467
+ if (!isFull) {
468
+ if (container) {
469
+ if (container.webkitRequestFullscreen) {
470
+ container.webkitRequestFullscreen();
471
+ } else if (container.mozRequestFullScreen) {
472
+ container.mozRequestFullScreen();
473
+ } else if (container.msRequestFullscreen) {
474
+ container.msRequestFullscreen();
475
+ } else if (container.requestFullscreen) {
476
+ container.requestFullscreen();
477
+ }
478
+ }
479
+ } else if ((document as IData).documentElement.requestFullScreen) {
480
+ (document as IData).exitFullScreen();
481
+ } else if ((document as IData).documentElement.webkitRequestFullScreen) {
482
+ (document as IData).webkitCancelFullScreen();
483
+ } else if ((document as IData).documentElement.mozRequestFullScreen) {
484
+ (document as IData).mozCancelFullScreen();
485
+ }
486
+ return !isFull;
487
+ }
488
+
489
+ /**
490
+ * 设置选中分组标识
491
+ *
492
+ * @param {(string | number)} key
493
+ * @memberof KanbanController
494
+ */
495
+ setSelectGroup(key: string | number): void {
496
+ if (!this.state.batching) {
497
+ this.state.selectGroupKey = key;
498
+ }
499
+ }
500
+
501
+ /**
502
+ * 设置分组控制器
503
+ *
504
+ * @param {string} groupKey
505
+ * @param {('quickToolbarController' | 'batchToolbarController')} name
506
+ * @param {IToolbarController} c
507
+ * @memberof KanbanController
508
+ */
509
+ setGroupController(
510
+ groupKey: string | number,
511
+ name: 'quickToolbarController' | 'batchToolbarController',
512
+ c: IToolbarController,
513
+ ): void {
514
+ const group = this.state.groups.find(x => x.key === groupKey);
515
+ if (group) {
516
+ group[name] = c;
517
+ }
518
+ }
519
+
520
+ /**
521
+ * 设置工具栏hook
522
+ *
523
+ * @memberof KanbanController
524
+ */
525
+ setToolbarHooks(): void {
526
+ this.listenNewController((name: string, c: IController) => {
527
+ if (
528
+ name.startsWith(`${this.model.name}_quicktoolbar`) ||
529
+ name.startsWith(`${this.model.name}_groupquicktoolbar`)
530
+ ) {
531
+ this.setQuickToolbarClickHook(name, c as IToolbarController);
532
+ }
533
+ if (name.startsWith(`${this.model.name}_batchtoolbar`)) {
534
+ this.setBatchToolbarClickHook(name, c as IToolbarController);
535
+ }
536
+ });
537
+ }
538
+
539
+ /**
540
+ * 设置快捷工具栏点击事件hook
541
+ *
542
+ * @param {string} name
543
+ * @param {IToolbarController} c
544
+ * @memberof KanbanController
545
+ */
546
+ setQuickToolbarClickHook(name: string, c: IToolbarController): void {
547
+ const key = name.split('quicktoolbar_')[1];
548
+ this.setGroupController(
549
+ key,
550
+ 'quickToolbarController',
551
+ c as IToolbarController,
552
+ );
553
+ (c as IToolbarController).evt.on('onClick', (event): void => {
554
+ const groupKey = event.targetName.split('quicktoolbar_')[1];
555
+ this.setSelectGroup(groupKey);
556
+ Object.assign(event.params, { srfgroup: groupKey });
557
+ });
558
+ }
559
+
560
+ /**
561
+ * 设置批工具栏点击事件hook
562
+ *
563
+ * @param {string} name
564
+ * @param {IToolbarController} c
565
+ * @memberof KanbanController
566
+ */
567
+ setBatchToolbarClickHook(name: string, c: IToolbarController): void {
568
+ const key = name.split('batchtoolbar_')[1];
569
+ this.setGroupController(
570
+ key,
571
+ 'batchToolbarController',
572
+ c as IToolbarController,
573
+ );
574
+ (c as IToolbarController).evt.on('onClick', (event): void => {
575
+ const groupKey = event.targetName.split('batchtoolbar_')[1];
576
+ this.setSelectGroup(groupKey);
577
+ Object.assign(event.params, { srfgroup: groupKey });
578
+ });
579
+ }
580
+
581
+ /**
582
+ * 打开批操作工具栏
583
+ *
584
+ * @param {string} groupKey
585
+ * @memberof KanbanController
586
+ */
587
+ openBatch(groupKey: string): void {
588
+ this.state.selectGroupKey = groupKey;
589
+ this.state.batching = true;
590
+ this.state.selectedData = [];
591
+ // 清空分组选中数据
592
+ this.state.groups.forEach(group => {
593
+ group.selectedData = [];
594
+ });
595
+ }
596
+
597
+ /**
598
+ * 关闭批操作工具栏
599
+ *
600
+ * @memberof KanbanController
601
+ */
602
+ closeBatch(): void {
603
+ this.state.selectGroupKey = '';
604
+ this.state.batching = false;
605
+ this.state.selectedData = [];
606
+ // 清空分组选中数据
607
+ this.state.groups.forEach(group => {
608
+ group.selectedData = [];
609
+ });
610
+ }
354
611
  }
@@ -3,6 +3,7 @@ import { AppViewConfigService } from './app-view-config-service';
3
3
 
4
4
  /**
5
5
  * 应用设置服务
6
+ *
6
7
  * @author lxm
7
8
  * @date 2023-07-03 07:07:47
8
9
  * @export
@@ -1,6 +1,15 @@
1
1
  import { RuntimeError } from '@ibiz-template/core';
2
2
  import { IAppViewConfigService, IViewConfig } from '../../interface';
3
3
 
4
+ /**
5
+ * 应用视图配置服务
6
+ *
7
+ * @author chitanda
8
+ * @date 2023-12-21 16:12:06
9
+ * @export
10
+ * @class AppViewConfigService
11
+ * @implements {IAppViewConfigService}
12
+ */
4
13
  export class AppViewConfigService implements IAppViewConfigService {
5
14
  /**
6
15
  * 视图配置信息集合
@@ -9,23 +18,47 @@ export class AppViewConfigService implements IAppViewConfigService {
9
18
  */
10
19
  protected viewConfigs = new Map<string, IViewConfig>();
11
20
 
21
+ /**
22
+ * 计算应用视图 标识
23
+ *
24
+ * @author chitanda
25
+ * @date 2023-04-20 18:04:48
26
+ * @protected
27
+ * @param {string} tag
28
+ * @return {*} {string}
29
+ */
30
+ protected calcAppViewId(tag: string): string {
31
+ let id = '';
32
+ if (tag.indexOf('.') !== -1) {
33
+ const ids = tag.split('.');
34
+ id = ids[ids.length - 1];
35
+ } else {
36
+ id = tag.toLowerCase();
37
+ }
38
+ return id;
39
+ }
40
+
12
41
  has(key: string): boolean {
13
- return this.viewConfigs.has(key);
42
+ const id = this.calcAppViewId(key);
43
+ return this.viewConfigs.has(id);
14
44
  }
15
45
 
16
- set(id: string, viewConfig: IViewConfig): void {
46
+ set(key: string, viewConfig: IViewConfig): void {
47
+ const id = this.calcAppViewId(key);
17
48
  this.viewConfigs.set(id, viewConfig);
18
49
  }
19
50
 
20
51
  async get(key: string): Promise<IViewConfig> {
52
+ const id = this.calcAppViewId(key);
21
53
  // 没有的时候请求视图模型并设置
22
- if (!this.viewConfigs.has(key)) {
23
- const model = await ibiz.hub.getAppView(key);
54
+ if (!this.viewConfigs.has(id)) {
55
+ const model = await ibiz.hub.getAppView(id);
24
56
  if (!model) {
25
- throw new RuntimeError(`视图[${key}]不存在`);
57
+ throw new RuntimeError(`视图[${id}]不存在`);
26
58
  }
27
59
  this.set(model.id!, {
28
60
  id: model.id!,
61
+ appId: model.appId!,
29
62
  codeName: model.codeName!,
30
63
  openMode: model.openMode!,
31
64
  viewType: model.viewType!,
@@ -35,7 +68,7 @@ export class AppViewConfigService implements IAppViewConfigService {
35
68
  redirectView: model.redirectView,
36
69
  });
37
70
  }
38
- return this.viewConfigs.get(key)!;
71
+ return this.viewConfigs.get(id)!;
39
72
  }
40
73
 
41
74
  getSync(key: string): IViewConfig | null {
@@ -10,6 +10,14 @@ export interface IViewConfig {
10
10
  * 唯一标识
11
11
  */
12
12
  id: string;
13
+ /**
14
+ * 应用视图所归属的应用 id
15
+ *
16
+ * @author chitanda
17
+ * @date 2023-12-21 16:12:11
18
+ * @type {string}
19
+ */
20
+ appId: string;
13
21
  /**
14
22
  * 代码标识
15
23
  */
@@ -11,4 +11,34 @@ import { IDataViewControlController } from './i-data-view-control.controller';
11
11
  * @extends {IMDControlController<IDEDataView, IDataViewControlState, IDataViewControlEvent>}
12
12
  */
13
13
  export interface IKanbanController
14
- extends IDataViewControlController<IDEKanban, IKanbanState, IKanbanEvent> {}
14
+ extends IDataViewControlController<IDEKanban, IKanbanState, IKanbanEvent> {
15
+ /**
16
+ * 是否全屏
17
+ *
18
+ * @return {*} {boolean}
19
+ * @memberof IKanbanController
20
+ */
21
+ getFullscreen(): boolean;
22
+ /**
23
+ * 全屏
24
+ *
25
+ * @param {IData} container
26
+ * @memberof IKanbanController
27
+ */
28
+ onFullScreen(container: IData): boolean;
29
+
30
+ /**
31
+ * 打开对应分组批操作工具栏
32
+ *
33
+ * @param {string | number} groupKey
34
+ * @memberof IKanbanController
35
+ */
36
+ openBatch(groupKey: string | number): void;
37
+
38
+ /**
39
+ * 关闭批操作工具栏
40
+ *
41
+ * @memberof IKanbanController
42
+ */
43
+ closeBatch(): void;
44
+ }
@@ -47,6 +47,32 @@ export interface IGanttState extends IMDControlState {
47
47
  * @type {string}
48
48
  */
49
49
  placeHolder: string;
50
+
51
+ /**
52
+ * 甘特图样式
53
+ *
54
+ * @type {IGanttStyle}
55
+ * @memberof IGanttState
56
+ */
57
+ ganttStyle: IGanttStyle;
58
+ }
59
+
60
+ export interface IGanttStyle {
61
+ /**
62
+ * 主题色
63
+ *
64
+ * @type {string}
65
+ * @memberof IGanttStyle
66
+ */
67
+ primaryColor?: string;
68
+
69
+ /**
70
+ * 文本色
71
+ *
72
+ * @type {string}
73
+ * @memberof IGanttStyle
74
+ */
75
+ textColor?: string;
50
76
  }
51
77
 
52
78
  /**
@@ -1,3 +1,4 @@
1
+ import { IToolbarController } from '../../controller';
1
2
  import { IDataViewControlState } from './i-data-view-control.state';
2
3
  import { IMDControlGroupState } from './i-md-control.state';
3
4
 
@@ -25,6 +26,14 @@ export interface IKanbanState extends IDataViewControlState {
25
26
  */
26
27
  updating: boolean;
27
28
 
29
+ /**
30
+ * 是否正在批操作
31
+ *
32
+ * @type {boolean}
33
+ * @memberof IKanbanState
34
+ */
35
+ batching: boolean;
36
+
28
37
  /**
29
38
  * 分组数据
30
39
  *
@@ -32,6 +41,14 @@ export interface IKanbanState extends IDataViewControlState {
32
41
  * @memberof IKanbanState
33
42
  */
34
43
  groups: IKanbanGroupState[];
44
+
45
+ /**
46
+ * 选中分组标识
47
+ *
48
+ * @type {string | number}
49
+ * @memberof IKanbanState
50
+ */
51
+ selectGroupKey: string | number;
35
52
  }
36
53
 
37
54
  /**
@@ -49,4 +66,20 @@ export interface IKanbanGroupState extends IMDControlGroupState {
49
66
  * @memberof IKanbanGroupState
50
67
  */
51
68
  color?: string;
69
+
70
+ /**
71
+ * 快速工具栏控制器
72
+ *
73
+ * @type {IToolbarController}
74
+ * @memberof IKanbanGroupState
75
+ */
76
+ quickToolbarController?: IToolbarController;
77
+
78
+ /**
79
+ * 批操作工具栏控制器
80
+ *
81
+ * @type {IToolbarController}
82
+ * @memberof IKanbanGroupState
83
+ */
84
+ batchToolbarController?: IToolbarController;
52
85
  }
@@ -1,6 +1,10 @@
1
1
  import { IDEGridColumn } from '@ibiz/model-core';
2
- import { GanttController, TreeGridExController } from '../../controller';
3
- import { IGridColumnController, IGridController } from '../controller';
2
+ import {
3
+ IGanttController,
4
+ IGridColumnController,
5
+ IGridController,
6
+ ITreeGridExController,
7
+ } from '../controller';
4
8
 
5
9
  /**
6
10
  * 表格列适配器的接口
@@ -32,7 +36,7 @@ export interface IGridColumnProvider {
32
36
  */
33
37
  createController(
34
38
  columnModel: IDEGridColumn,
35
- grid: IGridController | TreeGridExController | GanttController,
39
+ grid: IGridController | ITreeGridExController | IGanttController,
36
40
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
41
  ): Promise<IGridColumnController>;
38
42
  }
@@ -122,6 +122,30 @@ export class MDControlService<
122
122
  return res as IHttpResponse<ControlVO>;
123
123
  }
124
124
 
125
+ /**
126
+ * 批量更新数据
127
+ *
128
+ * @author chitanda
129
+ * @date 2023-12-21 10:12:09
130
+ * @param {IContext} context
131
+ * @param {ControlVO[]} data
132
+ * @return {*} {Promise<void>}
133
+ */
134
+ async updateBatch(
135
+ context: IContext,
136
+ data: ControlVO[],
137
+ ): Promise<IHttpResponse<ControlVO[]>> {
138
+ const updateAction =
139
+ this.model.updateControlAction?.appDEMethodId || 'update';
140
+ let res = await this.exec(
141
+ updateAction,
142
+ context,
143
+ data.map(item => item.getOrigin()),
144
+ );
145
+ res = this.handleResponse(res);
146
+ return res as IHttpResponse<ControlVO[]>;
147
+ }
148
+
125
149
  /**
126
150
  * 导出数据
127
151
  *