@ibiz-template/runtime 0.4.3 → 0.4.4

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 (52) hide show
  1. package/dist/index.esm.js +158 -11
  2. package/dist/index.system.min.js +2 -2
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts +8 -0
  5. package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
  6. package/out/controller/control/exp-bar/tree-exp-bar.controller.js +17 -0
  7. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.d.ts +1 -1
  8. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.d.ts.map +1 -1
  9. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.js +9 -3
  10. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.d.ts +1 -1
  11. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.d.ts.map +1 -1
  12. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.js +7 -2
  13. package/out/controller/control/grid/grid/grid.controller.d.ts +8 -0
  14. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  15. package/out/controller/control/grid/grid/grid.controller.js +15 -0
  16. package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.d.ts.map +1 -1
  17. package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.js +5 -0
  18. package/out/controller/control/tree/tree.controller.d.ts +8 -0
  19. package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
  20. package/out/controller/control/tree/tree.controller.js +38 -0
  21. package/out/controller/control/tree/tree.service.js +1 -1
  22. package/out/global/global-util/global-util.d.ts +8 -1
  23. package/out/global/global-util/global-util.d.ts.map +1 -1
  24. package/out/global/global-util/global-util.js +8 -1
  25. package/out/interface/common/i-plugin-factory/i-plugin-factory.d.ts +4 -5
  26. package/out/interface/common/i-plugin-factory/i-plugin-factory.d.ts.map +1 -1
  27. package/out/interface/controller/state/control/i-tree.state.d.ts +14 -0
  28. package/out/interface/controller/state/control/i-tree.state.d.ts.map +1 -1
  29. package/out/platform/provider/platform-provider-base.d.ts.map +1 -1
  30. package/out/platform/provider/platform-provider-base.js +1 -0
  31. package/out/ui-action/provider/front-ui-action-provider.js +2 -2
  32. package/out/utils/index.d.ts +1 -0
  33. package/out/utils/index.d.ts.map +1 -1
  34. package/out/utils/index.js +1 -0
  35. package/out/utils/theme-util/theme-util.d.ts +46 -0
  36. package/out/utils/theme-util/theme-util.d.ts.map +1 -0
  37. package/out/utils/theme-util/theme-util.js +61 -0
  38. package/package.json +4 -4
  39. package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +18 -0
  40. package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-form.controller.ts +8 -3
  41. package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-repeater.controller.ts +6 -2
  42. package/src/controller/control/grid/grid/grid.controller.ts +17 -0
  43. package/src/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.ts +6 -0
  44. package/src/controller/control/tree/tree.controller.ts +45 -0
  45. package/src/controller/control/tree/tree.service.ts +1 -1
  46. package/src/global/global-util/global-util.ts +9 -0
  47. package/src/interface/common/i-plugin-factory/i-plugin-factory.ts +4 -5
  48. package/src/interface/controller/state/control/i-tree.state.ts +16 -0
  49. package/src/platform/provider/platform-provider-base.ts +1 -0
  50. package/src/ui-action/provider/front-ui-action-provider.ts +2 -2
  51. package/src/utils/index.ts +1 -0
  52. package/src/utils/theme-util/theme-util.ts +64 -0
@@ -196,4 +196,22 @@ export class TreeExpBarController
196
196
  }
197
197
  await super.onRouterChange(info);
198
198
  }
199
+
200
+ /**
201
+ * 是否显示部件头部
202
+ * @author lxm
203
+ * @date 2023-08-02 07:54:18
204
+ * @protected
205
+ * @return {*} {boolean}
206
+ */
207
+ protected calcControlHeaderVisible(): boolean {
208
+ const hasToolbar = !!this.toolbarController;
209
+ if (!hasToolbar && this.layoutPanel) {
210
+ const controller = this.layoutPanel.panelItems.control_toolbar;
211
+ if (controller) {
212
+ controller.state.visible = false;
213
+ }
214
+ }
215
+ return hasToolbar || !!(this.model.showTitleBar && this.model.title);
216
+ }
199
217
  }
