@ibiz-template/vue3-util 0.5.3-beta.9 → 0.5.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.
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/es/common/badge/badge.css +1 -0
- package/es/common/badge/badge.d.ts +26 -0
- package/es/common/badge/badge.d.ts.map +1 -0
- package/es/common/badge/badge.mjs +32 -0
- package/es/common/code-list/code-list.d.ts +2 -2
- package/es/common/index.d.ts +1 -0
- package/es/common/index.d.ts.map +1 -1
- package/es/common/index.mjs +1 -0
- package/es/common/view-shell/view-shell.d.ts.map +1 -1
- package/es/common/view-shell/view-shell.mjs +21 -9
- package/es/index.mjs +1 -0
- package/es/plugin/plugin-factory/plugin-factory.d.ts +11 -1
- package/es/plugin/plugin-factory/plugin-factory.d.ts.map +1 -1
- package/es/plugin/plugin-factory/plugin-factory.mjs +41 -8
- package/es/props/editor/autocomplete.d.ts +2 -2
- package/es/props/editor/check-box-list.d.ts +2 -2
- package/es/props/editor/check-box.d.ts +2 -2
- package/es/props/editor/data-picker.d.ts +2 -2
- package/es/props/editor/date-picker.d.ts +2 -2
- package/es/props/editor/date-range.d.ts +2 -2
- package/es/props/editor/dropdown-list.d.ts +2 -2
- package/es/props/editor/list-box.d.ts +2 -2
- package/es/props/editor/number-range.d.ts +2 -2
- package/es/props/editor/radio-button-list.d.ts +2 -2
- package/es/props/editor/rate.d.ts +2 -2
- package/es/props/editor/raw.d.ts +2 -2
- package/es/props/editor/slider.d.ts +2 -2
- package/es/props/editor/span.d.ts +2 -2
- package/es/props/editor/stepper.d.ts +2 -2
- package/es/props/editor/switch.d.ts +2 -2
- package/es/props/editor/text-box.d.ts +2 -2
- package/es/use/view/use-view-controller/use-view-controller.d.ts.map +1 -1
- package/es/use/view/use-view-controller/use-view-controller.mjs +13 -3
- package/es/util/store/async-action/async-action.d.ts.map +1 -1
- package/es/util/store/async-action/async-action.mjs +8 -0
- package/lib/index.cjs +2 -0
- package/package.json +6 -6
- package/src/common/badge/badge.scss +29 -0
- package/src/common/badge/badge.tsx +26 -0
- package/src/common/index.ts +1 -0
- package/src/common/view-shell/view-shell.tsx +30 -13
- package/src/plugin/plugin-factory/plugin-factory.ts +48 -8
- package/src/use/view/use-view-controller/use-view-controller.ts +14 -3
- package/src/util/store/async-action/async-action.ts +9 -0
|
@@ -54,24 +54,41 @@ export const IBizViewShell = defineComponent({
|
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
const params = props.params || {};
|
|
58
|
+
|
|
57
59
|
/** 加载动态模型的请求参数 */
|
|
58
60
|
const loadModelParams: IParams = {};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
if (params.srfkey) {
|
|
62
|
+
loadModelParams.srfkey = params.srfkey;
|
|
63
|
+
} else {
|
|
64
|
+
// * 计算资源路径上下文参数
|
|
65
|
+
// 主键
|
|
66
|
+
const srfkey = props.context[appDe.codeName!.toLowerCase()];
|
|
67
|
+
if (srfkey) {
|
|
68
|
+
loadModelParams.srfkey = srfkey;
|
|
69
|
+
}
|
|
64
70
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
loadModelParams.
|
|
70
|
-
|
|
71
|
+
|
|
72
|
+
// 如果视图参数同时存在 srfparentkey 与 srfparentdeanme 则直接使用视图参数
|
|
73
|
+
if (params.srfparentkey && params.srfparentdeanme) {
|
|
74
|
+
loadModelParams.srfparentkey = params.srfparentkey;
|
|
75
|
+
loadModelParams.srfparentdeanme = params.srfparentdeanme;
|
|
76
|
+
} else {
|
|
77
|
+
// 上层资源路径主实体名称和主键
|
|
78
|
+
const match = getMatchResPath(props.context, appDe);
|
|
79
|
+
if (match && match.keys.length > 1) {
|
|
80
|
+
const parentDeKey = match.keys[match.keys.length - 2];
|
|
81
|
+
loadModelParams.srfparentkey =
|
|
82
|
+
params.srfparentkey || props.context[parentDeKey];
|
|
83
|
+
loadModelParams.srfparentdeanme =
|
|
84
|
+
params.srfparentdeanme || parentDeKey;
|
|
85
|
+
}
|
|
71
86
|
}
|
|
72
87
|
|
|
73
|
-
//
|
|
74
|
-
if (
|
|
88
|
+
// 如果视图参数中存在 srfwftag 则直接使用视图参数
|
|
89
|
+
if (params.srfwftag) {
|
|
90
|
+
loadModelParams.srfwftag = params.srfwftag;
|
|
91
|
+
} else if (appDe && viewModel.enableWF) {
|
|
75
92
|
// 处理数据请求的上下文
|
|
76
93
|
const context: IContext = { ...props.context };
|
|
77
94
|
// 存在主键则加载数据计算对应的参数
|
|
@@ -260,14 +260,7 @@ export class PluginFactory implements IPluginFactory {
|
|
|
260
260
|
configData as RemotePluginConfig,
|
|
261
261
|
);
|
|
262
262
|
if (remotePlugin) {
|
|
263
|
-
|
|
264
|
-
const importMap = this.handleSystemImportMap(
|
|
265
|
-
remotePlugin.config['systemjs-importmap'],
|
|
266
|
-
);
|
|
267
|
-
if (importMap) {
|
|
268
|
-
System.addImportMap(importMap);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
263
|
+
await this.loadPluginExternal(remotePlugin.config);
|
|
271
264
|
try {
|
|
272
265
|
await this.loadScript(remotePlugin);
|
|
273
266
|
this.pluginCache.set(rtObjectName, remotePlugin);
|
|
@@ -366,6 +359,43 @@ export class PluginFactory implements IPluginFactory {
|
|
|
366
359
|
return url;
|
|
367
360
|
}
|
|
368
361
|
|
|
362
|
+
/**
|
|
363
|
+
* 加载插件的外部依赖
|
|
364
|
+
*
|
|
365
|
+
* @author chitanda
|
|
366
|
+
* @date 2024-01-19 19:01:39
|
|
367
|
+
* @protected
|
|
368
|
+
* @param {RemotePluginConfig} config
|
|
369
|
+
* @return {*} {Promise<void>}
|
|
370
|
+
*/
|
|
371
|
+
protected async loadPluginExternal(
|
|
372
|
+
config: RemotePluginConfig,
|
|
373
|
+
): Promise<void> {
|
|
374
|
+
if (!config['systemjs-importmap']) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const importMap = this.handleSystemImportMap(config['systemjs-importmap'])!;
|
|
378
|
+
if (importMap.packages) {
|
|
379
|
+
const pkgs = importMap.packages;
|
|
380
|
+
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
381
|
+
for (const key in pkgs) {
|
|
382
|
+
const pkgPath = pkgs[key];
|
|
383
|
+
// eslint-disable-next-line no-await-in-loop
|
|
384
|
+
const res = await ibiz.net.axios({
|
|
385
|
+
method: 'get',
|
|
386
|
+
headers: { 'Access-Control-Allow-Origin': '*' },
|
|
387
|
+
url: pkgPath,
|
|
388
|
+
});
|
|
389
|
+
if (res.status !== 200) {
|
|
390
|
+
throw new Error(`配置加载失败`);
|
|
391
|
+
}
|
|
392
|
+
// eslint-disable-next-line no-await-in-loop
|
|
393
|
+
await this.loadPluginExternal(res.data!);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
System.addImportMap(importMap);
|
|
397
|
+
}
|
|
398
|
+
|
|
369
399
|
/**
|
|
370
400
|
* 处理 systemjs importmap 配置
|
|
371
401
|
*
|
|
@@ -379,6 +409,16 @@ export class PluginFactory implements IPluginFactory {
|
|
|
379
409
|
importMap: ISystemImportMap,
|
|
380
410
|
): ISystemImportMap | null {
|
|
381
411
|
if (importMap) {
|
|
412
|
+
if (importMap.packages) {
|
|
413
|
+
const pkgs = importMap.packages;
|
|
414
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
415
|
+
for (const key in pkgs) {
|
|
416
|
+
if (Object.prototype.hasOwnProperty.call(pkgs, key)) {
|
|
417
|
+
const url = pkgs[key];
|
|
418
|
+
pkgs[key] = this.parseUrl(url, importMap.baseUrl);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
382
422
|
if (importMap.imports) {
|
|
383
423
|
const imps = importMap.imports;
|
|
384
424
|
// eslint-disable-next-line no-restricted-syntax
|
|
@@ -107,6 +107,8 @@ export function useViewController<T extends IViewController>(
|
|
|
107
107
|
c = fn(props.modelData, props.context, props.params, ctx) as T;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
ibiz.util.viewStack.add(c.id, c);
|
|
111
|
+
|
|
110
112
|
watchAndUpdateContextParams(props, c);
|
|
111
113
|
watchAndUpdateState(props, c);
|
|
112
114
|
|
|
@@ -123,9 +125,15 @@ export function useViewController<T extends IViewController>(
|
|
|
123
125
|
c.modal = props.modal;
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
onActivated(() =>
|
|
128
|
+
onActivated(() => {
|
|
129
|
+
c.onActivated();
|
|
130
|
+
ibiz.util.viewStack.active(c.id);
|
|
131
|
+
});
|
|
127
132
|
|
|
128
|
-
onDeactivated(() =>
|
|
133
|
+
onDeactivated(() => {
|
|
134
|
+
c.onDeactivated();
|
|
135
|
+
ibiz.util.viewStack.deactivate(c.id);
|
|
136
|
+
});
|
|
129
137
|
|
|
130
138
|
c.force = useForce();
|
|
131
139
|
|
|
@@ -137,6 +145,9 @@ export function useViewController<T extends IViewController>(
|
|
|
137
145
|
c.created();
|
|
138
146
|
|
|
139
147
|
// 卸载时销毁
|
|
140
|
-
onBeforeUnmount(() =>
|
|
148
|
+
onBeforeUnmount(() => {
|
|
149
|
+
c.destroyed();
|
|
150
|
+
ibiz.util.viewStack.remove(c.id);
|
|
151
|
+
});
|
|
141
152
|
return c as T;
|
|
142
153
|
}
|
|
@@ -35,6 +35,15 @@ function formatAsyncAction(data: IPortalAsyncAction): IPortalAsyncAction {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
if (isNil(data.completionrate)) {
|
|
39
|
+
const num = Number(data.completionrate);
|
|
40
|
+
if (Number.isNaN(num)) {
|
|
41
|
+
data.completionrate = undefined;
|
|
42
|
+
} else {
|
|
43
|
+
data.completionrate = num;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
return data;
|
|
39
48
|
}
|
|
40
49
|
|