@ibiz-template/runtime 0.5.1-dev.0 → 0.5.1-next.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.
Files changed (26) hide show
  1. package/dist/index.esm.js +93 -55
  2. package/dist/index.system.min.js +1 -1
  3. package/out/controller/control/search-bar/entity-schema.d.ts +1 -1
  4. package/out/controller/control/search-bar/entity-schema.d.ts.map +1 -1
  5. package/out/controller/control/search-bar/entity-schema.js +29 -13
  6. package/out/controller/control/search-bar/search-bar.controller.d.ts +8 -9
  7. package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
  8. package/out/controller/control/search-bar/search-bar.controller.js +36 -21
  9. package/out/interface/controller/state/control/i-gantt.state.d.ts +6 -6
  10. package/out/interface/controller/state/control/i-gantt.state.d.ts.map +1 -1
  11. package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts +6 -6
  12. package/out/service/vo/gantt-node-data/gantt-code-list-node-data.d.ts.map +1 -1
  13. package/out/service/vo/gantt-node-data/gantt-code-list-node-data.js +6 -6
  14. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts +6 -6
  15. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.d.ts.map +1 -1
  16. package/out/service/vo/gantt-node-data/gantt-data-set-node-data.js +6 -6
  17. package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts +6 -6
  18. package/out/service/vo/gantt-node-data/gantt-static-node-data.d.ts.map +1 -1
  19. package/out/service/vo/gantt-node-data/gantt-static-node-data.js +6 -6
  20. package/package.json +3 -3
  21. package/src/controller/control/search-bar/entity-schema.ts +43 -20
  22. package/src/controller/control/search-bar/search-bar.controller.ts +32 -21
  23. package/src/interface/controller/state/control/i-gantt.state.ts +6 -6
  24. package/src/service/vo/gantt-node-data/gantt-code-list-node-data.ts +12 -12
  25. package/src/service/vo/gantt-node-data/gantt-data-set-node-data.ts +12 -12
  26. package/src/service/vo/gantt-node-data/gantt-static-node-data.ts +15 -12
@@ -4,7 +4,7 @@ import {
4
4
  recursiveIterate,
5
5
  } from '@ibiz-template/core';
6
6
  import { IAppDataEntity, ISearchBar, ISearchBarFilter } from '@ibiz/model-core';
