@ibiz-template/vue3-util 0.6.14 → 0.6.15
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/index.mjs +3 -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 +3 -0
- package/es/panel-component/panel-container-tabs/index.d.ts +23 -0
- package/es/panel-component/panel-container-tabs/index.d.ts.map +1 -0
- package/es/panel-component/panel-container-tabs/index.mjs +19 -0
- package/es/panel-component/panel-container-tabs/panel-container-tabs.css +1 -0
- package/es/panel-component/panel-container-tabs/panel-container-tabs.d.ts +26 -0
- package/es/panel-component/panel-container-tabs/panel-container-tabs.d.ts.map +1 -0
- package/es/panel-component/panel-container-tabs/panel-container-tabs.mjs +35 -0
- package/es/panel-component/panel-container-tabs/panel-container-tabs.provider.d.ts +16 -0
- package/es/panel-component/panel-container-tabs/panel-container-tabs.provider.d.ts.map +1 -0
- package/es/panel-component/panel-container-tabs/panel-container-tabs.provider.mjs +15 -0
- package/es/panel-component/teleport-placeholder/index.d.ts +28 -0
- package/es/panel-component/teleport-placeholder/index.d.ts.map +1 -0
- package/es/panel-component/teleport-placeholder/index.mjs +19 -0
- package/es/panel-component/teleport-placeholder/teleport-placeholder.css +1 -0
- package/es/panel-component/teleport-placeholder/teleport-placeholder.d.ts +29 -0
- package/es/panel-component/teleport-placeholder/teleport-placeholder.d.ts.map +1 -0
- package/es/panel-component/teleport-placeholder/teleport-placeholder.mjs +63 -0
- package/es/panel-component/teleport-placeholder/teleport-placeholder.provider.d.ts +17 -0
- package/es/panel-component/teleport-placeholder/teleport-placeholder.provider.d.ts.map +1 -0
- package/es/panel-component/teleport-placeholder/teleport-placeholder.provider.mjs +16 -0
- package/es/view/common/index.d.ts +5 -0
- package/es/view/common/index.d.ts.map +1 -1
- package/es/view/common/view.d.ts +6 -3
- package/es/view/common/view.d.ts.map +1 -1
- package/es/view/common/view.mjs +62 -43
- package/lib/index.cjs +21 -15
- package/lib/panel-component/index.cjs +6 -0
- package/lib/panel-component/panel-container-tabs/index.cjs +24 -0
- package/lib/panel-component/panel-container-tabs/panel-container-tabs.cjs +37 -0
- package/lib/panel-component/panel-container-tabs/panel-container-tabs.css +1 -0
- package/lib/panel-component/panel-container-tabs/panel-container-tabs.provider.cjs +17 -0
- package/lib/panel-component/teleport-placeholder/index.cjs +25 -0
- package/lib/panel-component/teleport-placeholder/teleport-placeholder.cjs +65 -0
- package/lib/panel-component/teleport-placeholder/teleport-placeholder.css +1 -0
- package/lib/panel-component/teleport-placeholder/teleport-placeholder.provider.cjs +18 -0
- package/lib/view/common/view.cjs +60 -41
- package/package.json +6 -6
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var runtime = require('@ibiz-template/runtime');
|
|
6
|
+
require('../../util/index.cjs');
|
|
7
|
+
var teleportPlaceholder = require('./teleport-placeholder.cjs');
|
|
8
|
+
var teleportPlaceholder_provider = require('./teleport-placeholder.provider.cjs');
|
|
9
|
+
var install = require('../../util/install.cjs');
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
const IBizTeleportPlaceholder = install.withInstall(
|
|
13
|
+
teleportPlaceholder.TeleportPlaceholder,
|
|
14
|
+
function(v) {
|
|
15
|
+
v.component(teleportPlaceholder.TeleportPlaceholder.name, teleportPlaceholder.TeleportPlaceholder);
|
|
16
|
+
runtime.registerPanelItemProvider(
|
|
17
|
+
"RAWITEM_TELEPORT_PLACEHOLDER",
|
|
18
|
+
() => new teleportPlaceholder_provider.TeleportPlaceholderProvider()
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
exports.TeleportPlaceholderProvider = teleportPlaceholder_provider.TeleportPlaceholderProvider;
|
|
24
|
+
exports.IBizTeleportPlaceholder = IBizTeleportPlaceholder;
|
|
25
|
+
exports.default = IBizTeleportPlaceholder;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
require('../../use/index.cjs');
|
|
5
|
+
require('./teleport-placeholder.css');
|
|
6
|
+
var namespace = require('../../use/namespace/namespace.cjs');
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
const TeleportPlaceholder = /* @__PURE__ */ vue.defineComponent({
|
|
10
|
+
name: "IBizTeleportPlaceholder",
|
|
11
|
+
props: {
|
|
12
|
+
modelData: {
|
|
13
|
+
type: Object,
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
controller: {
|
|
17
|
+
type: Object,
|
|
18
|
+
required: true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
setup(props) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const ns = namespace.useNamespace("teleport-placeholder");
|
|
24
|
+
const tempStyle = vue.ref("");
|
|
25
|
+
const {
|
|
26
|
+
rawItem
|
|
27
|
+
} = props.modelData;
|
|
28
|
+
if (rawItem && rawItem.cssStyle) {
|
|
29
|
+
tempStyle.value = rawItem.cssStyle;
|
|
30
|
+
}
|
|
31
|
+
const classArr = vue.computed(() => {
|
|
32
|
+
const {
|
|
33
|
+
id
|
|
34
|
+
} = props.modelData;
|
|
35
|
+
const result = [ns.b(), ns.m(id)];
|
|
36
|
+
result.push(...props.controller.containerClass);
|
|
37
|
+
return result;
|
|
38
|
+
});
|
|
39
|
+
const viewCodeName = props.controller.panel.view.model.codeName;
|
|
40
|
+
let teleportTag = "".concat(viewCodeName == null ? void 0 : viewCodeName.toLowerCase(), "-").concat(props.modelData.id);
|
|
41
|
+
const paramTag = (_b = (_a = props.modelData.rawItem) == null ? void 0 : _a.rawItemParams) == null ? void 0 : _b.find((item) => item.key === "TeleportTag");
|
|
42
|
+
if (paramTag && paramTag.value) {
|
|
43
|
+
teleportTag = paramTag.value;
|
|
44
|
+
}
|
|
45
|
+
ibiz.log.debug("\u89C6\u56FE".concat(viewCodeName, "\u7684\u9762\u677F\u6210\u5458").concat(props.modelData.id, "\u7684\u5360\u4F4D\u6807\u8BC6\u662F\uFF1A"), teleportTag);
|
|
46
|
+
return {
|
|
47
|
+
ns,
|
|
48
|
+
classArr,
|
|
49
|
+
tempStyle,
|
|
50
|
+
teleportTag
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
render() {
|
|
54
|
+
if (!this.controller.state.visible) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
return vue.createVNode("div", {
|
|
58
|
+
"id": this.teleportTag,
|
|
59
|
+
"class": this.classArr,
|
|
60
|
+
"style": this.tempStyle
|
|
61
|
+
}, null);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
exports.TeleportPlaceholder = TeleportPlaceholder;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-teleport-placeholder{width:auto;height:auto}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('../panel-rawitem/index.cjs');
|
|
4
|
+
var panelRawitem_controller = require('../panel-rawitem/panel-rawitem.controller.cjs');
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
class TeleportPlaceholderProvider {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.component = "IBizTeleportPlaceholder";
|
|
10
|
+
}
|
|
11
|
+
async createController(panelItem, panel, parent) {
|
|
12
|
+
const c = new panelRawitem_controller.PanelRawItemController(panelItem, panel, parent);
|
|
13
|
+
await c.init();
|
|
14
|
+
return c;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.TeleportPlaceholderProvider = TeleportPlaceholderProvider;
|
package/lib/view/common/view.cjs
CHANGED
|
@@ -8,6 +8,9 @@ var namespace = require('../../use/namespace/namespace.cjs');
|
|
|
8
8
|
var useViewController = require('../../use/view/use-view-controller/use-view-controller.cjs');
|
|
9
9
|
|
|
10
10
|
"use strict";
|
|
11
|
+
function _isSlot(s) {
|
|
12
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
|
|
13
|
+
}
|
|
11
14
|
const View = /* @__PURE__ */ vue.defineComponent({
|
|
12
15
|
name: "IBizView",
|
|
13
16
|
props: {
|
|
@@ -30,10 +33,14 @@ const View = /* @__PURE__ */ vue.defineComponent({
|
|
|
30
33
|
type: Object
|
|
31
34
|
}
|
|
32
35
|
},
|
|
33
|
-
setup(
|
|
36
|
+
setup(_props, {
|
|
37
|
+
slots
|
|
38
|
+
}) {
|
|
34
39
|
const ns = namespace.useNamespace("view");
|
|
35
40
|
const c = useViewController.useViewController((...args) => new runtime.ViewController(...args));
|
|
36
|
-
const
|
|
41
|
+
const allControls = runtime.getControlsByView(c.model);
|
|
42
|
+
const teleportControls = allControls.filter((ctrl) => !!runtime.getCtrlTeleportTag(ctrl));
|
|
43
|
+
const controls = allControls.filter((ctrl) => !teleportControls.includes(ctrl));
|
|
37
44
|
const {
|
|
38
45
|
viewType,
|
|
39
46
|
sysCss,
|
|
@@ -57,59 +64,59 @@ const View = /* @__PURE__ */ vue.defineComponent({
|
|
|
57
64
|
}
|
|
58
65
|
return null;
|
|
59
66
|
};
|
|
67
|
+
const getCtrlProps = (ctrl) => {
|
|
68
|
+
const slotKey = ctrl.name || ctrl.id;
|
|
69
|
+
return {
|
|
70
|
+
context: c.context,
|
|
71
|
+
params: c.params,
|
|
72
|
+
...c.slotProps[slotKey] || {},
|
|
73
|
+
modelData: ctrl
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const renderControl = (ctrl) => {
|
|
77
|
+
const slotKey = ctrl.name || ctrl.id;
|
|
78
|
+
const ctrlProps = getCtrlProps(ctrl);
|
|
79
|
+
if (slots[slotKey]) {
|
|
80
|
+
return vue.renderSlot(slots, slotKey, ctrlProps);
|
|
81
|
+
}
|
|
82
|
+
const provider = c.providers[slotKey];
|
|
83
|
+
const comp = vue.resolveComponent((provider == null ? void 0 : provider.component) || "IBizControlShell");
|
|
84
|
+
if (provider) {
|
|
85
|
+
ctrlProps.provider = provider;
|
|
86
|
+
}
|
|
87
|
+
return vue.h(comp, ctrlProps);
|
|
88
|
+
};
|
|
60
89
|
return {
|
|
61
90
|
c,
|
|
62
91
|
controls,
|
|
92
|
+
teleportControls,
|
|
63
93
|
viewClassNames,
|
|
64
94
|
onLayoutPanelCreated,
|
|
65
|
-
renderViewMessage
|
|
95
|
+
renderViewMessage,
|
|
96
|
+
getCtrlProps,
|
|
97
|
+
renderControl
|
|
66
98
|
};
|
|
67
99
|
},
|
|
68
100
|
render() {
|
|
69
|
-
var _a;
|
|
101
|
+
var _a, _b;
|
|
70
102
|
let layoutPanel = null;
|
|
71
103
|
if (this.c.state.isCreated) {
|
|
72
|
-
const slots = {
|
|
73
|
-
...this.$slots
|
|
74
|
-
};
|
|
75
|
-
if ((_a = this.controls) == null ? void 0 : _a.length) {
|
|
76
|
-
this.controls.forEach((ctrl) => {
|
|
77
|
-
const slotKey = ctrl.name || ctrl.id;
|
|
78
|
-
const ctrlProps = {
|
|
79
|
-
context: this.c.context,
|
|
80
|
-
params: this.c.params
|
|
81
|
-
};
|
|
82
|
-
if (this.c.slotProps[slotKey]) {
|
|
83
|
-
Object.assign(ctrlProps, this.c.slotProps[slotKey]);
|
|
84
|
-
}
|
|
85
|
-
const outCtrlSlot = slots[slotKey];
|
|
86
|
-
if (outCtrlSlot) {
|
|
87
|
-
slots[slotKey] = () => {
|
|
88
|
-
return outCtrlSlot({
|
|
89
|
-
modelData: ctrl,
|
|
90
|
-
...ctrlProps
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const provider = this.c.providers[slotKey];
|
|
96
|
-
if (provider) {
|
|
97
|
-
slots[slotKey] = () => {
|
|
98
|
-
const comp = vue.resolveComponent(provider.component);
|
|
99
|
-
return vue.h(comp, {
|
|
100
|
-
modelData: ctrl,
|
|
101
|
-
...ctrlProps,
|
|
102
|
-
provider
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
104
|
if (this.c.engines.length === 0) {
|
|
109
105
|
layoutPanel = vue.createVNode("span", {
|
|
110
106
|
"style": "color:red;"
|
|
111
107
|
}, [vue.createTextVNode("\u89C6\u56FE\u7C7B\u578B"), this.modelData.viewType, vue.createTextVNode("\u6682\u672A\u652F\u6301")]);
|
|
112
108
|
} else {
|
|
109
|
+
const slots = {
|
|
110
|
+
...this.$slots
|
|
111
|
+
};
|
|
112
|
+
if ((_a = this.controls) == null ? void 0 : _a.length) {
|
|
113
|
+
this.controls.forEach((ctrl) => {
|
|
114
|
+
const slotKey = ctrl.name || ctrl.id;
|
|
115
|
+
slots[slotKey] = () => {
|
|
116
|
+
return this.renderControl(ctrl);
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
|
113
120
|
const viewLayoutPanel = this.c.model.viewLayoutPanel;
|
|
114
121
|
const provider = this.c.providers[viewLayoutPanel.name];
|
|
115
122
|
layoutPanel = vue.h(vue.resolveComponent(provider.component), {
|
|
@@ -122,10 +129,22 @@ const View = /* @__PURE__ */ vue.defineComponent({
|
|
|
122
129
|
}, slots);
|
|
123
130
|
}
|
|
124
131
|
}
|
|
132
|
+
let teleportContent = null;
|
|
133
|
+
if (this.c.state.isCreated && ((_b = this.teleportControls) == null ? void 0 : _b.length)) {
|
|
134
|
+
teleportContent = this.teleportControls.map((ctrl) => {
|
|
135
|
+
let _slot;
|
|
136
|
+
return vue.createVNode(vue.Teleport, {
|
|
137
|
+
"to": runtime.getCtrlTeleportTag(ctrl),
|
|
138
|
+
"disabled": !this.c.state.activated
|
|
139
|
+
}, _isSlot(_slot = this.renderControl(ctrl)) ? _slot : {
|
|
140
|
+
default: () => [_slot]
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
125
144
|
return vue.withDirectives(vue.createVNode("div", {
|
|
126
145
|
"class": this.viewClassNames,
|
|
127
146
|
"id": this.c.id
|
|
128
|
-
}, [this.renderViewMessage("TOP"), layoutPanel, this.renderViewMessage("BOTTOM")]), [[vue.resolveDirective("loading"), this.c.state.isLoading]]);
|
|
147
|
+
}, [this.renderViewMessage("TOP"), layoutPanel, this.renderViewMessage("BOTTOM"), teleportContent]), [[vue.resolveDirective("loading"), this.c.state.isLoading]]);
|
|
129
148
|
}
|
|
130
149
|
});
|
|
131
150
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/vue3-util",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"description": "vue3 工具包",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"dev": "ibiz-temp build -w",
|
|
25
|
-
"build": "ibiz-temp build -c && vue-tsc --declaration --emitDeclarationOnly",
|
|
25
|
+
"build": "npm run test:run && ibiz-temp build -c && vue-tsc --declaration --emitDeclarationOnly",
|
|
26
26
|
"lint": "vue-tsc --noEmit && eslint 'src/**/*.tsx' 'src/**/*.ts'",
|
|
27
27
|
"lint:fix": "vue-tsc --noEmit && eslint --fix 'src/**/*.tsx' 'src/**/*.ts'",
|
|
28
28
|
"clean": "rimraf es dist",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@ibiz-template/cli": "^0.3.10",
|
|
42
|
-
"@ibiz-template/core": "^0.6.
|
|
43
|
-
"@ibiz-template/runtime": "^0.6.
|
|
42
|
+
"@ibiz-template/core": "^0.6.15",
|
|
43
|
+
"@ibiz-template/runtime": "^0.6.15",
|
|
44
44
|
"@ibiz-template/theme": "^0.6.0",
|
|
45
|
-
"@ibiz/model-core": "^0.1.
|
|
45
|
+
"@ibiz/model-core": "^0.1.19",
|
|
46
46
|
"@types/path-browserify": "^1.0.2",
|
|
47
47
|
"@types/qs": "^6.9.11",
|
|
48
48
|
"@types/systemjs": "^6.13.5",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@ibiz-template/core": "^0.6.0",
|
|
61
61
|
"@ibiz-template/runtime": "^0.6.0",
|
|
62
|
-
"@ibiz/model-core": "^0.1.
|
|
62
|
+
"@ibiz/model-core": "^0.1.19",
|
|
63
63
|
"dayjs": "^1.11.10",
|
|
64
64
|
"path-browserify": "^1.0.1",
|
|
65
65
|
"pinia": "^2.1.7",
|