zova-jsx 1.1.26 → 1.1.27
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.js +5 -21
- package/dist/lib/zovaJsx.d.ts +1 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { celEnvBase, getProperty, evaluateExpressions, isEmptyObject, isNil, isP
|
|
|
3
3
|
import { toUpperCaseFirstChar } from '@cabloy/word-utils';
|
|
4
4
|
import { classes } from 'typestyle';
|
|
5
5
|
import { h, createTextVNode } from 'vue';
|
|
6
|
-
import { BeanSimple, objectAssignReactive, cast
|
|
6
|
+
import { BeanSimple, objectAssignReactive, cast } from 'zova-core';
|
|
7
7
|
|
|
8
8
|
const renderFieldJsxPropsSystem = ['children', 'v-slot', 'v-slot-scope', 'v-if', 'v-for', 'v-each', 'key'];
|
|
9
9
|
|
|
@@ -34,14 +34,12 @@ function normalizePropName(name) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
class ZovaJsx extends BeanSimple {
|
|
37
|
-
constructor(components,
|
|
37
|
+
constructor(components, celEnv) {
|
|
38
38
|
super();
|
|
39
39
|
this._components = void 0;
|
|
40
|
-
this._actions = void 0;
|
|
41
40
|
this._celEnv = void 0;
|
|
42
41
|
this._transientObject = void 0;
|
|
43
42
|
this._components = components;
|
|
44
|
-
this._actions = actions;
|
|
45
43
|
this._celEnv = this._prepareCelEnv(celEnv ?? celEnvBase);
|
|
46
44
|
}
|
|
47
45
|
_prepareCelEnv(celEnv) {
|
|
@@ -72,9 +70,6 @@ class ZovaJsx extends BeanSimple {
|
|
|
72
70
|
get components() {
|
|
73
71
|
return this._components;
|
|
74
72
|
}
|
|
75
|
-
get actions() {
|
|
76
|
-
return this._actions;
|
|
77
|
-
}
|
|
78
73
|
get celEnv() {
|
|
79
74
|
return this._celEnv;
|
|
80
75
|
}
|
|
@@ -169,14 +164,7 @@ class ZovaJsx extends BeanSimple {
|
|
|
169
164
|
const vIf = this.evaluateExpression(actionChild.props?.['v-if'], celScope);
|
|
170
165
|
if (vIf === false) return next(undefined);
|
|
171
166
|
// action
|
|
172
|
-
if (actionChild.type === '
|
|
173
|
-
const props = this.renderJsxProps(actionChild.props, {}, celScope, renderContext);
|
|
174
|
-
celScope[cast(props).name] = cast(props).value;
|
|
175
|
-
return next(undefined);
|
|
176
|
-
} else if (actionChild.type === 'actionExpr') {
|
|
177
|
-
const expression = this.evaluateExpression(cast(actionChild.props)?.expression, celScope);
|
|
178
|
-
return next(expression);
|
|
179
|
-
} else if (isJsxEvent(actionChild)) {
|
|
167
|
+
if (actionChild.type === 'ActionActions') {
|
|
180
168
|
// nested action
|
|
181
169
|
eventRes[index] = [];
|
|
182
170
|
return this.renderEventDirect(actionChild, objectAssignReactive({}, celScope), renderContext, eventRes[index], next);
|
|
@@ -188,8 +176,7 @@ class ZovaJsx extends BeanSimple {
|
|
|
188
176
|
}
|
|
189
177
|
_renderEventActionNormal(actionChild, celScope, renderContext, next) {
|
|
190
178
|
// action
|
|
191
|
-
const
|
|
192
|
-
const beanFullName = beanFullNameFromOnionName(actionName, 'action');
|
|
179
|
+
const beanFullName = actionChild.type;
|
|
193
180
|
const beanInstance = this.sys.bean._getBeanSyncOnly(beanFullName);
|
|
194
181
|
if (beanInstance) {
|
|
195
182
|
// sync
|
|
@@ -206,7 +193,7 @@ class ZovaJsx extends BeanSimple {
|
|
|
206
193
|
_renderEventActionNormal_inner(beanInstance, actionChild, celScope, renderContext, next) {
|
|
207
194
|
const onionOptions = beanInstance.$onionOptions;
|
|
208
195
|
// props
|
|
209
|
-
let props = this.renderJsxProps(actionChild.props, {}, celScope, renderContext);
|
|
196
|
+
let props = this.renderJsxProps(cast(actionChild.props).options, {}, celScope, renderContext);
|
|
210
197
|
if (!isEmptyObject(onionOptions)) {
|
|
211
198
|
// not use deepExtend, maybe: Maximum call stack size exceeded
|
|
212
199
|
props = Object.assign({}, onionOptions, props);
|
|
@@ -271,9 +258,6 @@ class ZovaJsx extends BeanSimple {
|
|
|
271
258
|
// div/QInput/Zova Component
|
|
272
259
|
return type;
|
|
273
260
|
}
|
|
274
|
-
normalizeAction(type) {
|
|
275
|
-
return this.actions?.[type] ?? type;
|
|
276
|
-
}
|
|
277
261
|
_renderJsxSingle(Component, componentJsx, props, celScope, renderContext) {
|
|
278
262
|
const _isZovaComponent = isZovaComponent(Component);
|
|
279
263
|
// key
|
package/dist/lib/zovaJsx.d.ts
CHANGED
|
@@ -5,16 +5,14 @@ import type { TypeRenderComponent, TypeRenderComponentJsx, TypeRenderComponentJs
|
|
|
5
5
|
type CelEnv = typeof celEnvBase;
|
|
6
6
|
export declare class ZovaJsx extends BeanSimple {
|
|
7
7
|
private _components;
|
|
8
|
-
private _actions;
|
|
9
8
|
private _celEnv;
|
|
10
9
|
private _transientObject;
|
|
11
|
-
constructor(components?: {},
|
|
10
|
+
constructor(components?: {}, celEnv?: CelEnv);
|
|
12
11
|
private _prepareCelEnv;
|
|
13
12
|
setTransientObject<T>(transientObject: {} | undefined, fnMethod: () => T): T;
|
|
14
13
|
get transientObject(): any;
|
|
15
14
|
get event(): Event | undefined;
|
|
16
15
|
get components(): {} | undefined;
|
|
17
|
-
get actions(): Record<string, string> | undefined;
|
|
18
16
|
get celEnv(): CelEnv;
|
|
19
17
|
evaluateExpression(expression: any, celScope?: {}): any;
|
|
20
18
|
renderJsxOrCel(componentJsx: TypeRenderComponent | any, props: {} | undefined, celScope?: {}, renderContext?: {}): any;
|
|
@@ -27,7 +25,6 @@ export declare class ZovaJsx extends BeanSimple {
|
|
|
27
25
|
render(componentJsx: TypeRenderComponent, propsInit: {} | undefined, celScope?: {}, renderContext?: {}): VNode | VNode[] | undefined;
|
|
28
26
|
normalizeComponenJsx(componentJsx: TypeRenderComponent, propsInit?: {}): TypeRenderComponentJsx;
|
|
29
27
|
normalizeComponent(type: TypeRenderComponent): TypeRenderComponent;
|
|
30
|
-
normalizeAction(type: string): string;
|
|
31
28
|
private _renderJsxSingle;
|
|
32
29
|
renderJsxProps(jsxProps: TypeRenderComponentJsxProps | undefined, props: {}, celScope?: {}, renderContext?: {}): {};
|
|
33
30
|
private _renderJsxChildrenCollect;
|
package/package.json
CHANGED