@@ -187,17 +187,22 @@ export class FormMDCtrlFormController extends FormMDCtrlController {
187
187
  * @author lxm
188
188
  * @date 2023-11-11 08:01:49
189
189
  */
190
- create(): void {
190
+ create(index?: number): void {
191
191
  const context = this.context.clone();
192
192
  const params = { ...this.params };
193
193
  if (!this.state.items) {
194
194
  this.state.items = [];
195
195
  }
196
- this.state.items!.push({
196
+ const item = {
197
197
  id: createUUID(),
198
198
  context,
199
199
  params,
200
- });
200
+ };
201
+ if (index !== undefined) {
202
+ this.state.items!.splice(index, 0, item);
203
+ } else {
204
+ this.state.items!.push(item);
205
+ }
201
206
  }
202
207
 
203
208
  refresh(): void {
@@ -140,14 +140,18 @@ export class FormMDCtrlRepeaterController extends FormMDCtrlController {
140
140
  * @author lxm
141
141
  * @date 2023-11-22 04:50:19
142
142
  */
143
- create(): void {
143
+ create(index?: number): void {
144
144
  if (this.isSingleData) {
145
145
  this.setValue({});
146
146
  } else {
147
147
  // 多数据,拷贝数组再添加新对象
148
148
  let tempValue = this.value as IData[] | null;
149
149
  tempValue = tempValue ? [...tempValue] : [];
150
- tempValue.push({});
150
+ if (index !== undefined) {
151
+ tempValue.splice(index, 0, {});
152
+ } else {
153
+ tempValue.push({});
154
+ }
151
155
  this.setValue(tempValue);
152
156
  }
153
157
  }
@@ -1144,4 +1144,21 @@ export class GridController
1144
1144
  const index = this.findRowStateIndex(data);
1145
1145
  return index !== -1 ? this.state.rows[index] : undefined;
1146
1146
  }
1147
+
1148
+ /**
1149
+ * 行单击事件
1150
+ *
1151
+ * @author lxm
1152
+ * @date 2022-08-18 22:08:16
1153
+ * @param {IData} data 选中的单条数据
1154
+ */
1155
+ async onRowClick(data: IData): Promise<void> {
1156
+ // 表格行单击时,只选中点击行
1157
+ this.setSelection([data]);
1158
+
1159
+ // 激活事件
1160
+ if (this.state.mdctrlActiveMode === 1) {
1161
+ await this.setActive(data);
1162
+ }
1163
+ }
1147
1164
  }
@@ -207,6 +207,12 @@ export class GridFieldEditColumnController
207
207
  * @param {string[]} names 变更属性名称
208
208
  */
209
209
  async dataChangeNotify(row: GridRowState, names: string[]): Promise<void> {
210
+ // 重置项,变更时自己的值置空
211
+ const { resetItemName } = this.editItem;
212
+ if (resetItemName && names.includes(resetItemName)) {
213
+ this.setRowValue(row, null);
214
+ }
215
+
210
216
  // 计算禁用状态
211
217
  this.calcColumnDisabled(row);
212
218
 
@@ -36,6 +36,14 @@ export class TreeController
36
36
  */
37
37
  contextMenus: { [p: string]: ContextMenuController } = {};
38
38
 
39
+ /**
40
+ * 是否启用快速搜索
41
+ * @author lxm
42
+ * @date 2023-12-04 03:33:32
43
+ * @type {boolean}
44
+ */
45
+ enableQuickSearch: boolean = false;
46
+
39
47
  protected initState(): void {
40
48
  super.initState();
41
49
  // 根节点初始化
@@ -43,6 +51,7 @@ export class TreeController
43
51
  this.state.expandedKeys = [];
44
52
  this.state.navigational = false;
45
53
  this.state.size = 0;
54
+ this.state.query = '';
46
55
  }
47
56
 
48
57
  protected async onCreated(): Promise<void> {
@@ -50,6 +59,34 @@ export class TreeController
50
59
 
51
60
  this.state.expandedKeys = [...this.state.defaultExpandedKeys];
52
61
 
62
+ // 快速搜索
63
+ if (this.model.detreeNodes?.[0].enableQuickSearch) {
64
+ this.enableQuickSearch = true;
65
+ }
66
+
67
+ // 计算快速搜索占位符
68
+ if (this.dataEntity) {
69
+ const searchFields = this.dataEntity.appDEFields?.filter(field => {
70
+ return field.enableQuickSearch;
71
+ });
72
+ const placeHolders: string[] = [];
73
+ searchFields?.forEach(searchField => {
74
+ if (searchField?.lnlanguageRes && searchField.lnlanguageRes.lanResTag) {
75
+ placeHolders.push(
76
+ ibiz.i18n.t(
77
+ searchField.lnlanguageRes.lanResTag,
78
+ searchField.logicName,
79
+ ),
80
+ );
81
+ } else if (searchField?.logicName) {
82
+ placeHolders.push(searchField.logicName);
83
+ }
84
+ });
85
+ if (placeHolders.length > 0) {
86
+ this.state.placeHolder = placeHolders.join('、');
87
+ }
88
+ }
89
+
53
90
  this.service = new TreeService(this.model);
54
91
  await this.service.init(this.context);
55
92
 
@@ -99,6 +136,14 @@ export class TreeController
99
136
  return nodes;
100
137
  }
101
138
 
139
+ async getFetchParams(extraParams?: IParams): Promise<IParams> {
140
+ const params = await super.getFetchParams(extraParams);
141
+ if (this.state.query) {
142
+ params.query = this.state.query;
143
+ }
144
+ return params;
145
+ }
146
+
102
147
  /**
103
148
  * 加载子节点数据
104
149
  *
@@ -301,7 +301,7 @@ export class TreeService extends MDControlService<IDETree> {
301
301
  const { resultContext, resultParams } = calcNavParams(
302
302
  {
303
303
  deName,
304
- navFilter: navFilter ? `n_${navFilter}_eq` : undefined,
304
+ navFilter: navFilter ? `n_${navFilter.toLowerCase()}_eq` : undefined,
305
305
  pickupDEFName,
306
306
  navParams,
307
307
  navContexts,
@@ -5,6 +5,7 @@ import {
5
5
  LayoutPanelUtil,
6
6
  HandlebarsUtil,
7
7
  RawValueUtil,
8
+ ThemeUtil,
8
9
  } from '../../utils';
9
10
  import {
10
11
  DefaultErrorHandler,
@@ -28,6 +29,14 @@ export class GlobalUtil {
28
29
  */
29
30
  readonly layoutPanel = new LayoutPanelUtil();
30
31
 
32
+ /**
33
+ * 主题设置工具
34
+ *
35
+ * @author chitanda
36
+ * @date 2023-12-02 23:12:27
37
+ */
38
+ readonly theme = new ThemeUtil();
39
+
31
40
  /**
32
41
  * 文本工具
33
42
  *
@@ -11,14 +11,13 @@ import { IPluginItem } from '../i-plugin-item/i-plugin-item';
11
11
  */
12
12
  export interface IPluginFactory {
13
13
  /**
14
- * 设置开发插件,用于本地调试
14
+ * 设置本地开发忽略远程加载插件
15
15
  *
16
16
  * @author chitanda
17
- * @date 2022-11-02 21:11:01
18
- * @param {string} name
19
- * @param {() => Promise<unknown>} fn
17
+ * @date 2023-12-04 17:12:40
18
+ * @param {(string | RegExp)} rule
20
19
  */
21
- setDevPlugin(name: string, fn: () => Promise<unknown>): void;
20
+ setDevIgnore(rule: string | RegExp): void;
22
21
  /**
23
22
  * 加载插件
24
23
  *
@@ -45,6 +45,22 @@ export interface ITreeState extends IMDControlState {
45
45
  * @type {boolean}
46
46
  */
47
47
  navigational: boolean;
48
+
49
+ /**
50
+ * 查询条件
51
+ * @author lxm
52
+ * @date 2023-08-02 07:38:49
53
+ * @type {string}
54
+ */
55
+ query: string;
56
+
57
+ /**
58
+ * 快速搜索占位符
59
+ *
60
+ * @type {string}
61
+ * @memberof IExpBarControlState
62
+ */
63
+ placeHolder: string;
48
64
  }
49
65
 
50
66
  /**
@@ -33,6 +33,7 @@ export abstract class PlatformProviderBase implements IPlatformProvider {
33
33
  const response = await ibiz.net.request(url, {
34
34
  method: 'get',
35
35
  responseType: 'blob',
36
+ baseURL: '',
36
37
  });
37
38
  if (response.status !== 200) {
38
39
  throw new RuntimeError('下载文件失败');
@@ -101,10 +101,10 @@ export class FrontUIActionProvider extends UIActionProviderBase {
101
101
  args: IUILogicParams,
102
102
  ): IUIActionResult {
103
103
  const { scriptCode } = action as IUIAction;
104
- const { context, params, data, event } = args;
104
+ const { context, params, data, event, view } = args;
105
105
  if (scriptCode) {
106
106
  const result = ScriptFactory.execScriptFn(
107
- { context, params, data, el: event?.target },
107
+ { context, params, data, el: event?.target, view },
108
108
  scriptCode,
109
109
  ) as IUIActionResult | undefined;
110
110
  return result || {};
@@ -12,5 +12,6 @@ export * from './modal/modal';
12
12
  export * from './value-rule/value-rule';
13
13
  export * from './script/index';
14
14
  export { TextUtil } from './text-util/text-util';
15
+ export { ThemeUtil } from './theme-util/theme-util';
15
16
  export { RawValueUtil } from './raw-value-util/raw-value-util';
16
17
  export { handleAllSettled } from './promise/promise';
@@ -0,0 +1,64 @@
1
+ import { IAppUITheme, ISysPFPlugin } from '@ibiz/model-core';
2
+
3
+ /**
4
+ * 主题工具类
5
+ *
6
+ * @author chitanda
7
+ * @date 2023-12-02 23:12:15
8
+ * @export
9
+ * @class ThemeUtil
10
+ */
11
+ export class ThemeUtil {
12
+ /**
13
+ * 主题设置元素 html
14
+ *
15
+ * @author chitanda
16
+ * @date 2023-12-02 23:12:26
17
+ * @protected
18
+ * @type {HTMLElement}
19
+ */
20
+ protected html: HTMLElement = document.getElementsByTagName('html')[0];
21
+
22
+ /**
23
+ * 加载主题插件
24
+ *
25
+ * @author chitanda
26
+ * @date 2023-12-03 01:12:44
27
+ * @param {IAppUITheme} theme
28
+ * @return {*} {Promise<void>}
29
+ */
30
+ async loadTheme(theme: IAppUITheme): Promise<void> {
31
+ const data = theme.themeParams || {};
32
+ await ibiz.plugin.loadPlugin({
33
+ runtimeObject: true,
34
+ rtobjectName: theme.name,
35
+ rtobjectRepo: data['theme-package-path'],
36
+ } as unknown as ISysPFPlugin);
37
+ this.setTheme(theme.themeTag!);
38
+ }
39
+
40
+ /**
41
+ * 设置主题
42
+ *
43
+ * @author chitanda
44
+ * @date 2023-12-02 23:12:37
45
+ * @param {string} tag
46
+ */
47
+ setTheme(tag: string): void {
48
+ const theme = this.getTheme();
49
+ this.html.classList.remove(theme);
50
+ this.html.setAttribute('theme', tag);
51
+ this.html.classList.add(tag);
52
+ }
53
+
54
+ /**
55
+ * 获取当前主题
56
+ *
57
+ * @author chitanda
58
+ * @date 2023-12-02 23:12:10
59
+ * @return {*} {string}
60
+ */
61
+ getTheme(): string {
62
+ return this.html.getAttribute('theme')!;
63
+ }
64
+ }