@ibiz-template/vue3-util 0.0.3-beta.4 → 0.0.3-beta.6
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/system/index.system.js +1 -1
- package/out/interface/util/route/route.d.ts +28 -14
- package/out/interface/util/route/route.d.ts.map +1 -1
- package/out/props/editor/date-range.d.ts +51 -0
- package/out/props/editor/date-range.d.ts.map +1 -0
- package/out/props/editor/date-range.js +21 -0
- package/out/props/editor/index.d.ts +2 -0
- package/out/props/editor/index.d.ts.map +1 -1
- package/out/props/editor/index.js +2 -0
- package/out/props/editor/number-range.d.ts +51 -0
- package/out/props/editor/number-range.d.ts.map +1 -0
- package/out/props/editor/number-range.js +21 -0
- package/out/props/editor/text-box.d.ts +53 -0
- package/out/props/editor/text-box.d.ts.map +1 -1
- package/out/props/editor/text-box.js +24 -0
- package/out/use/route/route.d.ts +0 -9
- package/out/use/route/route.d.ts.map +1 -1
- package/out/use/route/route.js +0 -25
- package/out/use/widget/index.d.ts +1 -1
- package/out/use/widget/index.d.ts.map +1 -1
- package/out/use/widget/index.js +1 -1
- package/out/use/widget/use-panel-controller/use-panel-controller.d.ts +14 -0
- package/out/use/widget/use-panel-controller/use-panel-controller.d.ts.map +1 -0
- package/out/use/widget/{use-layout-panel-controller/use-layout-panel-controller.js → use-panel-controller/use-panel-controller.js} +6 -6
- package/out/util/index.d.ts +1 -0
- package/out/util/index.d.ts.map +1 -1
- package/out/util/index.js +1 -0
- package/out/util/render-provider/render-ctrl-provider.d.ts +14 -0
- package/out/util/render-provider/render-ctrl-provider.d.ts.map +1 -0
- package/out/util/render-provider/render-ctrl-provider.js +24 -0
- package/out/util/route/route.d.ts +11 -2
- package/out/util/route/route.d.ts.map +1 -1
- package/out/util/route/route.js +117 -54
- package/package.json +6 -6
- package/src/interface/util/route/route.ts +31 -15
- package/src/props/editor/date-range.ts +24 -0
- package/src/props/editor/index.ts +2 -0
- package/src/props/editor/number-range.ts +24 -0
- package/src/props/editor/text-box.ts +26 -0
- package/src/use/route/route.ts +0 -28
- package/src/use/widget/index.ts +1 -1
- package/src/use/widget/{use-layout-panel-controller/use-layout-panel-controller.ts → use-panel-controller/use-panel-controller.ts} +10 -10
- package/src/util/index.ts +1 -0
- package/src/util/render-provider/render-ctrl-provider.ts +31 -0
- package/src/util/route/route.ts +126 -60
- package/out/use/widget/use-layout-panel-controller/use-layout-panel-controller.d.ts +0 -14
- package/out/use/widget/use-layout-panel-controller/use-layout-panel-controller.d.ts.map +0 -1
package/out/util/route/route.js
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
import { notNilEmpty } from 'qx-util';
|
|
1
|
+
import { isNilOrEmpty, notNilEmpty } from 'qx-util';
|
|
2
2
|
import { RuntimeError } from '@ibiz-template/core';
|
|
3
3
|
import qs from 'qs';
|
|
4
4
|
import { calcRouteContext } from '@ibiz-template/runtime';
|
|
5
|
+
/**
|
|
6
|
+
* 获取自身的路由上下文,排除了部分不需要路由携带的参数
|
|
7
|
+
*
|
|
8
|
+
* @author lxm
|
|
9
|
+
* @date 2023-03-14 02:07:41
|
|
10
|
+
* @export
|
|
11
|
+
* @param {IContext} context
|
|
12
|
+
* @returns {*} {IParams}
|
|
13
|
+
*/
|
|
14
|
+
export function getOwnRouteContext(context) {
|
|
15
|
+
const ownContext = context.getOwnContext();
|
|
16
|
+
const excludeKeys = ['srfsessionid'];
|
|
17
|
+
Object.keys(ownContext).forEach(key => {
|
|
18
|
+
if (excludeKeys.includes(key)) {
|
|
19
|
+
delete ownContext[key];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return ownContext;
|
|
23
|
+
}
|
|
5
24
|
/**
|
|
6
25
|
* 生成route路径
|
|
7
26
|
*
|
|
@@ -15,23 +34,27 @@ import { calcRouteContext } from '@ibiz-template/runtime';
|
|
|
15
34
|
* @returns {*} {string}
|
|
16
35
|
*/
|
|
17
36
|
export function generateRoutePath(appView, route, context, params) {
|
|
18
|
-
var _a;
|
|
37
|
+
var _a, _b;
|
|
19
38
|
const routePath = route2routePath(route);
|
|
20
39
|
// 如果上下文存在toRouteLevel时,使用上下文的层级,否则是第二级路由
|
|
21
40
|
let level = 2;
|
|
22
|
-
if (context
|
|
41
|
+
if (context.toRouteLevel) {
|
|
23
42
|
level = context.toRouteLevel;
|
|
24
43
|
// 使用完后删除,避免添加到首页上下文里
|
|
25
44
|
delete context.toRouteLevel;
|
|
26
45
|
}
|
|
27
46
|
// 删除目标层级和之后的路由,保留之前层级的路由
|
|
28
47
|
routePath.pathNodes.splice(level - 1, routePath.pathNodes.length - level + 1);
|
|
29
|
-
//
|
|
30
|
-
if (context
|
|
31
|
-
routePath.pathNodes[
|
|
48
|
+
// 导航视图的导航参数,加在目标层级之前的一个层级的视图参数里
|
|
49
|
+
if (context.currentSrfNav) {
|
|
50
|
+
const currentNode = routePath.pathNodes[routePath.pathNodes.length - 1];
|
|
51
|
+
currentNode.params = currentNode.params || {};
|
|
52
|
+
currentNode.params.srfnav = context.currentSrfNav;
|
|
53
|
+
// 使用完后删除,避免添加到首页上下文里
|
|
54
|
+
delete context.currentSrfNav;
|
|
32
55
|
}
|
|
33
56
|
// 重定向视图跳转的一级首页路由
|
|
34
|
-
if (routePath.pathNodes[0].viewName === 'appredirectview') {
|
|
57
|
+
if (((_a = routePath.pathNodes[0]) === null || _a === void 0 ? void 0 : _a.viewName) === 'appredirectview') {
|
|
35
58
|
if (params === null || params === void 0 ? void 0 : params.srfindexname) {
|
|
36
59
|
routePath.pathNodes[0].viewName = params.srfindexname;
|
|
37
60
|
delete params.srfindexname;
|
|
@@ -41,20 +64,34 @@ export function generateRoutePath(appView, route, context, params) {
|
|
|
41
64
|
}
|
|
42
65
|
}
|
|
43
66
|
// 计算目标视图path路径
|
|
44
|
-
routePath.pathNodes.push({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
67
|
+
routePath.pathNodes.push({
|
|
68
|
+
viewName: appView.codeName.toLowerCase(),
|
|
69
|
+
context: getOwnRouteContext(context),
|
|
70
|
+
params,
|
|
71
|
+
});
|
|
72
|
+
// 计算二级视图的资源路径加到index后面
|
|
73
|
+
const codeName = (_b = appView.getPSAppDataEntity()) === null || _b === void 0 ? void 0 : _b.codeName;
|
|
74
|
+
if (level === 2 && codeName) {
|
|
48
75
|
const app = ibiz.hub.getApp(appView.getPSModelService().app);
|
|
49
76
|
const paths = app.resourcePathUtil.calcPaths(codeName);
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
77
|
+
const resContext = calcRouteContext(context, paths);
|
|
78
|
+
if (!isNilOrEmpty(resContext)) {
|
|
79
|
+
// 资源路径不为空,二级视图的上下文删掉多余的资源上下文
|
|
80
|
+
routePath.pathNodes[0].context = resContext;
|
|
81
|
+
Object.keys(resContext).forEach(key => {
|
|
82
|
+
const currentNode = routePath.pathNodes[level - 1];
|
|
83
|
+
if (currentNode.context &&
|
|
84
|
+
Object.prototype.hasOwnProperty.call(currentNode.context, key)) {
|
|
85
|
+
delete currentNode.context[key];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
routePath.pathNodes[0].context = undefined;
|
|
91
|
+
}
|
|
55
92
|
}
|
|
56
93
|
// 视图参数通过query传递
|
|
57
|
-
return { path: routePath2string(routePath)
|
|
94
|
+
return { path: routePath2string(routePath) };
|
|
58
95
|
}
|
|
59
96
|
/**
|
|
60
97
|
* 获取视图模型的codeName(小写)
|
|
@@ -145,7 +182,7 @@ export function parseRouteViewData(appModel, route, level) {
|
|
|
145
182
|
}
|
|
146
183
|
const modelPath = viewModel.modelPath;
|
|
147
184
|
const { viewType } = viewModel.refM;
|
|
148
|
-
//
|
|
185
|
+
// !解析上下文参数,整合当前层级之前所有的上下文参数
|
|
149
186
|
const context = {};
|
|
150
187
|
// 合并appData里的应用上下文
|
|
151
188
|
if ((_a = ibiz.appData) === null || _a === void 0 ? void 0 : _a.context) {
|
|
@@ -156,26 +193,21 @@ export function parseRouteViewData(appModel, route, level) {
|
|
|
156
193
|
if (routePath.appContext) {
|
|
157
194
|
Object.assign(context, routePath.appContext);
|
|
158
195
|
}
|
|
159
|
-
//
|
|
196
|
+
// 逐层合并视图上下文
|
|
160
197
|
for (let index = 0; index < level; index++) {
|
|
161
198
|
const pathNode = routePath.pathNodes[index];
|
|
162
199
|
if (notNilEmpty(pathNode.context)) {
|
|
163
|
-
|
|
164
|
-
// 首页的context是对象直接合并
|
|
165
|
-
Object.assign(context, pathNode.context);
|
|
166
|
-
}
|
|
200
|
+
Object.assign(context, pathNode.context);
|
|
167
201
|
}
|
|
168
202
|
}
|
|
169
203
|
// 最后一级路由对应的视图才会解析视图参数
|
|
170
|
-
|
|
171
|
-
if (route.matched.length === level) {
|
|
172
|
-
params = route.query;
|
|
173
|
-
}
|
|
204
|
+
const { params, srfnav } = routePath.pathNodes[level - 1];
|
|
174
205
|
return {
|
|
175
206
|
viewPath: modelPath,
|
|
176
207
|
viewType,
|
|
177
208
|
context,
|
|
178
209
|
params,
|
|
210
|
+
srfnav,
|
|
179
211
|
};
|
|
180
212
|
}
|
|
181
213
|
/**
|
|
@@ -194,31 +226,55 @@ export function route2routePath(route) {
|
|
|
194
226
|
const pathNodes = [];
|
|
195
227
|
for (let index = 1; index <= level; index++) {
|
|
196
228
|
const viewName = route.params[`view${index}`];
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
229
|
+
const paramsStr = route.params[`params${index}`];
|
|
230
|
+
/** 路由参数,默认是视图参数 */
|
|
231
|
+
let params;
|
|
232
|
+
/** 上下文参数 */
|
|
233
|
+
let context;
|
|
234
|
+
let srfnav;
|
|
235
|
+
// params为占位符时置空
|
|
236
|
+
if (!paramsStr || paramsStr === ibiz.env.routePlaceholder) {
|
|
237
|
+
params = undefined;
|
|
201
238
|
}
|
|
202
|
-
else
|
|
239
|
+
else {
|
|
203
240
|
// 首页上下文要解析
|
|
204
|
-
|
|
241
|
+
params = qs.parse(paramsStr, {
|
|
242
|
+
strictNullHandling: true,
|
|
243
|
+
delimiter: ';',
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
// 路由参数存在的时候,解析里面的上下文。
|
|
247
|
+
if (params) {
|
|
248
|
+
if (index === 1) {
|
|
249
|
+
// 首页的时候,路由上的参数是资源路径,属于上下文
|
|
250
|
+
context = params;
|
|
251
|
+
params = undefined;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
if (params.srfnavctx) {
|
|
255
|
+
// 解析额外上下文
|
|
256
|
+
context = JSON.parse(decodeURIComponent(params.srfnavctx));
|
|
257
|
+
delete params.srfnavctx;
|
|
258
|
+
}
|
|
259
|
+
if (params.srfnav) {
|
|
260
|
+
// 解析额外自身视图导航参数
|
|
261
|
+
srfnav = params.srfnav;
|
|
262
|
+
delete params.srfnav;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
205
265
|
}
|
|
206
|
-
pathNodes.push({ viewName, context });
|
|
266
|
+
pathNodes.push({ viewName, context, params, srfnav });
|
|
207
267
|
}
|
|
208
268
|
// 解析应用上下文
|
|
209
269
|
let appContext;
|
|
210
270
|
if (route.params.appContext &&
|
|
211
271
|
route.params.appContext !== ibiz.env.routePlaceholder) {
|
|
212
272
|
appContext = qs.parse(route.params.appContext, {
|
|
273
|
+
strictNullHandling: true,
|
|
213
274
|
delimiter: ';',
|
|
214
275
|
});
|
|
215
276
|
}
|
|
216
|
-
|
|
217
|
-
let params;
|
|
218
|
-
if (route.query) {
|
|
219
|
-
params = Object.assign({}, route.query);
|
|
220
|
-
}
|
|
221
|
-
return { appContext, pathNodes, params };
|
|
277
|
+
return { appContext, pathNodes };
|
|
222
278
|
}
|
|
223
279
|
/**
|
|
224
280
|
* 路由路径对象转路径字符串
|
|
@@ -233,33 +289,40 @@ export function routePath2string(routePath) {
|
|
|
233
289
|
let pathStr = '';
|
|
234
290
|
// 应用上下文
|
|
235
291
|
if (routePath.appContext) {
|
|
236
|
-
pathStr += `/${qs.stringify(routePath.appContext, {
|
|
292
|
+
pathStr += `/${qs.stringify(routePath.appContext, {
|
|
293
|
+
delimiter: ';',
|
|
294
|
+
strictNullHandling: true,
|
|
295
|
+
})}`;
|
|
237
296
|
}
|
|
238
297
|
else {
|
|
239
298
|
pathStr += `/${ibiz.env.routePlaceholder}`;
|
|
240
299
|
}
|
|
241
300
|
// 每一层级的视图
|
|
242
301
|
routePath.pathNodes.forEach((pathNode, index) => {
|
|
243
|
-
pathStr += `/${pathNode.viewName}
|
|
302
|
+
pathStr += `/${pathNode.viewName}/`;
|
|
303
|
+
let routeParams;
|
|
244
304
|
// 首页路由
|
|
245
305
|
if (index === 0) {
|
|
246
|
-
if (notNilEmpty(pathNode.context)
|
|
247
|
-
Object.values(pathNode.context).length) {
|
|
306
|
+
if (notNilEmpty(pathNode.context)) {
|
|
248
307
|
// 对象转成a=11;b=222的格式,字符串直接附加在后面
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
pathStr += `/${ibiz.env.routePlaceholder}`;
|
|
308
|
+
routeParams = pathNode.context;
|
|
253
309
|
}
|
|
254
310
|
}
|
|
255
311
|
else {
|
|
256
|
-
//
|
|
257
|
-
|
|
312
|
+
// 非首页路由,视图参数直接放到路由参数上,上下文转换后放到路由参数的srfnavctx上
|
|
313
|
+
routeParams = notNilEmpty(pathNode.params) ? pathNode.params : {};
|
|
314
|
+
if (notNilEmpty(pathNode.context)) {
|
|
315
|
+
const objStr = JSON.stringify(pathNode.context);
|
|
316
|
+
// undefined 的vlaue会被JSON.stringify删除,可能会转成{}
|
|
317
|
+
if (objStr !== '{}') {
|
|
318
|
+
routeParams.srfnavctx = encodeURIComponent(objStr);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
258
321
|
}
|
|
322
|
+
// 把路由参数转换到路由路径上去
|
|
323
|
+
pathStr +=
|
|
324
|
+
qs.stringify(routeParams, { delimiter: ';', strictNullHandling: true }) ||
|
|
325
|
+
ibiz.env.routePlaceholder;
|
|
259
326
|
});
|
|
260
|
-
// 附加视图参数
|
|
261
|
-
if (notNilEmpty(routePath.params)) {
|
|
262
|
-
pathStr += qs.stringify(routePath.params, { addQueryPrefix: true });
|
|
263
|
-
}
|
|
264
327
|
return pathStr;
|
|
265
328
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/vue3-util",
|
|
3
|
-
"version": "0.0.3-beta.
|
|
3
|
+
"version": "0.0.3-beta.6",
|
|
4
4
|
"description": "vue3 工具包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"author": "chitanda",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ibiz-template/core": "^0.0.3-beta.
|
|
33
|
-
"@ibiz-template/model": "^0.0.3-beta.
|
|
34
|
-
"@ibiz-template/runtime": "^0.0.3-beta.
|
|
32
|
+
"@ibiz-template/core": "^0.0.3-beta.5",
|
|
33
|
+
"@ibiz-template/model": "^0.0.3-beta.6",
|
|
34
|
+
"@ibiz-template/runtime": "^0.0.3-beta.6",
|
|
35
35
|
"@types/qs": "^6.9.7",
|
|
36
|
-
"qs": "^6.11.
|
|
36
|
+
"qs": "^6.11.1",
|
|
37
37
|
"qx-util": "^0.4.8",
|
|
38
38
|
"ramda": "^0.28.0",
|
|
39
39
|
"vue": "^3.2.47",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"vue": "^3.2.45",
|
|
50
50
|
"vue-router": "^4.1.6"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "e21743071367b8b7c96734436f6ef8a1755ffae6"
|
|
53
53
|
}
|
|
@@ -30,9 +30,9 @@ export interface IRouteViewData {
|
|
|
30
30
|
*
|
|
31
31
|
* @author lxm
|
|
32
32
|
* @date 2022-08-17 23:08:15
|
|
33
|
-
* @type {
|
|
33
|
+
* @type {IParams}
|
|
34
34
|
*/
|
|
35
|
-
context?:
|
|
35
|
+
context?: IParams;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
*视图参数
|
|
@@ -42,6 +42,14 @@ export interface IRouteViewData {
|
|
|
42
42
|
* @type {IParams}
|
|
43
43
|
*/
|
|
44
44
|
params?: IParams;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 视图导航参数
|
|
48
|
+
* @author lxm
|
|
49
|
+
* @date 2023-03-14 08:41:50
|
|
50
|
+
* @type {string}
|
|
51
|
+
*/
|
|
52
|
+
srfnav?: string;
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
/**
|
|
@@ -67,9 +75,26 @@ export interface IRoutePathNode {
|
|
|
67
75
|
*
|
|
68
76
|
* @author lxm
|
|
69
77
|
* @date 2022-08-18 11:08:53
|
|
70
|
-
* @type {
|
|
78
|
+
* @type {IParams}
|
|
79
|
+
*/
|
|
80
|
+
context?: IParams;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 视图参数对象
|
|
84
|
+
*
|
|
85
|
+
* @author lxm
|
|
86
|
+
* @date 2022-08-18 11:08:25
|
|
87
|
+
* @type {IParams}
|
|
71
88
|
*/
|
|
72
|
-
|
|
89
|
+
params?: IParams;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 视图导航参数(视图自身解析的额外路由参数)
|
|
93
|
+
* @author lxm
|
|
94
|
+
* @date 2023-03-14 08:39:36
|
|
95
|
+
* @type {string}
|
|
96
|
+
*/
|
|
97
|
+
srfnav?: string;
|
|
73
98
|
}
|
|
74
99
|
|
|
75
100
|
/**
|
|
@@ -84,10 +109,10 @@ export interface IRoutePath {
|
|
|
84
109
|
/**
|
|
85
110
|
* 应用上下文
|
|
86
111
|
*
|
|
87
|
-
* @type {
|
|
112
|
+
* @type {IParams}
|
|
88
113
|
* @memberof IRoutePath
|
|
89
114
|
*/
|
|
90
|
-
appContext?:
|
|
115
|
+
appContext?: IParams;
|
|
91
116
|
|
|
92
117
|
/**
|
|
93
118
|
*
|
|
@@ -96,13 +121,4 @@ export interface IRoutePath {
|
|
|
96
121
|
* @type {IRoutePathNode[]}
|
|
97
122
|
*/
|
|
98
123
|
pathNodes: IRoutePathNode[];
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 视图参数对象
|
|
102
|
-
*
|
|
103
|
-
* @author lxm
|
|
104
|
-
* @date 2022-08-18 11:08:25
|
|
105
|
-
* @type {IParams}
|
|
106
|
-
*/
|
|
107
|
-
params?: IParams;
|
|
108
124
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DateRangeEditorController } from '@ibiz-template/runtime';
|
|
2
|
+
import { getEditorProps, getGridEditorCommonProps } from './common';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 获取时间范围的props
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @template C
|
|
9
|
+
* @returns {*}
|
|
10
|
+
*/
|
|
11
|
+
export function getDateRangeProps<C = DateRangeEditorController>() {
|
|
12
|
+
return { ...getEditorProps<C>(), value: [String, Number] };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 获取表格时间范围的props
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @template C
|
|
20
|
+
* @returns {*}
|
|
21
|
+
*/
|
|
22
|
+
export function getGridDateRangeProps<C = DateRangeEditorController>() {
|
|
23
|
+
return { ...getDateRangeProps<C>(), ...getGridEditorCommonProps() };
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NumberRangeEditorController } from '@ibiz-template/runtime';
|
|
2
|
+
import { getEditorProps, getGridEditorCommonProps } from './common';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 获取数值范围的props
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @template C
|
|
9
|
+
* @returns {*}
|
|
10
|
+
*/
|
|
11
|
+
export function getNumberRangeProps<C = NumberRangeEditorController>() {
|
|
12
|
+
return { ...getEditorProps<C>(), value: [String, Number] };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 获取表格数值范围的props
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @template C
|
|
20
|
+
* @returns {*}
|
|
21
|
+
*/
|
|
22
|
+
export function getGridNumberRangeProps<C = NumberRangeEditorController>() {
|
|
23
|
+
return { ...getNumberRangeProps<C>(), ...getGridEditorCommonProps() };
|
|
24
|
+
}
|
|
@@ -52,3 +52,29 @@ export function getInputNumberProps<C = TextBoxEditorController>() {
|
|
|
52
52
|
export function getGridInputNumberProps<C = TextBoxEditorController>() {
|
|
53
53
|
return { ...getInputNumberProps<C>(), ...getGridEditorCommonProps() };
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 获取ip框的props
|
|
58
|
+
*
|
|
59
|
+
* @author lxm
|
|
60
|
+
* @date 2022-11-01 19:11:12
|
|
61
|
+
* @export
|
|
62
|
+
* @template C
|
|
63
|
+
* @returns {*}
|
|
64
|
+
*/
|
|
65
|
+
export function getInputIpProps<C = TextBoxEditorController>() {
|
|
66
|
+
return { ...getEditorProps<C>(), value: String };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 获取表格ip框的props
|
|
71
|
+
*
|
|
72
|
+
* @author lxm
|
|
73
|
+
* @date 2022-11-01 19:11:12
|
|
74
|
+
* @export
|
|
75
|
+
* @template C
|
|
76
|
+
* @returns {*}
|
|
77
|
+
*/
|
|
78
|
+
export function getGridInputIpProps<C = TextBoxEditorController>() {
|
|
79
|
+
return { ...getInputIpProps<C>(), ...getGridEditorCommonProps() };
|
|
80
|
+
}
|
package/src/use/route/route.ts
CHANGED
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
import { RouteLocationNormalizedLoaded, useRoute } from 'vue-router';
|
|
2
|
-
import qs from 'qs';
|
|
3
2
|
import { ref, Ref, watch } from 'vue';
|
|
4
3
|
import { RouteListener } from '../../util';
|
|
5
4
|
|
|
6
|
-
/**
|
|
7
|
-
* 获取路由上下文参数
|
|
8
|
-
*
|
|
9
|
-
* @author chitanda
|
|
10
|
-
* @date 2022-08-15 15:08:52
|
|
11
|
-
* @export
|
|
12
|
-
* @return {*} {IContext}
|
|
13
|
-
*/
|
|
14
|
-
export function useRouterContext(): IContext {
|
|
15
|
-
const route = useRoute();
|
|
16
|
-
const { params } = route;
|
|
17
|
-
const contextParams = {};
|
|
18
|
-
if (params) {
|
|
19
|
-
const keys = Object.keys(params);
|
|
20
|
-
const reg = /[^/]+=[^/]+/;
|
|
21
|
-
keys.forEach(key => {
|
|
22
|
-
const val = params[key] as string;
|
|
23
|
-
if (val && reg.test(val)) {
|
|
24
|
-
Object.assign(contextParams, {
|
|
25
|
-
...qs.parse(val, { delimiter: ';' }),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return contextParams;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
5
|
/**
|
|
34
6
|
* 获取路由查询参数
|
|
35
7
|
*
|
package/src/use/widget/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { usePickupViewPanelController } from './use-pickup-view-panel-controller
|
|
|
9
9
|
export { useDashboardController } from './use-dashboard-controller/use-dashboard-controller';
|
|
10
10
|
export { useTreeController } from './use-tree-controller/use-tree-controller';
|
|
11
11
|
export { useDataViewController } from './use-dataview-controller/use-dataview-controller';
|
|
12
|
-
export {
|
|
12
|
+
export { usePanelController } from './use-panel-controller/use-panel-controller';
|
|
13
13
|
export { useViewLayoutPanelController } from './use-view-layout-panel-controller/use-view-layout-panel-controller';
|
|
14
14
|
export { useWizardPanelController } from './use-wizard-panel-controller/use-wizard-panel-controller';
|
|
15
15
|
export { useKanbanController } from './use-kanban-controller/use-kanban-controller';
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PanelController } from '@ibiz-template/runtime';
|
|
2
2
|
import { IBizContext } from '@ibiz-template/core';
|
|
3
|
-
import {
|
|
3
|
+
import { PanelModel } from '@ibiz-template/model';
|
|
4
4
|
import { useControlController } from '../use-control-controller/use-control-controller';
|
|
5
5
|
import { usePropsWatch } from '../../vue/vue';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* 获取面板部件控制器
|
|
9
9
|
*
|
|
10
10
|
* @export
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {PanelModel} model
|
|
12
12
|
* @param {IBizContext} context
|
|
13
13
|
* @param {IParams} [params={}]
|
|
14
|
-
* @returns {*} {
|
|
14
|
+
* @returns {*} {PanelController}
|
|
15
15
|
*/
|
|
16
|
-
export function
|
|
17
|
-
model:
|
|
16
|
+
export function usePanelController(
|
|
17
|
+
model: PanelModel,
|
|
18
18
|
context: IBizContext,
|
|
19
19
|
params: IParams = {},
|
|
20
|
-
):
|
|
21
|
-
return useControlController<
|
|
22
|
-
const c = new
|
|
20
|
+
): PanelController {
|
|
21
|
+
return useControlController<PanelController>(() => {
|
|
22
|
+
const c = new PanelController(model, context, params);
|
|
23
23
|
// 监听prop,并响应式更新到controller
|
|
24
24
|
usePropsWatch('inputData', c.setInputData.bind(c));
|
|
25
25
|
return c;
|
package/src/util/index.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { ViewController } from '@ibiz-template/runtime';
|
|
3
|
+
import { h, resolveComponent, VNode } from 'vue';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 返回绘制视图里的部件的适配器的render函数
|
|
7
|
+
* @author lxm
|
|
8
|
+
* @date 2023-03-21 08:19:24
|
|
9
|
+
* @export
|
|
10
|
+
* @param {ViewController} controller
|
|
11
|
+
* @param {string} providerName
|
|
12
|
+
* @param {IParams} props
|
|
13
|
+
* @return {*} {((...args: any[]) => VNode | null)}
|
|
14
|
+
*/
|
|
15
|
+
export function renderCtrlProvider(
|
|
16
|
+
controller: ViewController,
|
|
17
|
+
providerName: string,
|
|
18
|
+
props: IParams,
|
|
19
|
+
): (...args: any[]) => VNode | null {
|
|
20
|
+
return (..._args: any[]) => {
|
|
21
|
+
if (!controller.state.complete) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const provider = controller.providers[providerName];
|
|
25
|
+
if (!provider) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const component = resolveComponent(provider.component);
|
|
29
|
+
return h(component, { ...props });
|
|
30
|
+
};
|
|
31
|
+
}
|