@ibiz-template/vue3-util 0.4.4 → 0.4.5
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 -2
- package/es/index.mjs +4 -0
- package/es/panel-component/index.d.ts +2 -0
- package/es/panel-component/index.d.ts.map +1 -1
- package/es/panel-component/index.mjs +4 -0
- package/es/panel-component/panel-container-group/index.d.ts +29 -0
- package/es/panel-component/panel-container-group/index.d.ts.map +1 -0
- package/es/panel-component/panel-container-group/index.mjs +21 -0
- package/es/panel-component/panel-container-group/panel-container-group.controller.d.ts +32 -0
- package/es/panel-component/panel-container-group/panel-container-group.controller.d.ts.map +1 -0
- package/es/panel-component/panel-container-group/panel-container-group.controller.mjs +35 -0
- package/es/panel-component/panel-container-group/panel-container-group.css +1 -0
- package/es/panel-component/panel-container-group/panel-container-group.d.ts +29 -0
- package/es/panel-component/panel-container-group/panel-container-group.d.ts.map +1 -0
- package/es/panel-component/panel-container-group/panel-container-group.mjs +108 -0
- package/es/panel-component/panel-container-group/panel-container-group.provider.d.ts +16 -0
- package/es/panel-component/panel-container-group/panel-container-group.provider.d.ts.map +1 -0
- package/es/panel-component/panel-container-group/panel-container-group.provider.mjs +15 -0
- package/es/panel-component/panel-container-group/panel-container-group.state.d.ts +13 -0
- package/es/panel-component/panel-container-group/panel-container-group.state.d.ts.map +1 -0
- package/es/panel-component/panel-container-group/panel-container-group.state.mjs +7 -0
- package/es/panel-component/panel-tab-page/index.d.ts +24 -0
- package/es/panel-component/panel-tab-page/index.d.ts.map +1 -0
- package/es/panel-component/panel-tab-page/index.mjs +13 -0
- package/es/panel-component/panel-tab-page/panel-tab-page.d.ts +26 -0
- package/es/panel-component/panel-tab-page/panel-tab-page.d.ts.map +1 -0
- package/es/panel-component/panel-tab-page/panel-tab-page.mjs +63 -0
- package/es/panel-component/panel-tab-page/panel-tab-page.provider.d.ts +14 -0
- package/es/panel-component/panel-tab-page/panel-tab-page.provider.d.ts.map +1 -0
- package/es/panel-component/panel-tab-page/panel-tab-page.provider.mjs +15 -0
- package/es/plugin/plugin-factory/plugin-factory.d.ts +9 -0
- package/es/plugin/plugin-factory/plugin-factory.d.ts.map +1 -1
- package/es/plugin/plugin-factory/plugin-factory.mjs +44 -24
- package/lib/index.cjs +21 -13
- package/package.json +6 -6
- package/src/panel-component/index.ts +2 -0
- package/src/panel-component/panel-container-group/index.ts +22 -0
- package/src/panel-component/panel-container-group/panel-container-group.controller.ts +43 -0
- package/src/panel-component/panel-container-group/panel-container-group.provider.ts +30 -0
- package/src/panel-component/panel-container-group/panel-container-group.scss +91 -0
- package/src/panel-component/panel-container-group/panel-container-group.state.ts +12 -0
- package/src/panel-component/panel-container-group/panel-container-group.tsx +112 -0
- package/src/panel-component/panel-tab-page/index.ts +12 -0
- package/src/panel-component/panel-tab-page/panel-tab-page.provider.ts +27 -0
- package/src/panel-component/panel-tab-page/panel-tab-page.tsx +55 -0
- package/src/plugin/plugin-factory/plugin-factory.ts +45 -23
- package/dist/index.system.min.js.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { PanelItemController } from '@ibiz-template/runtime';
|
|
2
|
+
import { IPanelContainer } from '@ibiz/model-core';
|
|
3
|
+
import { PanelContainerGroupState } from './panel-container-group.state';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 面板分组容器控制器
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class PanelContainerGroupController
|
|
10
|
+
* @extends {PanelItemController}
|
|
11
|
+
*/
|
|
12
|
+
export class PanelContainerGroupController extends PanelItemController<IPanelContainer> {
|
|
13
|
+
declare state: PanelContainerGroupState;
|
|
14
|
+
|
|
15
|
+
protected createState(): PanelContainerGroupState {
|
|
16
|
+
return new PanelContainerGroupState(this.parent?.state);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 禁用关闭
|
|
21
|
+
*
|
|
22
|
+
* @author chitanda
|
|
23
|
+
* @date 2022-09-14 14:09:51
|
|
24
|
+
* @readonly
|
|
25
|
+
* @type {boolean}
|
|
26
|
+
*/
|
|
27
|
+
get disableClose(): boolean {
|
|
28
|
+
const { titleBarCloseMode: mode } = this.model;
|
|
29
|
+
return mode === 0 || mode === undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 是否默认展开分组
|
|
34
|
+
*
|
|
35
|
+
* @author chitanda
|
|
36
|
+
* @date 2022-09-14 14:09:09
|
|
37
|
+
* @readonly
|
|
38
|
+
*/
|
|
39
|
+
get defaultExpansion(): boolean {
|
|
40
|
+
const { titleBarCloseMode: mode } = this.model;
|
|
41
|
+
return this.disableClose || mode === 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IPanelItemProvider,
|
|
3
|
+
PanelController,
|
|
4
|
+
PanelItemController,
|
|
5
|
+
} from '@ibiz-template/runtime';
|
|
6
|
+
import { IPanelContainer } from '@ibiz/model-core';
|
|
7
|
+
import { PanelContainerGroupController } from './panel-container-group.controller';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 面板分组容器适配器
|
|
11
|
+
*
|
|
12
|
+
* @author lxm
|
|
13
|
+
* @date 2022-09-19 22:09:03
|
|
14
|
+
* @export
|
|
15
|
+
* @class PanelContainerGroupProvider
|
|
16
|
+
* @implements {EditorProvider}
|
|
17
|
+
*/
|
|
18
|
+
export class PanelContainerGroupProvider implements IPanelItemProvider {
|
|
19
|
+
component: string = 'IBizPanelContainerGroup';
|
|
20
|
+
|
|
21
|
+
async createController(
|
|
22
|
+
panelItem: IPanelContainer,
|
|
23
|
+
panel: PanelController,
|
|
24
|
+
parent: PanelItemController | undefined,
|
|
25
|
+
): Promise<PanelItemController> {
|
|
26
|
+
const c = new PanelContainerGroupController(panelItem, panel, parent);
|
|
27
|
+
await c.init();
|
|
28
|
+
return c;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
$panel-container-group: (
|
|
2
|
+
'bg-color': transparent,
|
|
3
|
+
);
|
|
4
|
+
|
|
5
|
+
$panel-container-group-header: (
|
|
6
|
+
'bg-color': transparent,
|
|
7
|
+
'padding': getCssVar(spacing, base, tight),
|
|
8
|
+
'border-color': getCssVar('color', 'border'),
|
|
9
|
+
'height': 49px,
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
$panel-container-group-caption: (
|
|
13
|
+
'text-color': getCssVar(color, text, 0),
|
|
14
|
+
'font-size': getCssVar('font-size', 'header-5'),
|
|
15
|
+
'font-weight': getCssVar(font-weight, bold),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
$panel-container-group-content: (
|
|
19
|
+
'bg-color': transparent,
|
|
20
|
+
'padding': getCssVar(spacing, tight),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
@include b(panel-container-group) {
|
|
24
|
+
@include set-component-css-var('panel-container-group', $panel-container-group);
|
|
25
|
+
@include set-component-css-var('panel-container-group-header', $panel-container-group-header);
|
|
26
|
+
@include set-component-css-var('panel-container-group-caption', $panel-container-group-caption);
|
|
27
|
+
@include set-component-css-var('panel-container-group-content', $panel-container-group-content);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include b(panel-container-group) {
|
|
31
|
+
height: 100%;
|
|
32
|
+
background-color: getCssVar('panel-container-group', 'bg-color');
|
|
33
|
+
border-radius: getCssVar('border-radius', 'base');
|
|
34
|
+
|
|
35
|
+
@include e(caption) {
|
|
36
|
+
@include utils-ellipsis;
|
|
37
|
+
|
|
38
|
+
font-size: getCssVar('panel-container-group-caption', 'font-size');
|
|
39
|
+
font-weight: getCssVar('panel-container-group-caption', 'font-weight');
|
|
40
|
+
color: getCssVar('panel-container-group-caption', 'text-color');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 折叠相关样式
|
|
45
|
+
@include b(panel-container-group-collapse) {
|
|
46
|
+
> .#{bem(panel-container-group-content)} {
|
|
47
|
+
display: block;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@include when(collapse) {
|
|
51
|
+
> .#{bem(panel-container-group-content)} {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@include b(panel-container-group-header) {
|
|
58
|
+
@include flex;
|
|
59
|
+
|
|
60
|
+
height: getCssVar('panel-container-group-header', 'height');
|
|
61
|
+
padding: getCssVar('panel-container-group-header', 'padding');
|
|
62
|
+
margin: getCssVar('panel-container-group-header', 'margin');
|
|
63
|
+
border-bottom: 1px solid getCssVar('panel-container-group-header', 'border-color');
|
|
64
|
+
|
|
65
|
+
@include e((left, right)) {
|
|
66
|
+
display: inline-block;
|
|
67
|
+
width: 50%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@include e(right) {
|
|
71
|
+
text-align: right;
|
|
72
|
+
@include flex(row, flex-end, center);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@include b(panel-container-group-content) {
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
@include e(row){
|
|
80
|
+
width: 100%;
|
|
81
|
+
height: 100%;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.#{bem('panel-container-group', '', 'show-header')} {
|
|
86
|
+
> .#{bem('panel-container-group-content')} {
|
|
87
|
+
height: calc(100% - getCssVar('panel-container-group-header', 'height'));
|
|
88
|
+
padding: getCssVar('panel-container-group-content', 'padding');
|
|
89
|
+
background-color: getCssVar('panel-container-group-content', 'bg-color');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PanelItemState } from '@ibiz-template/runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 面板分组容器状态
|
|
5
|
+
*
|
|
6
|
+
* @author lxm
|
|
7
|
+
* @date 2023-02-07 06:04:27
|
|
8
|
+
* @export
|
|
9
|
+
* @class PanelContainerGroupState
|
|
10
|
+
* @extends {PanelItemState}
|
|
11
|
+
*/
|
|
12
|
+
export class PanelContainerGroupState extends PanelItemState {}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { IPanelContainer } from '@ibiz/model-core';
|
|
2
|
+
import { computed, defineComponent, PropType, ref, VNode } from 'vue';
|
|
3
|
+
import { PanelContainerGroupController } from './panel-container-group.controller';
|
|
4
|
+
import './panel-container-group.scss';
|
|
5
|
+
import { useNamespace } from '../../use';
|
|
6
|
+
|
|
7
|
+
export const PanelContainerGroup = defineComponent({
|
|
8
|
+
name: 'IBizPanelContainerGroup',
|
|
9
|
+
props: {
|
|
10
|
+
modelData: {
|
|
11
|
+
type: Object as PropType<IPanelContainer>,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
controller: {
|
|
15
|
+
type: PanelContainerGroupController,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const ns = useNamespace('panel-container-group');
|
|
21
|
+
|
|
22
|
+
const isCollapse = ref(!props.controller.defaultExpansion);
|
|
23
|
+
|
|
24
|
+
const changeCollapse = (): void => {
|
|
25
|
+
if (!props.controller.disableClose) {
|
|
26
|
+
isCollapse.value = !isCollapse.value;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const captionText = computed(() => {
|
|
31
|
+
const { captionItemName, caption, capLanguageRes } = props.modelData;
|
|
32
|
+
if (captionItemName) {
|
|
33
|
+
return props.controller.data[captionItemName];
|
|
34
|
+
}
|
|
35
|
+
let text = caption;
|
|
36
|
+
if (capLanguageRes) {
|
|
37
|
+
text = ibiz.i18n.t(capLanguageRes.lanResTag!, caption);
|
|
38
|
+
}
|
|
39
|
+
return text;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return { ns, captionText, changeCollapse, isCollapse };
|
|
43
|
+
},
|
|
44
|
+
render() {
|
|
45
|
+
const classArr: string[] = [
|
|
46
|
+
this.ns.b(),
|
|
47
|
+
this.ns.m(this.modelData.id),
|
|
48
|
+
...this.controller.containerClass,
|
|
49
|
+
this.ns.is('hidden', !this.controller.state.visible),
|
|
50
|
+
];
|
|
51
|
+
if (this.modelData.showCaption === true) {
|
|
52
|
+
classArr.push(this.ns.m('show-header'));
|
|
53
|
+
classArr.push(this.ns.b('collapse'));
|
|
54
|
+
classArr.push(this.ns.is('collapse', this.isCollapse));
|
|
55
|
+
if (this.controller.disableClose) {
|
|
56
|
+
classArr.push(this.ns.bm('collapse', 'disable-close'));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 内容区默认插槽处理,封装app-col
|
|
61
|
+
const defaultSlots: VNode[] = this.$slots.default?.() || [];
|
|
62
|
+
const content = (
|
|
63
|
+
<iBizRow slot='content' layout={this.modelData.layout}>
|
|
64
|
+
{defaultSlots.map(slot => {
|
|
65
|
+
const props = slot.props as IData;
|
|
66
|
+
if (!props || !props.controller) {
|
|
67
|
+
return slot;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<iBizCol
|
|
72
|
+
layoutPos={props.modelData.layoutPos}
|
|
73
|
+
state={props.controller.state}
|
|
74
|
+
>
|
|
75
|
+
{slot}
|
|
76
|
+
</iBizCol>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</iBizRow>
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
// 头部绘制
|
|
83
|
+
let header: unknown = null;
|
|
84
|
+
if (this.modelData.showCaption) {
|
|
85
|
+
header = (
|
|
86
|
+
<div class={[this.ns.b('header')]} onClick={this.changeCollapse}>
|
|
87
|
+
<div class={[this.ns.be('header', 'left')]}>
|
|
88
|
+
<div class={[this.ns.e('caption'), ...this.controller.labelClass]}>
|
|
89
|
+
{this.captionText}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div class={[this.ns.be('header', 'right')]}>
|
|
93
|
+
{this.modelData.titleBarCloseMode !== undefined &&
|
|
94
|
+
this.modelData.titleBarCloseMode !== 0 &&
|
|
95
|
+
(this.isCollapse ? (
|
|
96
|
+
<ion-icon name='caret-forward-sharp' />
|
|
97
|
+
) : (
|
|
98
|
+
<ion-icon name='caret-down-sharp' />
|
|
99
|
+
))}
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div class={classArr}>
|
|
107
|
+
{header}
|
|
108
|
+
<div class={[this.ns.b('content')]}>{content}</div>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { registerPanelItemProvider } from '@ibiz-template/runtime';
|
|
2
|
+
import { App } from 'vue';
|
|
3
|
+
import { PanelTabPage } from './panel-tab-page';
|
|
4
|
+
import { PanelTabPageProvider } from './panel-tab-page.provider';
|
|
5
|
+
import { withInstall } from '../../util';
|
|
6
|
+
|
|
7
|
+
export const IBizPanelTabPage = withInstall(PanelTabPage, function (v: App) {
|
|
8
|
+
v.component(PanelTabPage.name, PanelTabPage);
|
|
9
|
+
registerPanelItemProvider('TABPAGE', () => new PanelTabPageProvider());
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export default IBizPanelTabPage;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IPanelItemProvider,
|
|
3
|
+
PanelController,
|
|
4
|
+
PanelItemController,
|
|
5
|
+
} from '@ibiz-template/runtime';
|
|
6
|
+
import { IPanelItem } from '@ibiz/model-core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 面板分页适配器
|
|
10
|
+
*
|
|
11
|
+
* @export
|
|
12
|
+
* @class PanelTabPageController
|
|
13
|
+
* @implements {IPanelItemProvider}
|
|
14
|
+
*/
|
|
15
|
+
export class PanelTabPageProvider implements IPanelItemProvider {
|
|
16
|
+
component: string = 'IBizPanelTabPage';
|
|
17
|
+
|
|
18
|
+
async createController(
|
|
19
|
+
panelItem: IPanelItem,
|
|
20
|
+
panel: PanelController,
|
|
21
|
+
parent: PanelItemController | undefined,
|
|
22
|
+
): Promise<PanelItemController> {
|
|
23
|
+
const c = new PanelItemController(panelItem, panel, parent);
|
|
24
|
+
await c.init();
|
|
25
|
+
return c;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { computed, defineComponent, PropType, VNode } from 'vue';
|
|
2
|
+
import { IPanelContainer } from '@ibiz/model-core';
|
|
3
|
+
import { PanelItemController } from '@ibiz-template/runtime';
|
|
4
|
+
import { useNamespace } from '../../use';
|
|
5
|
+
|
|
6
|
+
export const PanelTabPage = defineComponent({
|
|
7
|
+
name: 'IBizPanelTabPage',
|
|
8
|
+
props: {
|
|
9
|
+
modelData: {
|
|
10
|
+
// IPanelTabPage 不能使用 IPanelTabPage模型 否则会类型报错
|
|
11
|
+
type: Object as PropType<IPanelContainer>,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
controller: {
|
|
15
|
+
type: PanelItemController,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
setup(props) {
|
|
20
|
+
const ns = useNamespace('panel-tab-page');
|
|
21
|
+
// 类名控制
|
|
22
|
+
const classArr = computed(() => {
|
|
23
|
+
const { id } = props.modelData;
|
|
24
|
+
const result: Array<string | false> = [ns.b(), ns.m(id)];
|
|
25
|
+
result.push(...props.controller.containerClass);
|
|
26
|
+
return result;
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
ns,
|
|
30
|
+
classArr,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
render() {
|
|
34
|
+
const defaultSlots: VNode[] = this.$slots.default?.() || [];
|
|
35
|
+
return (
|
|
36
|
+
<iBizRow
|
|
37
|
+
class={[this.ns.b(), this.ns.m(this.modelData.codeName), this.classArr]}
|
|
38
|
+
layout={this.modelData.layout}
|
|
39
|
+
>
|
|
40
|
+
{defaultSlots.map(slot => {
|
|
41
|
+
const props = slot.props as IData;
|
|
42
|
+
if (!props || !props.controller) {
|
|
43
|
+
return slot;
|
|
44
|
+
}
|
|
45
|
+
const c = props.controller;
|
|
46
|
+
return (
|
|
47
|
+
<iBizCol layoutPos={c.model.layoutPos} state={c.state}>
|
|
48
|
+
{slot}
|
|
49
|
+
</iBizCol>
|
|
50
|
+
);
|
|
51
|
+
})}
|
|
52
|
+
</iBizRow>
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
});
|
|
@@ -77,6 +77,16 @@ export class PluginFactory implements IPluginFactory {
|
|
|
77
77
|
*/
|
|
78
78
|
protected ignoreRules: (string | RegExp)[] = [];
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* 插件加载队列
|
|
82
|
+
*
|
|
83
|
+
* @author chitanda
|
|
84
|
+
* @date 2023-12-05 16:12:04
|
|
85
|
+
* @protected
|
|
86
|
+
* @type {Map<string, Promise<boolean>>}
|
|
87
|
+
*/
|
|
88
|
+
protected loadQueue: Map<string, Promise<boolean>> = new Map();
|
|
89
|
+
|
|
80
90
|
/**
|
|
81
91
|
* 是否忽略插件加载
|
|
82
92
|
*
|
|
@@ -174,13 +184,35 @@ export class PluginFactory implements IPluginFactory {
|
|
|
174
184
|
if (plugin.runtimeObject === true) {
|
|
175
185
|
const pluginRef = plugin as unknown as IAppPFPluginRef;
|
|
176
186
|
if (pluginRef) {
|
|
187
|
+
const rtObjectName = pluginRef.rtobjectName!;
|
|
188
|
+
const rtObjectRepo = pluginRef.rtobjectRepo!;
|
|
189
|
+
if (this.isIgnore(rtObjectRepo)) {
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
if (this.pluginCache.has(rtObjectName)) {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
if (this.loadQueue.has(rtObjectRepo)) {
|
|
196
|
+
const p = await this.loadQueue.get(rtObjectRepo)!;
|
|
197
|
+
try {
|
|
198
|
+
const result = await p;
|
|
199
|
+
return result;
|
|
200
|
+
} catch (error) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
177
204
|
try {
|
|
178
|
-
|
|
205
|
+
const p = this.loadPluginRef(
|
|
179
206
|
pluginRef.rtobjectName!,
|
|
180
207
|
pluginRef.rtobjectRepo!,
|
|
181
208
|
);
|
|
209
|
+
this.loadQueue.set(rtObjectRepo, p);
|
|
210
|
+
const result = await p;
|
|
211
|
+
return result;
|
|
182
212
|
} catch (error) {
|
|
183
213
|
throw new RuntimeModelError(pluginRef, `配置加载失败`);
|
|
214
|
+
} finally {
|
|
215
|
+
this.loadQueue.delete(rtObjectRepo);
|
|
184
216
|
}
|
|
185
217
|
}
|
|
186
218
|
}
|
|
@@ -249,15 +281,9 @@ export class PluginFactory implements IPluginFactory {
|
|
|
249
281
|
*/
|
|
250
282
|
protected async loadScript(remotePlugin: RemotePluginItem): Promise<void> {
|
|
251
283
|
const pluginPath: string = remotePlugin.repo;
|
|
252
|
-
const { name, system,
|
|
284
|
+
const { name, system, styles = [] } = remotePlugin.config;
|
|
253
285
|
let scriptUrl = '';
|
|
254
|
-
|
|
255
|
-
scriptUrl = this.urlReg.test(pluginPath)
|
|
256
|
-
? `${pluginPath}/${join(module)}`
|
|
257
|
-
: `${ibiz.env.pluginBaseUrl}/${pluginPath}/${join(module)}`;
|
|
258
|
-
} else {
|
|
259
|
-
scriptUrl = join(pluginPath, system);
|
|
260
|
-
}
|
|
286
|
+
scriptUrl = join(pluginPath, system);
|
|
261
287
|
if (scriptUrl) {
|
|
262
288
|
if (this.cache.has(scriptUrl)) {
|
|
263
289
|
return;
|
|
@@ -267,20 +293,16 @@ export class PluginFactory implements IPluginFactory {
|
|
|
267
293
|
const styleUrls = (typeof styles === 'string' ? [styles] : styles).map(
|
|
268
294
|
styleUrl => this.parseUrl(path.join(pluginPath, styleUrl)),
|
|
269
295
|
);
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
281
|
-
} as any);
|
|
282
|
-
data = await System.import(name);
|
|
283
|
-
}
|
|
296
|
+
System.addImportMap({
|
|
297
|
+
imports: {
|
|
298
|
+
[name]: url,
|
|
299
|
+
},
|
|
300
|
+
styles: {
|
|
301
|
+
[name]: styleUrls,
|
|
302
|
+
},
|
|
303
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
304
|
+
} as any);
|
|
305
|
+
data = await System.import(name);
|
|
284
306
|
if (data) {
|
|
285
307
|
if (data.default) {
|
|
286
308
|
this.setPluginCode(data.default);
|