7
- import { isNil } from 'ramda';
7
+ import { clone, isNil } from 'ramda';
8
8
  import {
9
9
  ISearchBarState,
10
10
  ISearchBarEvent,
@@ -79,7 +79,9 @@ export class SearchBarController
79
79
  * @date 2023-12-29 04:15:34
80
80
  * @type {boolean}
81
81
  */
82
- enableFilter: boolean = this.model.enableFilter === true;
82
+ get enableFilter(): boolean {
83
+ return this.model.enableFilter === true;
84
+ }
83
85
 
84
86
  /**
85
87
  * 最终使用的searchBarFilters
@@ -87,7 +89,16 @@ export class SearchBarController
87
89
  * @date 2023-12-29 06:55:13
88
90
  * @type {ISearchBarFilter[]}
89
91
  */
90
- searchBarFilters!: ISearchBarFilter[];
92
+ get searchBarFilters(): ISearchBarFilter[] {
93
+ return this.model.searchBarFilters || [];
94
+ }
95
+
96
+ /**
97
+ * 是否启用根据实体的JSON Schema生成过滤项
98
+ * @author lxm
99
+ * @date 2024-01-05 10:10:37
100
+ */
101
+ addSchemaFilters = false;
91
102
 
92
103
  /**
93
104
  * 表格控制器
@@ -113,16 +124,6 @@ export class SearchBarController
113
124
  this.state.selectedGroupItem = null;
114
125
  this.state.searchBarGroups = [];
115
126
  this.state.selectedSearchGroupItem = null;
116
- this.initFilterState();
117
- }
118
-
119
- /**
120
- * 初始化Filter相关的属性
121
- * @author lxm
122
- * @date 2023-12-29 04:18:02
123
- * @protected
124
- */
125
- protected initFilterState(): void {
126
127
  this.resetFilter();
127
128
  this.state.visible = !!(
128
129
  this.model.enableQuickSearch ||
@@ -132,6 +133,8 @@ export class SearchBarController
132
133
  }
133
134
 
134
135
  protected async onCreated(): Promise<void> {
136
+ await this.initByEntitySchema();
137
+
135
138
  await super.onCreated();
136
139
 
137
140
  const appDataEntity = await ibiz.hub.getAppDataEntity(
@@ -149,7 +152,6 @@ export class SearchBarController
149
152
  await this.service.init(this.context);
150
153
  }
151
154
 
152
- await this.initByEntitySchema();
153
155
  await this.initSearchBarFilters();
154
156
  await this.initSearBarGroups();
155
157
  }
@@ -161,12 +163,17 @@ export class SearchBarController
161
163
  * @return {*} {Promise<void>}
162
164
  */
163
165
  async initByEntitySchema(): Promise<void> {
164
- this.enableFilter = true;
165
- const json = await getEntitySchema(this.appDataEntity.id!, this.context);
166
+ if (!this.addSchemaFilters) {
167
+ return;
168
+ }
169
+ const json = await getEntitySchema(
170
+ this.model.appDataEntityId!,
171
+ this.context,
172
+ );
166
173
  if (!json) {
167
174
  return;
168
175
  }
169
- const addSearchBarFilters = calcFilterModelBySchema(json, this);
176
+ const addSearchBarFilters = await calcFilterModelBySchema(json, this);
170
177
 
171
178
  const mergeFilters: ISearchBarFilter[] = [];
172
179
  this.model.searchBarFilters?.forEach(filter => {
@@ -182,9 +189,13 @@ export class SearchBarController
182
189
  }
183
190
  });
184
191
 
185
- addSearchBarFilters.push(...mergeFilters);
186
-
187
- this.searchBarFilters = addSearchBarFilters;
192
+ // 如果有根据json计算出的过滤项,则要重置相关state参数
193
+ if (addSearchBarFilters.length > 0) {
194
+ // 修改模型之前拷贝一份,避免污染原始数据
195
+ (this as IData).model = clone(this.model);
196
+ this.model.searchBarFilters = addSearchBarFilters.concat(...mergeFilters);
197
+ this.model.enableFilter = true;
198
+ }
188
199
  }
189
200
 
190
201
  /**
@@ -311,7 +322,7 @@ export class SearchBarController
311
322
  * @return {*} {IData}
312
323
  */
313
324
  calcFilters(): IData[] | undefined {
314
- if (!this.model.enableFilter) {
325
+ if (!this.enableFilter) {
315
326
  return;
316
327
  }
317
328
  let hasFilter = false; // 是否有过滤项
@@ -54,7 +54,7 @@ export interface IGanttNodeData extends ITreeNodeData {
54
54
  * @date 2023-12-11 17:12:39
55
55
  * @type {string}
56
56
  */
57
- sndataIteValue: string;
57
+ _sndataIteValue: string;
58
58
 
59
59
  /**
60
60
  * 开始时间
@@ -63,7 +63,7 @@ export interface IGanttNodeData extends ITreeNodeData {
63
63
  * @date 2023-12-11 17:12:12
64
64
  * @type {string}
65
65
  */
66
- beginDataItemValue: string;
66
+ _beginDataItemValue: string;
67
67
 
68
68
  /**
69
69
  * 结束时间
@@ -72,7 +72,7 @@ export interface IGanttNodeData extends ITreeNodeData {
72
72
  * @date 2023-12-11 17:12:52
73
73
  * @type {string}
74
74
  */
75
- endDataItemValue: string;
75
+ _endDataItemValue: string;
76
76
 
77
77
  /**
78
78
  * 前置数据
@@ -81,7 +81,7 @@ export interface IGanttNodeData extends ITreeNodeData {
81
81
  * @date 2023-12-11 17:12:13
82
82
  * @type {(string | number)}
83
83
  */
84
- prevDataItemValue: string | number;
84
+ _prevDataItemValue: string | number;
85
85
 
86
86
  /**
87
87
  * 完成量数据
@@ -90,7 +90,7 @@ export interface IGanttNodeData extends ITreeNodeData {
90
90
  * @date 2023-12-11 17:12:26
91
91
  * @type {(string | number)}
92
92
  */
93
- finishDataItemValue: string | number;
93
+ _finishDataItemValue: string | number;
94
94
 
95
95
  /**
96
96
  * 总量数据项
@@ -99,7 +99,7 @@ export interface IGanttNodeData extends ITreeNodeData {
99
99
  * @date 2023-12-11 17:12:43
100
100
  * @type {(string | number)}
101
101
  */
102
- totalDataItemValue: string | number;
102
+ _totalDataItemValue: string | number;
103
103
 
104
104
  /**
105
105
  * 子数据
@@ -7,17 +7,17 @@ export class GanttCodeListNodeData
7
7
  extends TreeCodeListNodeData
8
8
  implements IGanttNodeData
9
9
  {
10
- sndataIteValue: string;
10
+ _sndataIteValue: string;
11
11
 
12
- beginDataItemValue: string;
12
+ _beginDataItemValue: string;
13
13
 
14
- endDataItemValue: string;
14
+ _endDataItemValue: string;
15
15
 
16
- prevDataItemValue: string | number;
16
+ _prevDataItemValue: string | number;
17
17
 
18
- finishDataItemValue: string | number;
18
+ _finishDataItemValue: string | number;
19
19
 
20
- totalDataItemValue: string | number;
20
+ _totalDataItemValue: string | number;
21
21
 
22
22
  _children?: IGanttNodeData[] | undefined;
23
23
 
@@ -36,32 +36,32 @@ export class GanttCodeListNodeData
36
36
  ) {
37
37
  super(nodeModel, parentNodeData, opts);
38
38
  const { data } = opts;
39
- this.sndataIteValue = calcDataItemValue(
39
+ this._sndataIteValue = calcDataItemValue(
40
40
  model.sndataItemName,
41
41
  nodeModel,
42
42
  data,
43
43
  );
44
- this.beginDataItemValue = calcDataItemValue(
44
+ this._beginDataItemValue = calcDataItemValue(
45
45
  model.beginDataItemName,
46
46
  nodeModel,
47
47
  data,
48
48
  );
49
- this.endDataItemValue = calcDataItemValue(
49
+ this._endDataItemValue = calcDataItemValue(
50
50
  model.endDataItemName,
51
51
  nodeModel,
52
52
  data,
53
53
  );
54
- this.prevDataItemValue = calcDataItemValue(
54
+ this._prevDataItemValue = calcDataItemValue(
55
55
  model.prevDataItemName,
56
56
  nodeModel,
57
57
  data,
58
58
  );
59
- this.finishDataItemValue = calcDataItemValue(
59
+ this._finishDataItemValue = calcDataItemValue(
60
60
  model.finishDataItemName,
61
61
  nodeModel,
62
62
  data,
63
63
  );
64
- this.totalDataItemValue = calcDataItemValue(
64
+ this._totalDataItemValue = calcDataItemValue(
65
65
  model.totalDataItemName,
66
66
  nodeModel,
67
67
  data,
@@ -7,17 +7,17 @@ export class GanttDataSetNodeData
7
7
  extends TreeDataSetNodeData
8
8
  implements IGanttNodeData
9
9
  {
10
- sndataIteValue: string;
10
+ _sndataIteValue: string;
11
11
 
12
- beginDataItemValue: string;
12
+ _beginDataItemValue: string;
13
13
 
14
- endDataItemValue: string;
14
+ _endDataItemValue: string;
15
15
 
16
- prevDataItemValue: string | number;
16
+ _prevDataItemValue: string | number;
17
17
 
18
- finishDataItemValue: string | number;
18
+ _finishDataItemValue: string | number;
19
19
 
20
- totalDataItemValue: string | number;
20
+ _totalDataItemValue: string | number;
21
21
 
22
22
  _children?: IGanttNodeData[] | undefined;
23
23
 
@@ -36,32 +36,32 @@ export class GanttDataSetNodeData
36
36
  ) {
37
37
  super(nodeModel, parentNodeData, opts);
38
38
  const { data } = opts;
39
- this.sndataIteValue = calcDataItemValue(
39
+ this._sndataIteValue = calcDataItemValue(
40
40
  model.sndataItemName,
41
41
  nodeModel,
42
42
  data,
43
43
  );
44
- this.beginDataItemValue = calcDataItemValue(
44
+ this._beginDataItemValue = calcDataItemValue(
45
45
  model.beginDataItemName,
46
46
  nodeModel,
47
47
  data,
48
48
  );
49
- this.endDataItemValue = calcDataItemValue(
49
+ this._endDataItemValue = calcDataItemValue(
50
50
  model.endDataItemName,
51
51
  nodeModel,
52
52
  data,
53
53
  );
54
- this.prevDataItemValue = calcDataItemValue(
54
+ this._prevDataItemValue = calcDataItemValue(
55
55
  model.prevDataItemName,
56
56
  nodeModel,
57
57
  data,
58
58
  );
59
- this.finishDataItemValue = calcDataItemValue(
59
+ this._finishDataItemValue = calcDataItemValue(
60
60
  model.finishDataItemName,
61
61
  nodeModel,
62
62
  data,
63
63
  );
64
- this.totalDataItemValue = calcDataItemValue(
64
+ this._totalDataItemValue = calcDataItemValue(
65
65
  model.totalDataItemName,
66
66
  nodeModel,
67
67
  data,
@@ -7,17 +7,17 @@ export class GanttStaticNodeData
7
7
  extends TreeStaticNodeData
8
8
  implements IGanttNodeData
9
9
  {
10
- sndataIteValue: string;
10
+ _sndataIteValue: string;
11
11
 
12
- beginDataItemValue: string;
12
+ _beginDataItemValue: string;
13
13
 
14
- endDataItemValue: string;
14
+ _endDataItemValue: string;
15
15
 
16
- prevDataItemValue: string | number;
16
+ _prevDataItemValue: string | number;
17
17
 
18
- finishDataItemValue: string | number;
18
+ _finishDataItemValue: string | number;
19
19
 
20
- totalDataItemValue: string | number;
20
+ _totalDataItemValue: string | number;
21
21
 
22
22
  _children?: IGanttNodeData[] | undefined;
23
23
 
@@ -30,21 +30,24 @@ export class GanttStaticNodeData
30
30
  opts: { parentValueLevel?: number; leaf: boolean },
31
31
  ) {
32
32
  super(nodeModel, parentNodeData, opts);
33
- this.sndataIteValue = calcDataItemValue(model.sndataItemName, nodeModel);
34
- this.beginDataItemValue = calcDataItemValue(
33
+ this._sndataIteValue = calcDataItemValue(model.sndataItemName, nodeModel);
34
+ this._beginDataItemValue = calcDataItemValue(
35
35
  model.beginDataItemName,
36
36
  nodeModel,
37
37
  );
38
- this.endDataItemValue = calcDataItemValue(model.endDataItemName, nodeModel);
39
- this.prevDataItemValue = calcDataItemValue(
38
+ this._endDataItemValue = calcDataItemValue(
39
+ model.endDataItemName,
40
+ nodeModel,
41
+ );
42
+ this._prevDataItemValue = calcDataItemValue(
40
43
  model.prevDataItemName,
41
44
  nodeModel,
42
45
  );
43
- this.finishDataItemValue = calcDataItemValue(
46
+ this._finishDataItemValue = calcDataItemValue(
44
47
  model.finishDataItemName,
45
48
  nodeModel,
46
49
  );
47
- this.totalDataItemValue = calcDataItemValue(
50
+ this._totalDataItemValue = calcDataItemValue(
48
51
  model.totalDataItemName,
49
52
  nodeModel,
50
53
  );