@variojs/vue 0.0.1 → 0.0.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/README.md +53 -848
- package/dist/bindings.d.ts +2 -1
- package/dist/bindings.d.ts.map +1 -1
- package/dist/bindings.js +1 -199
- package/dist/bindings.js.map +1 -1
- package/dist/composable.js +1 -386
- package/dist/features/attrs-builder.d.ts.map +1 -1
- package/dist/features/attrs-builder.js +1 -143
- package/dist/features/attrs-builder.js.map +1 -1
- package/dist/features/children-resolver.js +1 -171
- package/dist/features/component-resolver.js +1 -110
- package/dist/features/computed.js +1 -161
- package/dist/features/event-handler.js +1 -103
- package/dist/features/expression-evaluator.js +1 -28
- package/dist/features/lifecycle-wrapper.js +1 -102
- package/dist/features/loop-handler.js +1 -168
- package/dist/features/path-resolver.d.ts +4 -0
- package/dist/features/path-resolver.d.ts.map +1 -1
- package/dist/features/path-resolver.js +1 -171
- package/dist/features/path-resolver.js.map +1 -1
- package/dist/features/provide-inject.js +1 -139
- package/dist/features/refs.js +1 -113
- package/dist/features/teleport.js +1 -32
- package/dist/features/validators.js +1 -297
- package/dist/features/watch.js +1 -154
- package/dist/index.js +1 -24
- package/dist/renderer.js +1 -244
- package/dist/types.js +0 -16
- package/package.json +18 -5
|
@@ -1,103 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 事件处理模块
|
|
3
|
-
*
|
|
4
|
-
* 负责处理 Schema 中的事件绑定
|
|
5
|
-
*/
|
|
6
|
-
import { execute } from '@variojs/core';
|
|
7
|
-
/**
|
|
8
|
-
* 事件处理器
|
|
9
|
-
*/
|
|
10
|
-
export class EventHandler {
|
|
11
|
-
evaluateExpr;
|
|
12
|
-
eventHandlerCache = new WeakMap();
|
|
13
|
-
constructor(evaluateExpr) {
|
|
14
|
-
this.evaluateExpr = evaluateExpr;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* 将事件名转换为 Vue 事件处理器名
|
|
18
|
-
* click -> onClick, change -> onChange
|
|
19
|
-
*/
|
|
20
|
-
toEventName(event) {
|
|
21
|
-
return `on${event.charAt(0).toUpperCase()}${event.slice(1)}`;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 获取事件处理器(使用缓存)
|
|
25
|
-
*/
|
|
26
|
-
getEventHandlers(schema, ctx) {
|
|
27
|
-
// 检查是否在循环上下文中(有 $item 或 $index)
|
|
28
|
-
// 或者作用域插槽上下文中(有 scope 变量)
|
|
29
|
-
const isInLoop = '$item' in ctx || '$index' in ctx;
|
|
30
|
-
const isInScopedSlot = 'scope' in ctx;
|
|
31
|
-
// 循环上下文或作用域插槽中不使用缓存,因为每个项需要不同的上下文
|
|
32
|
-
if (!isInLoop && !isInScopedSlot) {
|
|
33
|
-
const cached = this.eventHandlerCache.get(schema);
|
|
34
|
-
if (cached) {
|
|
35
|
-
return cached;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const handlers = {};
|
|
39
|
-
if (schema.events) {
|
|
40
|
-
Object.entries(schema.events).forEach(([event, actions]) => {
|
|
41
|
-
const eventName = this.toEventName(event);
|
|
42
|
-
// 在循环或作用域插槽中,预处理 actions 中的 params,将表达式立即求值
|
|
43
|
-
// 这样事件触发时使用的是创建时的值,而不是触发时的值
|
|
44
|
-
const processedActions = (isInLoop || isInScopedSlot)
|
|
45
|
-
? this.preprocessActionsParams(actions, ctx)
|
|
46
|
-
: actions;
|
|
47
|
-
// 保存当前上下文引用,确保事件触发时使用正确的上下文
|
|
48
|
-
const eventCtx = ctx;
|
|
49
|
-
handlers[eventName] = (e) => {
|
|
50
|
-
eventCtx.$event = e;
|
|
51
|
-
this.executeInstructions(processedActions, eventCtx);
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
// 仅在非循环且非作用域插槽上下文中缓存
|
|
56
|
-
if (!isInLoop && !isInScopedSlot) {
|
|
57
|
-
this.eventHandlerCache.set(schema, handlers);
|
|
58
|
-
}
|
|
59
|
-
return handlers;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* 预处理 actions 中的 params,将表达式立即求值
|
|
63
|
-
* 用于循环中的事件处理,确保使用创建时的循环变量值
|
|
64
|
-
*/
|
|
65
|
-
preprocessActionsParams(actions, ctx) {
|
|
66
|
-
return actions.map(action => {
|
|
67
|
-
if (action.type === 'call' && action.params) {
|
|
68
|
-
const params = action.params;
|
|
69
|
-
const evaluatedParams = {};
|
|
70
|
-
for (const [key, value] of Object.entries(params)) {
|
|
71
|
-
if (typeof value === 'string' && value.startsWith('{{') && value.endsWith('}}')) {
|
|
72
|
-
// 立即求值表达式
|
|
73
|
-
try {
|
|
74
|
-
const expr = value.slice(2, -2).trim();
|
|
75
|
-
evaluatedParams[key] = this.evaluateExpr(expr, ctx);
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
console.warn(`Failed to evaluate param expression: ${value}`, error);
|
|
79
|
-
evaluatedParams[key] = value;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
evaluatedParams[key] = value;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return { ...action, params: evaluatedParams };
|
|
87
|
-
}
|
|
88
|
-
return action;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* 执行动作序列
|
|
93
|
-
*/
|
|
94
|
-
async executeInstructions(actions, ctx) {
|
|
95
|
-
try {
|
|
96
|
-
await execute(actions, ctx);
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=event-handler.js.map
|
|
1
|
+
import{execute as u}from"@variojs/core";class d{evaluateExpr;eventHandlerCache=new WeakMap;constructor(e){this.evaluateExpr=e}toEventName(e){return`on${e.charAt(0).toUpperCase()}${e.slice(1)}`}getEventHandlers(e,s){const t="$item"in s||"$index"in s,o="scope"in s;if(!t&&!o){const a=this.eventHandlerCache.get(e);if(a)return a}const n={};return e.events&&Object.entries(e.events).forEach(([a,r])=>{const c=this.toEventName(a),p=t||o?this.preprocessActionsParams(r,s):r,i=s;n[c]=l=>{i.$event=l,this.executeInstructions(p,i)}}),!t&&!o&&this.eventHandlerCache.set(e,n),n}preprocessActionsParams(e,s){return e.map(t=>{if(t.type==="call"&&t.params){const o=t.params,n={};for(const[a,r]of Object.entries(o))if(typeof r=="string"&&r.startsWith("{{")&&r.endsWith("}}"))try{const c=r.slice(2,-2).trim();n[a]=this.evaluateExpr(c,s)}catch(c){console.warn(`Failed to evaluate param expression: ${r}`,c),n[a]=r}else n[a]=r;return{...t,params:n}}return t})}async executeInstructions(e,s){try{await u(e,s)}catch(t){throw t}}}export{d as EventHandler};
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 表达式求值模块
|
|
3
|
-
*
|
|
4
|
-
* 负责求值 Schema 中的表达式
|
|
5
|
-
*/
|
|
6
|
-
import { evaluate, extractExpression } from '@variojs/core';
|
|
7
|
-
/**
|
|
8
|
-
* 表达式求值器
|
|
9
|
-
*/
|
|
10
|
-
export class ExpressionEvaluator {
|
|
11
|
-
/**
|
|
12
|
-
* 求值表达式
|
|
13
|
-
* 支持 {{ expression }} 格式,会自动去掉包装
|
|
14
|
-
* 使用 core 中的 extractExpression 工具函数
|
|
15
|
-
*/
|
|
16
|
-
evaluateExpr(expr, ctx) {
|
|
17
|
-
try {
|
|
18
|
-
// 使用 core 中的工具函数提取表达式
|
|
19
|
-
const finalExpr = extractExpression(expr);
|
|
20
|
-
const result = evaluate(finalExpr, ctx);
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=expression-evaluator.js.map
|
|
1
|
+
import{evaluate as a,extractExpression as s}from"@variojs/core";class l{evaluateExpr(e,t){try{const r=s(e);return a(r,t)}catch{return}}}export{l as ExpressionEvaluator};
|
|
@@ -1,102 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 生命周期包装模块
|
|
3
|
-
*
|
|
4
|
-
* 负责创建带生命周期钩子的 Vue 组件
|
|
5
|
-
*/
|
|
6
|
-
import { h, defineComponent, onMounted, onUnmounted, onUpdated, onBeforeMount, onBeforeUnmount, onBeforeUpdate } from 'vue';
|
|
7
|
-
import { setupProvideInject } from './provide-inject.js';
|
|
8
|
-
/**
|
|
9
|
-
* 生命周期包装器
|
|
10
|
-
*/
|
|
11
|
-
export class LifecycleWrapper {
|
|
12
|
-
/**
|
|
13
|
-
* 创建带生命周期钩子的组件
|
|
14
|
-
* 使用 defineComponent 包装,确保生命周期钩子在正确的上下文中执行
|
|
15
|
-
*/
|
|
16
|
-
createComponentWithLifecycle(component, attrs, children, schema, ctx) {
|
|
17
|
-
return h(defineComponent({
|
|
18
|
-
name: 'VarioLifecycleWrapper',
|
|
19
|
-
setup() {
|
|
20
|
-
// 从 ctx.$methods 中查找生命周期钩子方法
|
|
21
|
-
const methods = ctx.$methods || {};
|
|
22
|
-
// 处理 provide/inject(在 setup 中调用)
|
|
23
|
-
const injectedValues = setupProvideInject(schema, ctx);
|
|
24
|
-
// 合并 inject 的值到 attrs
|
|
25
|
-
const mergedAttrs = Object.keys(injectedValues).length > 0
|
|
26
|
-
? { ...attrs, ...injectedValues }
|
|
27
|
-
: attrs;
|
|
28
|
-
// 注册生命周期钩子(按 Vue 3 生命周期顺序)
|
|
29
|
-
// 从 ctx.$methods 中查找对应的方法并注册为生命周期钩子
|
|
30
|
-
if (schema.onBeforeMount) {
|
|
31
|
-
const methodName = schema.onBeforeMount;
|
|
32
|
-
const hook = methods[methodName];
|
|
33
|
-
if (hook && typeof hook === 'function') {
|
|
34
|
-
onBeforeMount(() => {
|
|
35
|
-
Promise.resolve(hook(ctx, undefined)).catch((err) => {
|
|
36
|
-
console.warn(`[Vario] Lifecycle hook "${methodName}" error:`, err);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (schema.onMounted) {
|
|
42
|
-
const methodName = schema.onMounted;
|
|
43
|
-
const hook = methods[methodName];
|
|
44
|
-
if (hook && typeof hook === 'function') {
|
|
45
|
-
onMounted(() => {
|
|
46
|
-
Promise.resolve(hook(ctx, undefined)).catch((err) => {
|
|
47
|
-
console.warn(`[Vario] Lifecycle hook "${methodName}" error:`, err);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (schema.onBeforeUpdate) {
|
|
53
|
-
const methodName = schema.onBeforeUpdate;
|
|
54
|
-
const hook = methods[methodName];
|
|
55
|
-
if (hook && typeof hook === 'function') {
|
|
56
|
-
onBeforeUpdate(() => {
|
|
57
|
-
Promise.resolve(hook(ctx, undefined)).catch((err) => {
|
|
58
|
-
console.warn(`[Vario] Lifecycle hook "${methodName}" error:`, err);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (schema.onUpdated) {
|
|
64
|
-
const methodName = schema.onUpdated;
|
|
65
|
-
const hook = methods[methodName];
|
|
66
|
-
if (hook && typeof hook === 'function') {
|
|
67
|
-
onUpdated(() => {
|
|
68
|
-
Promise.resolve(hook(ctx, undefined)).catch((err) => {
|
|
69
|
-
console.warn(`[Vario] Lifecycle hook "${methodName}" error:`, err);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (schema.onBeforeUnmount) {
|
|
75
|
-
const methodName = schema.onBeforeUnmount;
|
|
76
|
-
const hook = methods[methodName];
|
|
77
|
-
if (hook && typeof hook === 'function') {
|
|
78
|
-
onBeforeUnmount(() => {
|
|
79
|
-
Promise.resolve(hook(ctx, undefined)).catch((err) => {
|
|
80
|
-
console.warn(`[Vario] Lifecycle hook "${methodName}" error:`, err);
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (schema.onUnmounted) {
|
|
86
|
-
const methodName = schema.onUnmounted;
|
|
87
|
-
const hook = methods[methodName];
|
|
88
|
-
if (hook && typeof hook === 'function') {
|
|
89
|
-
onUnmounted(() => {
|
|
90
|
-
Promise.resolve(hook(ctx, undefined)).catch((err) => {
|
|
91
|
-
console.warn(`[Vario] Lifecycle hook "${methodName}" error:`, err);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// 返回渲染函数(使用合并后的 attrs)
|
|
97
|
-
return () => h(component, mergedAttrs, children);
|
|
98
|
-
}
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=lifecycle-wrapper.js.map
|
|
1
|
+
import{h as d,defineComponent as l,onMounted as p,onUnmounted as m,onUpdated as h,onBeforeMount as y,onBeforeUnmount as k,onBeforeUpdate as U}from"vue";import{setupProvideInject as B}from"./provide-inject.js";class P{createComponentWithLifecycle(s,f,u,n,t){return d(l({name:"VarioLifecycleWrapper",setup(){const i=t.$methods||{},c=B(n,t),a=Object.keys(c).length>0?{...f,...c}:f;if(n.onBeforeMount){const e=n.onBeforeMount,o=i[e];o&&typeof o=="function"&&y(()=>{Promise.resolve(o(t,void 0)).catch(r=>{console.warn(`[Vario] Lifecycle hook "${e}" error:`,r)})})}if(n.onMounted){const e=n.onMounted,o=i[e];o&&typeof o=="function"&&p(()=>{Promise.resolve(o(t,void 0)).catch(r=>{console.warn(`[Vario] Lifecycle hook "${e}" error:`,r)})})}if(n.onBeforeUpdate){const e=n.onBeforeUpdate,o=i[e];o&&typeof o=="function"&&U(()=>{Promise.resolve(o(t,void 0)).catch(r=>{console.warn(`[Vario] Lifecycle hook "${e}" error:`,r)})})}if(n.onUpdated){const e=n.onUpdated,o=i[e];o&&typeof o=="function"&&h(()=>{Promise.resolve(o(t,void 0)).catch(r=>{console.warn(`[Vario] Lifecycle hook "${e}" error:`,r)})})}if(n.onBeforeUnmount){const e=n.onBeforeUnmount,o=i[e];o&&typeof o=="function"&&k(()=>{Promise.resolve(o(t,void 0)).catch(r=>{console.warn(`[Vario] Lifecycle hook "${e}" error:`,r)})})}if(n.onUnmounted){const e=n.onUnmounted,o=i[e];o&&typeof o=="function"&&m(()=>{Promise.resolve(o(t,void 0)).catch(r=>{console.warn(`[Vario] Lifecycle hook "${e}" error:`,r)})})}return()=>d(s,a,u)}}))}}export{P as LifecycleWrapper};
|
|
@@ -1,168 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 循环处理模块
|
|
3
|
-
*
|
|
4
|
-
* 负责处理 Schema 中的循环渲染
|
|
5
|
-
*/
|
|
6
|
-
import { h, Fragment } from 'vue';
|
|
7
|
-
import { createLoopContext } from '@variojs/core';
|
|
8
|
-
/**
|
|
9
|
-
* 循环处理器
|
|
10
|
-
*/
|
|
11
|
-
export class LoopHandler {
|
|
12
|
-
pathResolver;
|
|
13
|
-
createVNode;
|
|
14
|
-
evaluateExpr;
|
|
15
|
-
constructor(pathResolver, createVNode, evaluateExpr) {
|
|
16
|
-
this.pathResolver = pathResolver;
|
|
17
|
-
this.createVNode = createVNode;
|
|
18
|
-
this.evaluateExpr = evaluateExpr;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 创建循环渲染的 VNode
|
|
22
|
-
*/
|
|
23
|
-
createLoopVNode(schema, ctx, modelPathStack = []) {
|
|
24
|
-
const { loop } = schema;
|
|
25
|
-
if (!loop) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
// 解析循环数据源路径
|
|
29
|
-
const itemsPath = this.pathResolver.extractModelPath(loop.items);
|
|
30
|
-
// 解析循环数据源(错误处理)
|
|
31
|
-
let items;
|
|
32
|
-
try {
|
|
33
|
-
const evaluated = this.evaluateExpr(itemsPath, ctx);
|
|
34
|
-
if (!Array.isArray(evaluated)) {
|
|
35
|
-
// 非数组,返回错误提示
|
|
36
|
-
return h('div', {
|
|
37
|
-
style: 'color: red; padding: 10px;'
|
|
38
|
-
}, `Loop items must be an array, got: ${typeof evaluated}`);
|
|
39
|
-
}
|
|
40
|
-
items = evaluated;
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
44
|
-
return h('div', {
|
|
45
|
-
style: 'color: red; padding: 10px;'
|
|
46
|
-
}, `Loop items evaluation error: ${errorMessage}`);
|
|
47
|
-
}
|
|
48
|
-
if (items.length === 0) {
|
|
49
|
-
// 空数组,返回 null
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
// 处理循环节点自身的 model 属性(如 model: 'users' 或 model: { path: 'users', scope: true })
|
|
53
|
-
let basePathStack = [...modelPathStack];
|
|
54
|
-
const scopePath = this.pathResolver.getScopePath(schema.model);
|
|
55
|
-
if (scopePath) {
|
|
56
|
-
basePathStack = this.pathResolver.updateModelPathStack(scopePath, modelPathStack, ctx, schema);
|
|
57
|
-
}
|
|
58
|
-
// 创建循环子节点(优化:稳定的key生成)
|
|
59
|
-
const children = items
|
|
60
|
-
.map((item, index) => {
|
|
61
|
-
try {
|
|
62
|
-
// 创建循环上下文(使用 Object.create 保持原型链,继承 _get/_set 等方法)
|
|
63
|
-
const loopCtx = createLoopContext(ctx, item, index);
|
|
64
|
-
// 设置 itemKey 对应的变量名
|
|
65
|
-
loopCtx[loop.itemKey] = item;
|
|
66
|
-
// 添加indexKey(如果指定)
|
|
67
|
-
if (loop.indexKey) {
|
|
68
|
-
loopCtx[loop.indexKey] = index;
|
|
69
|
-
}
|
|
70
|
-
// 创建子节点(排除 loop 和已处理的 model 属性,避免递归和重复处理)
|
|
71
|
-
const childSchema = { ...schema };
|
|
72
|
-
delete childSchema.loop;
|
|
73
|
-
// 若 model 的 path 与 loop.items 相同,子节点不再带 model,避免重复压栈
|
|
74
|
-
const modelPathVal = this.pathResolver.getModelPath(schema.model);
|
|
75
|
-
if (modelPathVal) {
|
|
76
|
-
const extracted = this.pathResolver.extractModelPath(modelPathVal);
|
|
77
|
-
if (extracted === itemsPath) {
|
|
78
|
-
delete childSchema.model;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
// 递归设置 __loopItems 到所有子节点,确保 model 绑定可以正确解析
|
|
82
|
-
this.markLoopSchema(childSchema, loop.items);
|
|
83
|
-
// 循环中的路径栈处理:
|
|
84
|
-
// 将循环索引加入路径栈,子级的扁平路径会拼接到这个路径上
|
|
85
|
-
// 例如:basePathStack = ['users'], index = 0
|
|
86
|
-
// loopPathStack = ['users', 0]
|
|
87
|
-
// 子级 model: 'name' → 'users.0.name'
|
|
88
|
-
const loopPathStack = [...basePathStack, index];
|
|
89
|
-
const vnode = this.createVNode(childSchema, loopCtx, loopPathStack);
|
|
90
|
-
// 生成稳定的key(基于itemKey或index)
|
|
91
|
-
if (vnode && typeof vnode === 'object' && 'key' in vnode) {
|
|
92
|
-
const keyValue = this.getLoopItemKey(item, loop.itemKey, index);
|
|
93
|
-
vnode.key = keyValue;
|
|
94
|
-
}
|
|
95
|
-
return vnode;
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
// 单个项渲染错误,返回错误节点
|
|
99
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
100
|
-
console.warn(`Loop item render error at index ${index}:`, errorMessage);
|
|
101
|
-
return h('div', {
|
|
102
|
-
key: `error-${index}`,
|
|
103
|
-
style: 'color: red; padding: 5px;'
|
|
104
|
-
}, `Render error: ${errorMessage}`);
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
.filter((vnode) => vnode !== null && vnode !== undefined);
|
|
108
|
-
// 如果所有子节点都无效,返回 null
|
|
109
|
-
if (children.length === 0) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
// 使用 Fragment 包裹循环节点
|
|
113
|
-
return h(Fragment, null, children);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* 递归标记 schema 及其所有子节点的 __loopItems
|
|
117
|
-
* 确保嵌套子节点中的 model 绑定也能正确解析循环变量
|
|
118
|
-
*/
|
|
119
|
-
markLoopSchema(schema, loopItems) {
|
|
120
|
-
// 设置当前节点
|
|
121
|
-
schema.__loopItems = loopItems;
|
|
122
|
-
// 递归处理 children
|
|
123
|
-
if (schema.children) {
|
|
124
|
-
if (Array.isArray(schema.children)) {
|
|
125
|
-
schema.children.forEach(child => {
|
|
126
|
-
// 检查是否是 SchemaNode(有 type 属性的对象,但不是数组)
|
|
127
|
-
if (child && typeof child === 'object' && !Array.isArray(child) && 'type' in child) {
|
|
128
|
-
this.markLoopSchema(child, loopItems);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
else if (typeof schema.children === 'object' && !Array.isArray(schema.children) && 'type' in schema.children) {
|
|
133
|
-
this.markLoopSchema(schema.children, loopItems);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* 获取循环项的稳定key
|
|
139
|
-
*
|
|
140
|
-
* 策略:
|
|
141
|
-
* 1. 如果item是对象且有itemKey指定的属性,使用该属性值
|
|
142
|
-
* 2. 如果item有id属性,使用id
|
|
143
|
-
* 3. 否则使用index(不理想,但作为后备)
|
|
144
|
-
*/
|
|
145
|
-
getLoopItemKey(item, itemKey, index) {
|
|
146
|
-
// 尝试从item中获取key值
|
|
147
|
-
if (item && typeof item === 'object') {
|
|
148
|
-
// 优先使用itemKey指定的属性
|
|
149
|
-
if (itemKey in item && item[itemKey] != null) {
|
|
150
|
-
const keyValue = item[itemKey];
|
|
151
|
-
// 确保key是字符串或数字
|
|
152
|
-
if (typeof keyValue === 'string' || typeof keyValue === 'number') {
|
|
153
|
-
return keyValue;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// 后备:使用id属性
|
|
157
|
-
if ('id' in item && item.id != null) {
|
|
158
|
-
const idValue = item.id;
|
|
159
|
-
if (typeof idValue === 'string' || typeof idValue === 'number') {
|
|
160
|
-
return idValue;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
// 最后使用index(不理想,但作为后备)
|
|
165
|
-
return index;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
//# sourceMappingURL=loop-handler.js.map
|
|
1
|
+
import{h as p,Fragment as L}from"vue";import{createLoopContext as k}from"@variojs/core";class P{pathResolver;createVNode;evaluateExpr;constructor(e,o,n){this.pathResolver=e,this.createVNode=o,this.evaluateExpr=n}createLoopVNode(e,o,n=[]){const{loop:r}=e;if(!r)return null;const d=this.pathResolver.extractModelPath(r.items);let c;try{const t=this.evaluateExpr(d,o);if(!Array.isArray(t))return p("div",{style:"color: red; padding: 10px;"},`Loop items must be an array, got: ${typeof t}`);c=t}catch(t){const a=t instanceof Error?t.message:String(t);return p("div",{style:"color: red; padding: 10px;"},`Loop items evaluation error: ${a}`)}if(c.length===0)return null;let h=[...n];const f=this.pathResolver.getScopePath(e.model);f&&(h=this.pathResolver.updateModelPathStack(f,n,o,e));const y=c.map((t,a)=>{try{const i=k(o,t,a);i[r.itemKey]=t,r.indexKey&&(i[r.indexKey]=a);const l={...e};delete l.loop;const u=this.pathResolver.getModelPath(e.model);u&&this.pathResolver.extractModelPath(u)===d&&delete l.model,this.markLoopSchema(l,r.items);const v=[...h,a],s=this.createVNode(l,i,v);if(s&&typeof s=="object"&&"key"in s){const g=this.getLoopItemKey(t,r.itemKey,a);s.key=g}return s}catch(i){const l=i instanceof Error?i.message:String(i);return console.warn(`Loop item render error at index ${a}:`,l),p("div",{key:`error-${a}`,style:"color: red; padding: 5px;"},`Render error: ${l}`)}}).filter(t=>t!=null);return y.length===0?null:p(L,null,y)}markLoopSchema(e,o){e.__loopItems=o,e.children&&(Array.isArray(e.children)?e.children.forEach(n=>{n&&typeof n=="object"&&!Array.isArray(n)&&"type"in n&&this.markLoopSchema(n,o)}):typeof e.children=="object"&&!Array.isArray(e.children)&&"type"in e.children&&this.markLoopSchema(e.children,o))}getLoopItemKey(e,o,n){if(e&&typeof e=="object"){if(o in e&&e[o]!=null){const r=e[o];if(typeof r=="string"||typeof r=="number")return r}if("id"in e&&e.id!=null){const r=e.id;if(typeof r=="string"||typeof r=="number")return r}}return n}}export{P as LoopHandler};
|
|
@@ -20,6 +20,10 @@ export declare class ModelPathResolver {
|
|
|
20
20
|
* 返回应压栈的路径:string 返回 path;object 且 scope 时返回 path;否则 undefined
|
|
21
21
|
*/
|
|
22
22
|
getScopePath(model: unknown): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* 从 model(string | { path, scope?, default? })中取出默认值,仅对象形式且含 default 时有值
|
|
25
|
+
*/
|
|
26
|
+
getModelDefault(model: unknown): unknown;
|
|
23
27
|
/**
|
|
24
28
|
* 更新 model 路径栈
|
|
25
29
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-resolver.d.ts","sourceRoot":"","sources":["../../src/features/path-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3D;;GAEG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,KAAK,GAAG;IAE5E;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAShD;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAOhD;;;;;OAKG;IACH,oBAAoB,CAClB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,WAAW,EAAE,WAAW,EAAE,EAC1B,GAAG,EAAE,cAAc,EAC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ACjB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,cAAc,EACnB,cAAc,GAAE,WAAW,EAAO,GACjC,MAAM;IAiET;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM;CAGhD"}
|
|
@@ -1,171 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Model 路径解析模块
|
|
3
|
-
*
|
|
4
|
-
* 负责处理 model 路径的解析、拼接和转换
|
|
5
|
-
*/
|
|
6
|
-
import { parsePath } from '@variojs/core';
|
|
7
|
-
/**
|
|
8
|
-
* Model 路径解析器
|
|
9
|
-
*/
|
|
10
|
-
export class ModelPathResolver {
|
|
11
|
-
evaluateExpr;
|
|
12
|
-
constructor(evaluateExpr) {
|
|
13
|
-
this.evaluateExpr = evaluateExpr;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* 从 model(string | { path, scope? })中取出路径字符串
|
|
17
|
-
*/
|
|
18
|
-
getModelPath(model) {
|
|
19
|
-
if (model == null)
|
|
20
|
-
return undefined;
|
|
21
|
-
if (typeof model === 'string')
|
|
22
|
-
return model;
|
|
23
|
-
if (typeof model === 'object' && model !== null && typeof model.path === 'string') {
|
|
24
|
-
return model.path;
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* 返回应压栈的路径:string 返回 path;object 且 scope 时返回 path;否则 undefined
|
|
30
|
-
*/
|
|
31
|
-
getScopePath(model) {
|
|
32
|
-
const path = this.getModelPath(model);
|
|
33
|
-
if (!path)
|
|
34
|
-
return undefined;
|
|
35
|
-
if (typeof model === 'string')
|
|
36
|
-
return path;
|
|
37
|
-
return model.scope ? path : undefined;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* 更新 model 路径栈
|
|
41
|
-
*
|
|
42
|
-
* 根据当前节点的 model 属性更新路径栈,供子级使用。
|
|
43
|
-
* 支持 [] 语法明确数组访问。
|
|
44
|
-
*/
|
|
45
|
-
updateModelPathStack(modelPath, parentStack, ctx, schema) {
|
|
46
|
-
if (!modelPath) {
|
|
47
|
-
return [...parentStack];
|
|
48
|
-
}
|
|
49
|
-
// 提取路径(去除 {{ }})
|
|
50
|
-
const rawPath = this.extractModelPath(modelPath);
|
|
51
|
-
// 解析路径段(支持 [] 语法)
|
|
52
|
-
const segments = parsePath(rawPath);
|
|
53
|
-
if (segments.length === 0) {
|
|
54
|
-
return [...parentStack];
|
|
55
|
-
}
|
|
56
|
-
// 判断是否为单段路径(扁平路径)
|
|
57
|
-
const isFlatPath = segments.length === 1 && typeof segments[0] === 'string';
|
|
58
|
-
if (isFlatPath) {
|
|
59
|
-
// 扁平路径:拼接到父级路径栈
|
|
60
|
-
return [...parentStack, segments[0]];
|
|
61
|
-
}
|
|
62
|
-
// 多段路径(明确路径)
|
|
63
|
-
// 检查是否在循环上下文中引用了循环变量
|
|
64
|
-
const firstSegment = segments[0];
|
|
65
|
-
if (ctx.$index !== undefined && typeof firstSegment === 'string') {
|
|
66
|
-
// 检查是否是循环变量($item 或 itemKey)
|
|
67
|
-
if (firstSegment === '$item' || (firstSegment in ctx && ctx[firstSegment] === ctx.$item)) {
|
|
68
|
-
// 获取循环的 items 路径
|
|
69
|
-
const loopItems = schema.__loopItems;
|
|
70
|
-
if (loopItems) {
|
|
71
|
-
const itemsPath = this.extractModelPath(loopItems);
|
|
72
|
-
const itemsSegments = parsePath(itemsPath);
|
|
73
|
-
const restSegments = segments.slice(1); // 移除 item/$item
|
|
74
|
-
// 构建完整路径:itemsPath + 索引 + 剩余路径
|
|
75
|
-
return [...itemsSegments, ctx.$index, ...restSegments];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// 处理动态索引(-1 表示需要在循环上下文中填充)
|
|
80
|
-
const resolvedSegments = segments.map(seg => {
|
|
81
|
-
if (seg === -1 && ctx.$index !== undefined) {
|
|
82
|
-
return ctx.$index;
|
|
83
|
-
}
|
|
84
|
-
return seg;
|
|
85
|
-
});
|
|
86
|
-
// 明确路径:作为新的路径栈基础
|
|
87
|
-
return resolvedSegments;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* 提取 model 路径(去除 {{ }} 包裹)
|
|
91
|
-
*/
|
|
92
|
-
extractModelPath(modelPath) {
|
|
93
|
-
if (typeof modelPath !== 'string') {
|
|
94
|
-
return String(modelPath);
|
|
95
|
-
}
|
|
96
|
-
return modelPath.includes('{{')
|
|
97
|
-
? modelPath.replace(/^\{\{\s*|\s*\}\}$/g, '').trim()
|
|
98
|
-
: modelPath;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* 解析 model 路径为最终的状态路径
|
|
102
|
-
*
|
|
103
|
-
* 支持:
|
|
104
|
-
* - 当前栈路径:`model: "."` 且路径栈非空时 → 返回栈对应路径(用于循环中绑定 items[0]、items[1] 等数组元素本身)
|
|
105
|
-
* - 扁平路径:`name` → 拼接路径栈 → `form.user.name`
|
|
106
|
-
* - 明确路径:`form.user.name` → 直接使用
|
|
107
|
-
* - 数组访问:`users[0].name` → 解析为 `users.0.name`
|
|
108
|
-
* - 循环变量:`item.name` → 解析为 `items.0.name`
|
|
109
|
-
*/
|
|
110
|
-
resolveModelPath(modelPath, schema, ctx, modelPathStack = []) {
|
|
111
|
-
if (typeof modelPath !== 'string') {
|
|
112
|
-
return String(modelPath);
|
|
113
|
-
}
|
|
114
|
-
// 提取路径
|
|
115
|
-
const rawPath = this.extractModelPath(modelPath);
|
|
116
|
-
// 如果是表达式,先求值
|
|
117
|
-
if (modelPath.includes('{{')) {
|
|
118
|
-
const evaluated = this.evaluateExpr(rawPath, ctx);
|
|
119
|
-
if (typeof evaluated === 'string' && evaluated !== rawPath) {
|
|
120
|
-
// 递归处理求值后的路径
|
|
121
|
-
return this.resolveModelPath(evaluated, schema, ctx, modelPathStack);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// model 为 "." 表示绑定到「当前路径栈」对应路径(循环中即当前项 items[i],数组元素本身)
|
|
125
|
-
if ((rawPath === '.' || rawPath === '') && modelPathStack.length > 0) {
|
|
126
|
-
return this.segmentsToPath(modelPathStack);
|
|
127
|
-
}
|
|
128
|
-
// 解析路径段
|
|
129
|
-
const segments = parsePath(rawPath);
|
|
130
|
-
if (segments.length === 0) {
|
|
131
|
-
return rawPath;
|
|
132
|
-
}
|
|
133
|
-
// 处理循环上下文中的变量引用
|
|
134
|
-
const firstSegment = segments[0];
|
|
135
|
-
if (ctx.$index !== undefined && typeof firstSegment === 'string') {
|
|
136
|
-
// 检查是否是循环变量
|
|
137
|
-
if (firstSegment === '$item' || (firstSegment in ctx && ctx[firstSegment] === ctx.$item)) {
|
|
138
|
-
const loopItems = schema.__loopItems;
|
|
139
|
-
if (loopItems) {
|
|
140
|
-
const itemsPath = this.extractModelPath(loopItems);
|
|
141
|
-
const itemsSegments = parsePath(itemsPath);
|
|
142
|
-
const restSegments = segments.slice(1);
|
|
143
|
-
const fullSegments = [...itemsSegments, ctx.$index, ...restSegments];
|
|
144
|
-
return this.segmentsToPath(fullSegments);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
// 判断是否为扁平路径(单段且为字符串)
|
|
149
|
-
const isFlatPath = segments.length === 1 && typeof segments[0] === 'string';
|
|
150
|
-
if (isFlatPath && modelPathStack.length > 0) {
|
|
151
|
-
// 扁平路径:拼接路径栈
|
|
152
|
-
const fullSegments = [...modelPathStack, segments[0]];
|
|
153
|
-
return this.segmentsToPath(fullSegments);
|
|
154
|
-
}
|
|
155
|
-
// 处理动态索引
|
|
156
|
-
const resolvedSegments = segments.map(seg => {
|
|
157
|
-
if (seg === -1 && ctx.$index !== undefined) {
|
|
158
|
-
return ctx.$index;
|
|
159
|
-
}
|
|
160
|
-
return seg;
|
|
161
|
-
});
|
|
162
|
-
return this.segmentsToPath(resolvedSegments);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* 将路径段数组转换为路径字符串
|
|
166
|
-
*/
|
|
167
|
-
segmentsToPath(segments) {
|
|
168
|
-
return segments.map(String).join('.');
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
//# sourceMappingURL=path-resolver.js.map
|
|
1
|
+
import{parsePath as g}from"@variojs/core";class m{evaluateExpr;constructor(t){this.evaluateExpr=t}getModelPath(t){if(t!=null){if(typeof t=="string")return t;if(typeof t=="object"&&t!==null&&typeof t.path=="string")return t.path}}getScopePath(t){const r=this.getModelPath(t);if(r)return typeof t=="string"||t.scope?r:void 0}getModelDefault(t){if(!(t==null||typeof t!="object"))return t.default}updateModelPathStack(t,r,e,o){if(!t)return[...r];const i=this.extractModelPath(t),s=g(i);if(s.length===0)return[...r];if(s.length===1&&typeof s[0]=="string")return[...r,s[0]];const u=s[0];if(e.$index!==void 0&&typeof u=="string"&&(u==="$item"||u in e&&e[u]===e.$item)){const n=o.__loopItems;if(n){const a=this.extractModelPath(n),h=g(a),l=s.slice(1);return[...h,e.$index,...l]}}return s.map(n=>n===-1&&e.$index!==void 0?e.$index:n)}extractModelPath(t){return typeof t!="string"?String(t):t.includes("{{")?t.replace(/^\{\{\s*|\s*\}\}$/g,"").trim():t}resolveModelPath(t,r,e,o=[]){if(typeof t!="string")return String(t);const i=this.extractModelPath(t);if(t.includes("{{")){const n=this.evaluateExpr(i,e);if(typeof n=="string"&&n!==i)return this.resolveModelPath(n,r,e,o)}if((i==="."||i==="")&&o.length>0)return this.segmentsToPath(o);const s=g(i);if(s.length===0)return i;const f=s[0];if(e.$index!==void 0&&typeof f=="string"&&(f==="$item"||f in e&&e[f]===e.$item)){const n=r.__loopItems;if(n){const a=this.extractModelPath(n),h=g(a),l=s.slice(1),d=[...h,e.$index,...l];return this.segmentsToPath(d)}}if(s.length===1&&typeof s[0]=="string"&&o.length>0){const n=[...o,s[0]];return this.segmentsToPath(n)}const p=s.map(n=>n===-1&&e.$index!==void 0?e.$index:n);return this.segmentsToPath(p)}segmentsToPath(t){return t.map(String).join(".")}}export{m as ModelP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