@cloudbase/cals 0.3.22-alpha.1 → 0.3.22
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/lib/parser/cals/index.d.ts +67 -17
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +87 -123
- package/lib/parser/cals/utils/block/index.js +2 -2
- package/lib/parser/cals/utils/runtime.d.ts +1 -4
- package/lib/parser/cals/utils/runtime.d.ts.map +1 -1
- package/lib/parser/cals/utils/runtime.js +0 -7
- package/lib/parser/expression/index.d.ts +1 -8
- package/lib/parser/expression/index.d.ts.map +1 -1
- package/lib/parser/expression/index.js +1 -6
- package/lib/schema/platform_application.json +2177 -0
- package/lib/tests/common-application-specs.test.d.ts +2 -0
- package/lib/tests/common-application-specs.test.d.ts.map +1 -0
- package/lib/tests/common-application-specs.test.js +45 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/platform/component.d.ts +21 -6
- package/lib/types/platform/component.d.ts.map +1 -1
- package/lib/types/platform/datasource.d.ts +20 -1
- package/lib/types/platform/datasource.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -30,47 +30,51 @@ interface ISerializeContext {
|
|
|
30
30
|
export declare function serializeValue({ ctx, key, dynamicValue, scope, streamlineDefaultValue, }: {
|
|
31
31
|
ctx: ISerializeContext;
|
|
32
32
|
key: string;
|
|
33
|
-
dynamicValue:
|
|
33
|
+
dynamicValue: {
|
|
34
|
+
type?: PropBindType | 'static';
|
|
35
|
+
value: any;
|
|
36
|
+
};
|
|
34
37
|
scope?: 'page' | 'component';
|
|
35
38
|
streamlineDefaultValue?: boolean;
|
|
36
39
|
}): {
|
|
37
40
|
key: string;
|
|
38
41
|
value: any;
|
|
39
|
-
extra?: any;
|
|
40
42
|
};
|
|
41
|
-
export declare function deserializeValue(ctx: IDeserializeContext, key: string, value: any
|
|
43
|
+
export declare function deserializeValue(ctx: IDeserializeContext, key: string, value: any): {
|
|
42
44
|
key: string;
|
|
43
45
|
value: {
|
|
44
46
|
type: PropBindType;
|
|
45
47
|
value: any;
|
|
46
|
-
extra: any;
|
|
47
48
|
};
|
|
48
49
|
};
|
|
49
|
-
|
|
50
|
+
export declare function serializeDynamicMap({ ctx, map, scope, streamlineDefaultValue, }: {
|
|
50
51
|
ctx: ISerializeContext;
|
|
51
52
|
map: {
|
|
52
|
-
[key: string]:
|
|
53
|
+
[key: string]: string | any;
|
|
53
54
|
};
|
|
54
55
|
scope?: 'page' | 'component';
|
|
55
56
|
streamlineDefaultValue?: boolean;
|
|
56
|
-
}
|
|
57
|
-
export declare function serializeDynamicMap(props: ISerializeDynamicMapProps): {
|
|
57
|
+
}): {
|
|
58
58
|
[key: string]: string;
|
|
59
59
|
};
|
|
60
60
|
export declare function deserializeDynamicMap(ctx: IDeserializeContext, map: {
|
|
61
61
|
[key: string]: string | any;
|
|
62
|
-
}, extraMap?: {
|
|
63
|
-
[key: string]: any;
|
|
64
62
|
}): {
|
|
65
|
-
[key: string]:
|
|
63
|
+
[key: string]: {
|
|
64
|
+
type?: string;
|
|
65
|
+
value: any;
|
|
66
|
+
};
|
|
66
67
|
};
|
|
67
68
|
export declare function serializeAttributes(ctx: ISerializeContext, scope: 'page' | 'component', attributes?: {
|
|
68
69
|
[key: string]: IDynamicValue;
|
|
69
70
|
}): {
|
|
70
71
|
[key: string]: string;
|
|
71
72
|
};
|
|
72
|
-
export declare function deserializeAttributes(ctx: IDeserializeContext, attributes?: IAttributes
|
|
73
|
-
[key: string]:
|
|
73
|
+
export declare function deserializeAttributes(ctx: IDeserializeContext, attributes?: IAttributes): {
|
|
74
|
+
[key: string]: {
|
|
75
|
+
type?: string;
|
|
76
|
+
value: any;
|
|
77
|
+
};
|
|
74
78
|
};
|
|
75
79
|
export declare function deserializeDataVariables(ctx: IDeserializeContext, data: IDataSourceVariable): {
|
|
76
80
|
title: string;
|
|
@@ -138,11 +142,31 @@ export declare function deserializePage(ctx: {
|
|
|
138
142
|
}[];
|
|
139
143
|
};
|
|
140
144
|
data: {
|
|
141
|
-
[key: string]:
|
|
145
|
+
[key: string]: {
|
|
146
|
+
type?: string;
|
|
147
|
+
value: any;
|
|
148
|
+
};
|
|
142
149
|
};
|
|
143
150
|
componentInstances: {
|
|
144
151
|
[key: string]: object;
|
|
145
152
|
};
|
|
153
|
+
pluginInstances: {
|
|
154
|
+
data: {
|
|
155
|
+
[key: string]: any;
|
|
156
|
+
};
|
|
157
|
+
dataBinds?: {
|
|
158
|
+
propertyPath: string;
|
|
159
|
+
bindDataPath: string;
|
|
160
|
+
type?: any;
|
|
161
|
+
}[];
|
|
162
|
+
dataTypes?: {
|
|
163
|
+
propertyPath: string;
|
|
164
|
+
type?: "static" | "slot" | "bind";
|
|
165
|
+
}[];
|
|
166
|
+
key: string;
|
|
167
|
+
sourceKey: string;
|
|
168
|
+
instanceFunction?: string;
|
|
169
|
+
};
|
|
146
170
|
commonStyle: object;
|
|
147
171
|
staticResourceAttribute: string[];
|
|
148
172
|
hideAdminPortalMenu: boolean;
|
|
@@ -162,7 +186,10 @@ export declare function deserializePage(ctx: {
|
|
|
162
186
|
moduleName: string;
|
|
163
187
|
};
|
|
164
188
|
data: {
|
|
165
|
-
[key: string]:
|
|
189
|
+
[key: string]: {
|
|
190
|
+
type?: string;
|
|
191
|
+
value: any;
|
|
192
|
+
};
|
|
166
193
|
};
|
|
167
194
|
isCapturePhase: boolean;
|
|
168
195
|
noPropagation: boolean;
|
|
@@ -208,11 +235,31 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
208
235
|
}[];
|
|
209
236
|
};
|
|
210
237
|
data: {
|
|
211
|
-
[key: string]:
|
|
238
|
+
[key: string]: {
|
|
239
|
+
type?: string;
|
|
240
|
+
value: any;
|
|
241
|
+
};
|
|
212
242
|
};
|
|
213
243
|
componentInstances: {
|
|
214
244
|
[key: string]: object;
|
|
215
245
|
};
|
|
246
|
+
pluginInstances: {
|
|
247
|
+
data: {
|
|
248
|
+
[key: string]: any;
|
|
249
|
+
};
|
|
250
|
+
dataBinds?: {
|
|
251
|
+
propertyPath: string;
|
|
252
|
+
bindDataPath: string;
|
|
253
|
+
type?: any;
|
|
254
|
+
}[];
|
|
255
|
+
dataTypes?: {
|
|
256
|
+
propertyPath: string;
|
|
257
|
+
type?: "static" | "slot" | "bind";
|
|
258
|
+
}[];
|
|
259
|
+
key: string;
|
|
260
|
+
sourceKey: string;
|
|
261
|
+
instanceFunction?: string;
|
|
262
|
+
};
|
|
216
263
|
commonStyle: object;
|
|
217
264
|
staticResourceAttribute: string[];
|
|
218
265
|
hideAdminPortalMenu: boolean;
|
|
@@ -232,7 +279,10 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
232
279
|
moduleName: string;
|
|
233
280
|
};
|
|
234
281
|
data: {
|
|
235
|
-
[key: string]:
|
|
282
|
+
[key: string]: {
|
|
283
|
+
type?: string;
|
|
284
|
+
value: any;
|
|
285
|
+
};
|
|
236
286
|
};
|
|
237
287
|
isCapturePhase: boolean;
|
|
238
288
|
noPropagation: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../parser/cals/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EACL,MAAM,aAAa,CAAA;AAEpB,OAAO,EAGL,aAAa,EACb,YAAY,EACb,MAAM,eAAe,CAAA;AAuBtB,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,YAAY,CAAA;IAClB,YAAY,CAAC,EAAE,GAAG,EAAE,CAAA;IACpB,eAAe,CAAC,EAAE,GAAG,CAAA;IACrB,IAAI,CAAC,EAAE,cAAc,CAAA;CACtB;AAED,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsEF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,IAAI,CACP,iBAAiB,EACjB,KAAK,GAAG,cAAc,GAAG,wBAAwB,CAClD,EACD,IAAI,EAAE,GAAG,GACR,cAAc,CAiEhB;AAWD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,iBAAiB,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;CAC1C,EACD,SAAS,EAAE,GAAG,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9B,eAAe,GAAG,iBAAiB,CA0GrC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG,CAwBzE;AAaD,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACxC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAA;KAAE,CAAA;IAC9C,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;KAAE,CAAA;CACzC;;;;;;;mBAUY,MAAM;mBACN,MAAM;sBACH,MAAM;;;6BACwB,OAAO;;;wBACnC,MAAM;;;EA8BvB"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -33,14 +33,14 @@ function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefa
|
|
|
33
33
|
case expression_1.PropBindType.computed:
|
|
34
34
|
case expression_1.PropBindType.dataVar:
|
|
35
35
|
case expression_1.PropBindType.stateData:
|
|
36
|
-
case expression_1.PropBindType.
|
|
36
|
+
case expression_1.PropBindType.paramData: {
|
|
37
37
|
const TYPE_MAP = {
|
|
38
38
|
[expression_1.PropBindType.prop]: 'props',
|
|
39
39
|
[expression_1.PropBindType.state]: 'state',
|
|
40
40
|
[expression_1.PropBindType.computed]: 'computed',
|
|
41
41
|
[expression_1.PropBindType.dataVar]: 'dataVar',
|
|
42
42
|
[expression_1.PropBindType.stateData]: 'dataset.state',
|
|
43
|
-
[expression_1.PropBindType.
|
|
43
|
+
[expression_1.PropBindType.paramData]: 'dataset.params',
|
|
44
44
|
};
|
|
45
45
|
let exp = dynamicValue.value;
|
|
46
46
|
let reg = /^(.*?)\./;
|
|
@@ -85,13 +85,12 @@ function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefa
|
|
|
85
85
|
value = undefined;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
return { key, value
|
|
88
|
+
return { key, value };
|
|
89
89
|
}
|
|
90
90
|
exports.serializeValue = serializeValue;
|
|
91
|
-
|
|
92
|
-
function deserializeValue(ctx, key, value, extra) {
|
|
91
|
+
function deserializeValue(ctx, key, value) {
|
|
93
92
|
var _a;
|
|
94
|
-
let matched = key.match(
|
|
93
|
+
let matched = key.match(/^:(.*)$/);
|
|
95
94
|
if (matched) {
|
|
96
95
|
let key = matched[1];
|
|
97
96
|
let type = expression_1.PropBindType.expression;
|
|
@@ -119,7 +118,7 @@ function deserializeValue(ctx, key, value, extra) {
|
|
|
119
118
|
}
|
|
120
119
|
return {
|
|
121
120
|
key,
|
|
122
|
-
value: { type, value
|
|
121
|
+
value: { type, value },
|
|
123
122
|
};
|
|
124
123
|
}
|
|
125
124
|
else {
|
|
@@ -130,19 +129,13 @@ function deserializeValue(ctx, key, value, extra) {
|
|
|
130
129
|
: {
|
|
131
130
|
type: undefined /*'static'*/,
|
|
132
131
|
value,
|
|
133
|
-
extra,
|
|
134
132
|
},
|
|
135
133
|
};
|
|
136
134
|
}
|
|
137
135
|
}
|
|
138
136
|
exports.deserializeValue = deserializeValue;
|
|
139
|
-
function serializeDynamicMap(
|
|
140
|
-
return serializeDynamicMapWithExtra(props).data;
|
|
141
|
-
}
|
|
142
|
-
exports.serializeDynamicMap = serializeDynamicMap;
|
|
143
|
-
function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlineDefaultValue, }) {
|
|
137
|
+
function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultValue, }) {
|
|
144
138
|
let data = {};
|
|
145
|
-
let extra = {};
|
|
146
139
|
Object.keys(map)
|
|
147
140
|
.sort((a, b) => {
|
|
148
141
|
const aPath = a.split('.');
|
|
@@ -157,7 +150,7 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
157
150
|
}
|
|
158
151
|
})
|
|
159
152
|
.forEach((key) => {
|
|
160
|
-
let { key: processedKey, value: processedValue
|
|
153
|
+
let { key: processedKey, value: processedValue } = serializeValue({
|
|
161
154
|
ctx,
|
|
162
155
|
key,
|
|
163
156
|
dynamicValue: map[key],
|
|
@@ -165,17 +158,17 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
165
158
|
streamlineDefaultValue,
|
|
166
159
|
});
|
|
167
160
|
let matched = processedKey.match(/^:(.*)$/);
|
|
168
|
-
let originKey = processedKey;
|
|
169
161
|
if (matched) {
|
|
170
|
-
|
|
171
|
-
(0, lodash_1.unset)(data,
|
|
162
|
+
const originValue = matched[1];
|
|
163
|
+
(0, lodash_1.unset)(data, originValue);
|
|
172
164
|
}
|
|
173
165
|
if ((0, lodash_1.get)(data, processedKey) == undefined) {
|
|
166
|
+
let ValueTmp = processedValue;
|
|
174
167
|
/* 选区结构处理 [formily] to [CALS] */
|
|
175
|
-
if (Array.isArray(
|
|
176
|
-
(
|
|
177
|
-
|
|
178
|
-
|
|
168
|
+
if (Array.isArray(ValueTmp) &&
|
|
169
|
+
(ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.some((item) => item && item.selectableBlock))) {
|
|
170
|
+
ValueTmp = (0, lodash_1.cloneDeep)(processedValue);
|
|
171
|
+
ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.map((_value) => {
|
|
179
172
|
var _a, _b, _c;
|
|
180
173
|
const xProp = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props'];
|
|
181
174
|
const xComponent = (_c = (_b = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _b === void 0 ? void 0 : _b['x-component']) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
@@ -189,24 +182,24 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
189
182
|
return _value;
|
|
190
183
|
});
|
|
191
184
|
}
|
|
192
|
-
data[processedKey] =
|
|
185
|
+
data[processedKey] = ValueTmp;
|
|
193
186
|
}
|
|
194
|
-
extra[originKey] = processedExtra;
|
|
195
187
|
});
|
|
196
|
-
return
|
|
188
|
+
return data;
|
|
197
189
|
}
|
|
198
|
-
|
|
190
|
+
exports.serializeDynamicMap = serializeDynamicMap;
|
|
191
|
+
function deserializeDynamicMap(ctx, map) {
|
|
199
192
|
var _a, _b, _c;
|
|
200
193
|
let data = {};
|
|
201
194
|
for (let key in map || {}) {
|
|
202
195
|
let value = (_a = map) === null || _a === void 0 ? void 0 : _a[key];
|
|
203
|
-
let
|
|
204
|
-
let
|
|
196
|
+
let { key: processedKey, value: processedValue } = deserializeValue(ctx, key, value);
|
|
197
|
+
let ValueTmp = processedValue;
|
|
205
198
|
/* 选区结构处理 [CALS] to [formily] */
|
|
206
199
|
if (Array.isArray(processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) &&
|
|
207
200
|
((_b = processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) === null || _b === void 0 ? void 0 : _b.some((item) => item && item.selectableBlock))) {
|
|
208
|
-
|
|
209
|
-
(_c =
|
|
201
|
+
ValueTmp = (0, lodash_1.cloneDeep)(processedValue);
|
|
202
|
+
(_c = ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.value) === null || _c === void 0 ? void 0 : _c.map((_value) => {
|
|
210
203
|
var _a, _b, _c, _d;
|
|
211
204
|
const module = (_b = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a.module) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
212
205
|
const component = (_d = (_c = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _c === void 0 ? void 0 : _c.component) === null || _d === void 0 ? void 0 : _d.toLowerCase();
|
|
@@ -218,24 +211,21 @@ function deserializeDynamicMap(ctx, map, extraMap) {
|
|
|
218
211
|
return _value;
|
|
219
212
|
});
|
|
220
213
|
}
|
|
221
|
-
data[processedKey] =
|
|
214
|
+
data[processedKey] = ValueTmp;
|
|
222
215
|
}
|
|
223
216
|
return data;
|
|
224
217
|
}
|
|
225
218
|
exports.deserializeDynamicMap = deserializeDynamicMap;
|
|
226
219
|
function serializeAttributes(ctx, scope, attributes = {}) {
|
|
227
|
-
return
|
|
228
|
-
}
|
|
229
|
-
exports.serializeAttributes = serializeAttributes;
|
|
230
|
-
function serializeAttributesWithExtra(ctx, scope, attributes = {}) {
|
|
231
|
-
return serializeDynamicMapWithExtra({
|
|
220
|
+
return serializeDynamicMap({
|
|
232
221
|
ctx,
|
|
233
222
|
scope,
|
|
234
223
|
map: attributes,
|
|
235
224
|
streamlineDefaultValue: ctx.streamlineDefaultValue,
|
|
236
225
|
});
|
|
237
226
|
}
|
|
238
|
-
|
|
227
|
+
exports.serializeAttributes = serializeAttributes;
|
|
228
|
+
function deserializeAttributes(ctx, attributes = {}) {
|
|
239
229
|
const reservedAttributes = ['style', 'commonStyle', 'class'];
|
|
240
230
|
const reservedAttributesMap = reservedAttributes.reduce((map, key) => {
|
|
241
231
|
map[key] = true;
|
|
@@ -251,7 +241,7 @@ function deserializeAttributes(ctx, attributes = {}, attributesExtraData = {}) {
|
|
|
251
241
|
restAttributes[key] = attributes[key];
|
|
252
242
|
}
|
|
253
243
|
}
|
|
254
|
-
return deserializeDynamicMap(ctx, restAttributes
|
|
244
|
+
return deserializeDynamicMap(ctx, restAttributes);
|
|
255
245
|
}
|
|
256
246
|
exports.deserializeAttributes = deserializeAttributes;
|
|
257
247
|
/**
|
|
@@ -263,20 +253,20 @@ function serializeDataset(ctx, dataset) {
|
|
|
263
253
|
return dataset;
|
|
264
254
|
const result = JSON.parse(JSON.stringify(dataset));
|
|
265
255
|
Object.values(result.state).forEach((state) => {
|
|
266
|
-
var _a, _b
|
|
256
|
+
var _a, _b;
|
|
267
257
|
if (state.varType !== 'datasource')
|
|
268
258
|
return;
|
|
269
259
|
if ((_a = state.initMethod) === null || _a === void 0 ? void 0 : _a.params) {
|
|
270
|
-
state.initMethod.params = (
|
|
260
|
+
state.initMethod.params = serializeDynamicMap({
|
|
271
261
|
ctx,
|
|
272
262
|
map: state.initMethod.params,
|
|
273
|
-
})
|
|
263
|
+
});
|
|
274
264
|
}
|
|
275
|
-
if ((
|
|
276
|
-
state.updateMethod.params = (
|
|
265
|
+
if ((_b = state.updateMethod) === null || _b === void 0 ? void 0 : _b.params) {
|
|
266
|
+
state.updateMethod.params = serializeDynamicMap({
|
|
277
267
|
ctx,
|
|
278
268
|
map: state.updateMethod.params,
|
|
279
|
-
})
|
|
269
|
+
});
|
|
280
270
|
}
|
|
281
271
|
});
|
|
282
272
|
return result;
|
|
@@ -386,10 +376,10 @@ function serializeListener(ctx, listener) {
|
|
|
386
376
|
module: /^comp\-\w+$/.test(listener.handler.moduleName)
|
|
387
377
|
? '$comp'
|
|
388
378
|
: listener.handler.moduleName,
|
|
389
|
-
params:
|
|
379
|
+
params: serializeDynamicMap({
|
|
390
380
|
ctx,
|
|
391
381
|
map: listener.data,
|
|
392
|
-
})
|
|
382
|
+
}),
|
|
393
383
|
},
|
|
394
384
|
isCapturePhase: listener.isCapturePhase,
|
|
395
385
|
};
|
|
@@ -501,59 +491,45 @@ function serializeComponent(ctx, component, scope = 'page') {
|
|
|
501
491
|
if (componentCtx.dependencies && !componentCtx.dependenciesMap) {
|
|
502
492
|
componentCtx.dependenciesMap = processDependenciesMap(componentCtx.dependencies || []);
|
|
503
493
|
}
|
|
504
|
-
const { data: attributes = {}, extra: attributeExtraData = {}, } = serializeAttributesWithExtra(componentCtx, scope, (component.xProps.data || {}));
|
|
505
|
-
let classListBindData = null;
|
|
506
|
-
let styleBindData = null;
|
|
507
|
-
if ((_d = component === null || component === void 0 ? void 0 : component.xProps) === null || _d === void 0 ? void 0 : _d.classListBind) {
|
|
508
|
-
classListBindData = serializeValue({
|
|
509
|
-
ctx: componentCtx,
|
|
510
|
-
key: 'classListBind',
|
|
511
|
-
dynamicValue: (_e = component === null || component === void 0 ? void 0 : component.xProps) === null || _e === void 0 ? void 0 : _e.classListBind,
|
|
512
|
-
scope,
|
|
513
|
-
});
|
|
514
|
-
if (classListBindData.extra) {
|
|
515
|
-
attributeExtraData['class'] = classListBindData.extra;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
if ((_f = component === null || component === void 0 ? void 0 : component.xProps) === null || _f === void 0 ? void 0 : _f.styleBind) {
|
|
519
|
-
styleBindData = serializeValue({
|
|
520
|
-
ctx: componentCtx,
|
|
521
|
-
key: 'styleBind',
|
|
522
|
-
dynamicValue: (_g = component === null || component === void 0 ? void 0 : component.xProps) === null || _g === void 0 ? void 0 : _g.styleBind,
|
|
523
|
-
});
|
|
524
|
-
if (styleBindData.extra) {
|
|
525
|
-
attributeExtraData['style'] = styleBindData.extra;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
494
|
return {
|
|
529
495
|
id: component.id,
|
|
530
496
|
type: undefined,
|
|
531
497
|
module: serializeModuleName(componentCtx, moduleName, componentName),
|
|
532
498
|
component: componentName,
|
|
533
499
|
attributes: (0, runtime_1.getValidValue)(component.xProps
|
|
534
|
-
? Object.assign(Object.assign({},
|
|
500
|
+
? Object.assign(Object.assign({}, serializeAttributes(componentCtx, scope, (component.xProps.data || {}))), { style: (_d = component.xProps) === null || _d === void 0 ? void 0 : _d.style, class: (_f = (_e = component.xProps) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.join(' ') }) : undefined),
|
|
535
501
|
items: component.properties
|
|
536
502
|
? Object.keys(component.properties).map((key) => {
|
|
537
503
|
var _a;
|
|
538
504
|
return serializeComponent(componentCtx, Object.assign({ id: key }, (_a = component.properties) === null || _a === void 0 ? void 0 : _a[key]), scope);
|
|
539
505
|
})
|
|
540
506
|
: undefined,
|
|
541
|
-
listeners: (0, runtime_1.getValidValue)((
|
|
507
|
+
listeners: (0, runtime_1.getValidValue)((_h = (_g = component.xProps) === null || _g === void 0 ? void 0 : _g.listeners) === null || _h === void 0 ? void 0 : _h.map((listener) => {
|
|
542
508
|
return serializeListener(componentCtx, listener);
|
|
543
509
|
})),
|
|
544
|
-
directives: serializeDirecties(componentCtx, (((
|
|
510
|
+
directives: serializeDirecties(componentCtx, (((_j = component.xProps) === null || _j === void 0 ? void 0 : _j.directives) || {}), scope) || {
|
|
545
511
|
':if': true,
|
|
546
512
|
},
|
|
547
|
-
':class':
|
|
548
|
-
|
|
513
|
+
':class': ((_k = component === null || component === void 0 ? void 0 : component.xProps) === null || _k === void 0 ? void 0 : _k.classListBind)
|
|
514
|
+
? serializeValue({
|
|
515
|
+
ctx: componentCtx,
|
|
516
|
+
key: 'classListBind',
|
|
517
|
+
dynamicValue: (_l = component === null || component === void 0 ? void 0 : component.xProps) === null || _l === void 0 ? void 0 : _l.classListBind,
|
|
518
|
+
scope,
|
|
519
|
+
}).value
|
|
520
|
+
: undefined,
|
|
521
|
+
':style': ((_m = component === null || component === void 0 ? void 0 : component.xProps) === null || _m === void 0 ? void 0 : _m.styleBind)
|
|
522
|
+
? serializeValue({
|
|
523
|
+
ctx: componentCtx,
|
|
524
|
+
key: 'styleBind',
|
|
525
|
+
dynamicValue: (_o = component === null || component === void 0 ? void 0 : component.xProps) === null || _o === void 0 ? void 0 : _o.styleBind,
|
|
526
|
+
}).value
|
|
527
|
+
: undefined,
|
|
549
528
|
extra: {
|
|
550
529
|
commonStyle: (_p = component.xProps) === null || _p === void 0 ? void 0 : _p.commonStyle,
|
|
551
530
|
xIndex: component.xIndex,
|
|
552
531
|
styleBindPath: (_q = component === null || component === void 0 ? void 0 : component.xProps) === null || _q === void 0 ? void 0 : _q.styleBindPath,
|
|
553
532
|
staticResourceAttribute: (_r = component === null || component === void 0 ? void 0 : component.xProps) === null || _r === void 0 ? void 0 : _r.staticResourceAttribute,
|
|
554
|
-
attributeExtraData: (0, common_3.isEmptyObj)(attributeExtraData)
|
|
555
|
-
? undefined
|
|
556
|
-
: attributeExtraData,
|
|
557
533
|
},
|
|
558
534
|
};
|
|
559
535
|
}
|
|
@@ -561,14 +537,11 @@ exports.serializeComponent = serializeComponent;
|
|
|
561
537
|
function deserializeComponent(ctx, components) {
|
|
562
538
|
let componentMap = components.reduce((map, item) => {
|
|
563
539
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
564
|
-
const { attributeExtraData = {} } = item.extra || {};
|
|
565
540
|
let dynamicStyle = item[':style']
|
|
566
|
-
? deserializeValue(ctx, ':style', item[':style']
|
|
567
|
-
).value
|
|
541
|
+
? deserializeValue(ctx, ':style', item[':style']).value
|
|
568
542
|
: undefined;
|
|
569
543
|
let dynamicClassList = item[':class']
|
|
570
|
-
? deserializeValue(ctx, ':class', item[':class']
|
|
571
|
-
).value
|
|
544
|
+
? deserializeValue(ctx, ':class', item[':class']).value
|
|
572
545
|
: undefined;
|
|
573
546
|
const xComponent = {
|
|
574
547
|
moduleName: item.module,
|
|
@@ -580,7 +553,7 @@ function deserializeComponent(ctx, components) {
|
|
|
580
553
|
xComponent.moduleName;
|
|
581
554
|
}
|
|
582
555
|
const xProps = {
|
|
583
|
-
data: deserializeAttributes(ctx, item.attributes
|
|
556
|
+
data: deserializeAttributes(ctx, item.attributes),
|
|
584
557
|
directives: deserializeDirecties(ctx, item.directives || {}),
|
|
585
558
|
style: (_a = item.attributes) === null || _a === void 0 ? void 0 : _a.style,
|
|
586
559
|
styleBind: dynamicStyle
|
|
@@ -589,6 +562,9 @@ function deserializeComponent(ctx, components) {
|
|
|
589
562
|
value: dynamicStyle.value,
|
|
590
563
|
}
|
|
591
564
|
: undefined,
|
|
565
|
+
// styleBindPath: item.styleBindPath
|
|
566
|
+
// ? deserializeValue('styleBindPath', item.styleBindPath).value
|
|
567
|
+
// : undefined, // 含义未知
|
|
592
568
|
commonStyle: (_b = item === null || item === void 0 ? void 0 : item.extra) === null || _b === void 0 ? void 0 : _b.commonStyle,
|
|
593
569
|
staticResourceAttribute: (_c = item === null || item === void 0 ? void 0 : item.extra) === null || _c === void 0 ? void 0 : _c.staticResourceAttribute,
|
|
594
570
|
classList: (_f = (_e = (_d = item.attributes) === null || _d === void 0 ? void 0 : _d.class) === null || _e === void 0 ? void 0 : _e.split(/\s/g)) === null || _f === void 0 ? void 0 : _f.filter((className) => !!className),
|
|
@@ -640,7 +616,7 @@ function serializePage(ctx, page) {
|
|
|
640
616
|
id: page.id,
|
|
641
617
|
type: 'PAGE',
|
|
642
618
|
component: 'Page',
|
|
643
|
-
attributes: (0, runtime_1.getValidValue)(
|
|
619
|
+
attributes: (0, runtime_1.getValidValue)(serializeAttributes(pageCtx, 'page', page.data)),
|
|
644
620
|
items: Object.keys(page.componentInstances || {}).map((id) => {
|
|
645
621
|
return serializeComponent(pageCtx, Object.assign({ id }, page.componentInstances[id]));
|
|
646
622
|
}),
|
|
@@ -654,6 +630,7 @@ function serializePage(ctx, page) {
|
|
|
654
630
|
return serializeListener(pageCtx, item);
|
|
655
631
|
})),
|
|
656
632
|
extra: {
|
|
633
|
+
pluginInstances: page === null || page === void 0 ? void 0 : page.pluginInstances,
|
|
657
634
|
commonStyle: page === null || page === void 0 ? void 0 : page.commonStyle,
|
|
658
635
|
xIndex: page.xIndex,
|
|
659
636
|
staticResourceAttribute: page === null || page === void 0 ? void 0 : page.staticResourceAttribute,
|
|
@@ -689,8 +666,9 @@ function deserializePage(ctx, page) {
|
|
|
689
666
|
return deserializeDataVariables(pageCtx, item);
|
|
690
667
|
})) || [],
|
|
691
668
|
},
|
|
692
|
-
data: deserializeAttributes(pageCtx, page.attributes
|
|
669
|
+
data: deserializeAttributes(pageCtx, page.attributes),
|
|
693
670
|
componentInstances: deserializeComponent(pageCtx, page.items || []),
|
|
671
|
+
pluginInstances: (_b = page.extra) === null || _b === void 0 ? void 0 : _b.pluginInstances,
|
|
694
672
|
commonStyle: (_c = page === null || page === void 0 ? void 0 : page.extra) === null || _c === void 0 ? void 0 : _c.commonStyle,
|
|
695
673
|
staticResourceAttribute: (_d = page === null || page === void 0 ? void 0 : page.extra) === null || _d === void 0 ? void 0 : _d.staticResourceAttribute,
|
|
696
674
|
hideAdminPortalMenu: (_e = page === null || page === void 0 ? void 0 : page.extra) === null || _e === void 0 ? void 0 : _e.hideAdminPortalMenu,
|
|
@@ -804,7 +782,7 @@ function serializeRuntimePage(ctx, page //IPageInstance
|
|
|
804
782
|
id: page.id,
|
|
805
783
|
type: 'PAGE',
|
|
806
784
|
component: 'Page',
|
|
807
|
-
attributes:
|
|
785
|
+
attributes: serializeAttributes(pageCtx, 'page', (0, runtime_1.readDynamicData)(page)),
|
|
808
786
|
items: (0, runtime_1.getValidValue)(Object.keys(((_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties) || {}).map((id) => {
|
|
809
787
|
var _a;
|
|
810
788
|
return serializeRuntimeComponent(pageCtx, Object.assign({ id }, (_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties[id]));
|
|
@@ -816,6 +794,7 @@ function serializeRuntimePage(ctx, page //IPageInstance
|
|
|
816
794
|
return serializeListener(pageCtx, item);
|
|
817
795
|
})),
|
|
818
796
|
extra: {
|
|
797
|
+
pluginInstances: (0, runtime_1.getValidValue)(page === null || page === void 0 ? void 0 : page.pluginInstances),
|
|
819
798
|
commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(page.style)),
|
|
820
799
|
styleBindPath: (0, runtime_1.getValidValue)(page.styleBindPath),
|
|
821
800
|
xIndex: page.xIndex,
|
|
@@ -875,48 +854,33 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
|
|
|
875
854
|
.filter((dataType) => dataType.type !== 'slot')
|
|
876
855
|
.map((dataType) => dataType.propertyPath);
|
|
877
856
|
let properties = component.properties || {};
|
|
878
|
-
|
|
879
|
-
let styleBindData = null;
|
|
880
|
-
let classListBindData = null;
|
|
881
|
-
if ((_a = props === null || props === void 0 ? void 0 : props.styleBind) === null || _a === void 0 ? void 0 : _a.bindDataPath) {
|
|
882
|
-
styleBindData = serializeValue({
|
|
883
|
-
ctx: componentCtx,
|
|
884
|
-
key: 'styleBind',
|
|
885
|
-
dynamicValue: {
|
|
886
|
-
type: props.styleBind.type,
|
|
887
|
-
value: props.styleBind.bindDataPath,
|
|
888
|
-
extra: props.styleBind.extra,
|
|
889
|
-
},
|
|
890
|
-
});
|
|
891
|
-
if (styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.extra) {
|
|
892
|
-
attributeExtraData.style = styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.extra;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
if ((0, common_3.isValidClassNameListBind)(props.classNameListBind)) {
|
|
896
|
-
classListBindData = serializeValue({
|
|
897
|
-
ctx: componentCtx,
|
|
898
|
-
key: 'classListBind',
|
|
899
|
-
dynamicValue: (0, runtime_1.getValidValue)({
|
|
900
|
-
type: props.classNameListBind.type,
|
|
901
|
-
value: props.classNameListBind.bindDataPath,
|
|
902
|
-
}),
|
|
903
|
-
});
|
|
904
|
-
if (classListBindData === null || classListBindData === void 0 ? void 0 : classListBindData.extra) {
|
|
905
|
-
attributeExtraData.class = classListBindData === null || classListBindData === void 0 ? void 0 : classListBindData.extra;
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
processed = Object.assign(Object.assign({}, processed), { module: serializeModuleName(componentCtx, moduleName, name), component: name, attributes: Object.assign(Object.assign({}, attributes), { style: (0, runtime_1.getValidValue)(props.style), class: (_b = (0, runtime_1.getValidValue)(props.classNameList)) === null || _b === void 0 ? void 0 : _b.join(' ') }), items: (0, runtime_1.getValidValue)(Object.keys(properties)
|
|
857
|
+
processed = Object.assign(Object.assign({}, processed), { module: serializeModuleName(componentCtx, moduleName, name), component: name, attributes: Object.assign(Object.assign({}, serializeAttributes(componentCtx, 'page', ((0, runtime_1.getValidValue)((0, runtime_1.readDynamicData)(props)) || {}))), { style: (0, runtime_1.getValidValue)(props.style), class: (_a = (0, runtime_1.getValidValue)(props.classNameList)) === null || _a === void 0 ? void 0 : _a.join(' ') }), items: (0, runtime_1.getValidValue)(Object.keys(properties)
|
|
909
858
|
.filter((key) => !excludeKeys.includes(key))
|
|
910
|
-
.map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, properties[key])))), listeners: (
|
|
859
|
+
.map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, properties[key])))), listeners: (_b = (0, runtime_1.getValidValue)((0, runtime_1.readListeners)(props.listenerInstances))) === null || _b === void 0 ? void 0 : _b.map((listener /* IEventListener */) => {
|
|
911
860
|
return serializeListener(componentCtx, listener);
|
|
912
|
-
}), directives: serializeDirecties(componentCtx, ((0, runtime_1.getValidValue)((0, runtime_1.readDirectives)(props)) || {})) || undefined, ':class': (
|
|
861
|
+
}), directives: serializeDirecties(componentCtx, ((0, runtime_1.getValidValue)((0, runtime_1.readDirectives)(props)) || {})) || undefined, ':class': (0, common_3.isValidClassNameListBind)(props.classNameListBind)
|
|
862
|
+
? serializeValue({
|
|
863
|
+
ctx: componentCtx,
|
|
864
|
+
key: 'classListBind',
|
|
865
|
+
dynamicValue: (0, runtime_1.getValidValue)({
|
|
866
|
+
type: props.classNameListBind.type,
|
|
867
|
+
value: props.classNameListBind.bindDataPath,
|
|
868
|
+
}),
|
|
869
|
+
}).value
|
|
870
|
+
: undefined, ':style': ((_c = props === null || props === void 0 ? void 0 : props.styleBind) === null || _c === void 0 ? void 0 : _c.bindDataPath)
|
|
871
|
+
? serializeValue({
|
|
872
|
+
ctx: componentCtx,
|
|
873
|
+
key: 'styleBind',
|
|
874
|
+
dynamicValue: {
|
|
875
|
+
type: props.styleBind.type,
|
|
876
|
+
value: props.styleBind.bindDataPath,
|
|
877
|
+
},
|
|
878
|
+
}).value
|
|
879
|
+
: undefined, extra: {
|
|
913
880
|
commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(props.commonStyle)),
|
|
914
881
|
xIndex: (0, runtime_1.getValidValue)(component['x-index']),
|
|
915
882
|
styleBindPath: (0, runtime_1.getValidValue)(props.styleBindPath),
|
|
916
883
|
staticResourceAttribute: (0, runtime_1.getValidValue)(props.staticResourceAttribute),
|
|
917
|
-
attributeExtraData: (0, common_3.isEmptyObj)(attributeExtraData)
|
|
918
|
-
? undefined
|
|
919
|
-
: attributeExtraData,
|
|
920
884
|
} });
|
|
921
885
|
}
|
|
922
886
|
else {
|
|
@@ -108,10 +108,10 @@ function parseValueCals(ctx, value) {
|
|
|
108
108
|
let parser = new expression_1.DynamicValueParser(value, { pageId: '$page' });
|
|
109
109
|
let res = parser.parse();
|
|
110
110
|
switch (res.type) {
|
|
111
|
-
case expression_1.PropBindType.
|
|
111
|
+
case expression_1.PropBindType.paramData:
|
|
112
112
|
case expression_1.PropBindType.stateData: {
|
|
113
113
|
const TYPE_MAP = {
|
|
114
|
-
[expression_1.PropBindType.
|
|
114
|
+
[expression_1.PropBindType.paramData]: 'params',
|
|
115
115
|
[expression_1.PropBindType.stateData]: 'state',
|
|
116
116
|
};
|
|
117
117
|
const type = TYPE_MAP[res.type];
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { IDynamicValue } from '../../expression';
|
|
2
1
|
export declare function readComponents(properties?: {
|
|
3
2
|
[key: string]: any;
|
|
4
3
|
}, excludeKeys?: string[]): Object;
|
|
5
4
|
export declare function readDirectives(cmp: any): any;
|
|
6
|
-
export declare function readDynamicData(cmp: any):
|
|
7
|
-
[key: string]: IDynamicValue;
|
|
8
|
-
};
|
|
5
|
+
export declare function readDynamicData(cmp: any): any;
|
|
9
6
|
export declare function readListeners(listenerInstances?: any[]): any;
|
|
10
7
|
export declare function writeListeners(listeners?: any[]): any[];
|
|
11
8
|
export declare function writeDynamicData(from: any, to: any, properties: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,CAC5B,UAAU,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAmB,EACnD,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,CA+DR;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,OAuCtC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,OA8BvC;AAED,wBAAgB,aAAa,CAAC,iBAAiB,GAAE,GAAG,EAAO,OAiB1D;AAED,wBAAgB,cAAc,CAAC,SAAS,GAAE,GAAG,EAAO,SAenD;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,OAgExE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAKjE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,OAWvC"}
|