@cloudbase/cals 0.3.21 → 0.3.22-alpha.0
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 +17 -67
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +123 -87
- package/lib/parser/cals/utils/block/index.js +2 -2
- package/lib/parser/cals/utils/runtime.d.ts +4 -1
- package/lib/parser/cals/utils/runtime.d.ts.map +1 -1
- package/lib/parser/cals/utils/runtime.js +7 -0
- package/lib/parser/cals/utils/version/utils.d.ts +4 -4
- package/lib/parser/cals/utils/version/utils.d.ts.map +1 -1
- package/lib/parser/expression/index.d.ts +8 -1
- package/lib/parser/expression/index.d.ts.map +1 -1
- package/lib/parser/expression/index.js +6 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/platform/component.d.ts +6 -21
- package/lib/types/platform/component.d.ts.map +1 -1
- package/lib/types/platform/widget/form.js +0 -1
- package/package.json +1 -1
- package/lib/schema/platform_application.json +0 -2177
- package/lib/tests/common-application-specs.test.d.ts +0 -2
- package/lib/tests/common-application-specs.test.d.ts.map +0 -1
- package/lib/tests/common-application-specs.test.js +0 -45
|
@@ -30,51 +30,47 @@ interface ISerializeContext {
|
|
|
30
30
|
export declare function serializeValue({ ctx, key, dynamicValue, scope, streamlineDefaultValue, }: {
|
|
31
31
|
ctx: ISerializeContext;
|
|
32
32
|
key: string;
|
|
33
|
-
dynamicValue:
|
|
34
|
-
type?: PropBindType | 'static';
|
|
35
|
-
value: any;
|
|
36
|
-
};
|
|
33
|
+
dynamicValue: IDynamicValue;
|
|
37
34
|
scope?: 'page' | 'component';
|
|
38
35
|
streamlineDefaultValue?: boolean;
|
|
39
36
|
}): {
|
|
40
37
|
key: string;
|
|
41
38
|
value: any;
|
|
39
|
+
extra?: any;
|
|
42
40
|
};
|
|
43
|
-
export declare function deserializeValue(ctx: IDeserializeContext, key: string, value: any): {
|
|
41
|
+
export declare function deserializeValue(ctx: IDeserializeContext, key: string, value: any, extra?: any): {
|
|
44
42
|
key: string;
|
|
45
43
|
value: {
|
|
46
44
|
type: PropBindType;
|
|
47
45
|
value: any;
|
|
46
|
+
extra: any;
|
|
48
47
|
};
|
|
49
48
|
};
|
|
50
|
-
|
|
49
|
+
interface ISerializeDynamicMapProps {
|
|
51
50
|
ctx: ISerializeContext;
|
|
52
51
|
map: {
|
|
53
|
-
[key: string]:
|
|
52
|
+
[key: string]: IDynamicValue;
|
|
54
53
|
};
|
|
55
54
|
scope?: 'page' | 'component';
|
|
56
55
|
streamlineDefaultValue?: boolean;
|
|
57
|
-
}
|
|
56
|
+
}
|
|
57
|
+
export declare function serializeDynamicMap(props: ISerializeDynamicMapProps): {
|
|
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;
|
|
62
64
|
}): {
|
|
63
|
-
[key: string]:
|
|
64
|
-
type?: string;
|
|
65
|
-
value: any;
|
|
66
|
-
};
|
|
65
|
+
[key: string]: IDynamicValue;
|
|
67
66
|
};
|
|
68
67
|
export declare function serializeAttributes(ctx: ISerializeContext, scope: 'page' | 'component', attributes?: {
|
|
69
68
|
[key: string]: IDynamicValue;
|
|
70
69
|
}): {
|
|
71
70
|
[key: string]: string;
|
|
72
71
|
};
|
|
73
|
-
export declare function deserializeAttributes(ctx: IDeserializeContext, attributes?: IAttributes): {
|
|
74
|
-
[key: string]:
|
|
75
|
-
type?: string;
|
|
76
|
-
value: any;
|
|
77
|
-
};
|
|
72
|
+
export declare function deserializeAttributes(ctx: IDeserializeContext, attributes?: IAttributes, attributesExtraData?: {}): {
|
|
73
|
+
[key: string]: IDynamicValue;
|
|
78
74
|
};
|
|
79
75
|
export declare function deserializeDataVariables(ctx: IDeserializeContext, data: IDataSourceVariable): {
|
|
80
76
|
title: string;
|
|
@@ -142,31 +138,11 @@ export declare function deserializePage(ctx: {
|
|
|
142
138
|
}[];
|
|
143
139
|
};
|
|
144
140
|
data: {
|
|
145
|
-
[key: string]:
|
|
146
|
-
type?: string;
|
|
147
|
-
value: any;
|
|
148
|
-
};
|
|
141
|
+
[key: string]: IDynamicValue;
|
|
149
142
|
};
|
|
150
143
|
componentInstances: {
|
|
151
144
|
[key: string]: object;
|
|
152
145
|
};
|
|
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
|
-
};
|
|
170
146
|
commonStyle: object;
|
|
171
147
|
staticResourceAttribute: string[];
|
|
172
148
|
hideAdminPortalMenu: boolean;
|
|
@@ -186,10 +162,7 @@ export declare function deserializePage(ctx: {
|
|
|
186
162
|
moduleName: string;
|
|
187
163
|
};
|
|
188
164
|
data: {
|
|
189
|
-
[key: string]:
|
|
190
|
-
type?: string;
|
|
191
|
-
value: any;
|
|
192
|
-
};
|
|
165
|
+
[key: string]: IDynamicValue;
|
|
193
166
|
};
|
|
194
167
|
isCapturePhase: boolean;
|
|
195
168
|
noPropagation: boolean;
|
|
@@ -235,31 +208,11 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
235
208
|
}[];
|
|
236
209
|
};
|
|
237
210
|
data: {
|
|
238
|
-
[key: string]:
|
|
239
|
-
type?: string;
|
|
240
|
-
value: any;
|
|
241
|
-
};
|
|
211
|
+
[key: string]: IDynamicValue;
|
|
242
212
|
};
|
|
243
213
|
componentInstances: {
|
|
244
214
|
[key: string]: object;
|
|
245
215
|
};
|
|
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
|
-
};
|
|
263
216
|
commonStyle: object;
|
|
264
217
|
staticResourceAttribute: string[];
|
|
265
218
|
hideAdminPortalMenu: boolean;
|
|
@@ -279,10 +232,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
279
232
|
moduleName: string;
|
|
280
233
|
};
|
|
281
234
|
data: {
|
|
282
|
-
[key: string]:
|
|
283
|
-
type?: string;
|
|
284
|
-
value: any;
|
|
285
|
-
};
|
|
235
|
+
[key: string]: IDynamicValue;
|
|
286
236
|
};
|
|
287
237
|
isCapturePhase: boolean;
|
|
288
238
|
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,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,EAAE,CAAA;CACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAoEhB;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,CAgIrC;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.params: {
|
|
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.params]: 'dataset.params',
|
|
44
44
|
};
|
|
45
45
|
let exp = dynamicValue.value;
|
|
46
46
|
let reg = /^(.*?)\./;
|
|
@@ -85,12 +85,13 @@ function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefa
|
|
|
85
85
|
value = undefined;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
return { key, value };
|
|
88
|
+
return { key, value, extra: dynamicValue.extra };
|
|
89
89
|
}
|
|
90
90
|
exports.serializeValue = serializeValue;
|
|
91
|
-
|
|
91
|
+
const DYNAMIC_KEY_REG = /^:(.*)$/;
|
|
92
|
+
function deserializeValue(ctx, key, value, extra) {
|
|
92
93
|
var _a;
|
|
93
|
-
let matched = key.match(
|
|
94
|
+
let matched = key.match(DYNAMIC_KEY_REG);
|
|
94
95
|
if (matched) {
|
|
95
96
|
let key = matched[1];
|
|
96
97
|
let type = expression_1.PropBindType.expression;
|
|
@@ -118,7 +119,7 @@ function deserializeValue(ctx, key, value) {
|
|
|
118
119
|
}
|
|
119
120
|
return {
|
|
120
121
|
key,
|
|
121
|
-
value: { type, value },
|
|
122
|
+
value: { type, value, extra },
|
|
122
123
|
};
|
|
123
124
|
}
|
|
124
125
|
else {
|
|
@@ -129,13 +130,19 @@ function deserializeValue(ctx, key, value) {
|
|
|
129
130
|
: {
|
|
130
131
|
type: undefined /*'static'*/,
|
|
131
132
|
value,
|
|
133
|
+
extra,
|
|
132
134
|
},
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
138
|
exports.deserializeValue = deserializeValue;
|
|
137
|
-
function serializeDynamicMap(
|
|
139
|
+
function serializeDynamicMap(props) {
|
|
140
|
+
return serializeDynamicMapWithExtra(props).data;
|
|
141
|
+
}
|
|
142
|
+
exports.serializeDynamicMap = serializeDynamicMap;
|
|
143
|
+
function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlineDefaultValue, }) {
|
|
138
144
|
let data = {};
|
|
145
|
+
let extra = {};
|
|
139
146
|
Object.keys(map)
|
|
140
147
|
.sort((a, b) => {
|
|
141
148
|
const aPath = a.split('.');
|
|
@@ -150,7 +157,7 @@ function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultV
|
|
|
150
157
|
}
|
|
151
158
|
})
|
|
152
159
|
.forEach((key) => {
|
|
153
|
-
let { key: processedKey, value: processedValue } = serializeValue({
|
|
160
|
+
let { key: processedKey, value: processedValue, extra: processedExtra, } = serializeValue({
|
|
154
161
|
ctx,
|
|
155
162
|
key,
|
|
156
163
|
dynamicValue: map[key],
|
|
@@ -158,17 +165,17 @@ function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultV
|
|
|
158
165
|
streamlineDefaultValue,
|
|
159
166
|
});
|
|
160
167
|
let matched = processedKey.match(/^:(.*)$/);
|
|
168
|
+
let originKey = processedKey;
|
|
161
169
|
if (matched) {
|
|
162
|
-
|
|
163
|
-
(0, lodash_1.unset)(data,
|
|
170
|
+
originKey = matched[1];
|
|
171
|
+
(0, lodash_1.unset)(data, originKey);
|
|
164
172
|
}
|
|
165
173
|
if ((0, lodash_1.get)(data, processedKey) == undefined) {
|
|
166
|
-
let ValueTmp = processedValue;
|
|
167
174
|
/* 选区结构处理 [formily] to [CALS] */
|
|
168
|
-
if (Array.isArray(
|
|
169
|
-
(
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
if (Array.isArray(processedValue) &&
|
|
176
|
+
(processedValue === null || processedValue === void 0 ? void 0 : processedValue.some((item) => item && item.selectableBlock))) {
|
|
177
|
+
let valueTmp = (0, lodash_1.cloneDeep)(processedValue);
|
|
178
|
+
valueTmp === null || valueTmp === void 0 ? void 0 : valueTmp.map((_value) => {
|
|
172
179
|
var _a, _b, _c;
|
|
173
180
|
const xProp = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props'];
|
|
174
181
|
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();
|
|
@@ -182,24 +189,24 @@ function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultV
|
|
|
182
189
|
return _value;
|
|
183
190
|
});
|
|
184
191
|
}
|
|
185
|
-
data[processedKey] =
|
|
192
|
+
data[processedKey] = processedValue;
|
|
186
193
|
}
|
|
194
|
+
extra[originKey] = processedExtra;
|
|
187
195
|
});
|
|
188
|
-
return data;
|
|
196
|
+
return { data, extra };
|
|
189
197
|
}
|
|
190
|
-
|
|
191
|
-
function deserializeDynamicMap(ctx, map) {
|
|
198
|
+
function deserializeDynamicMap(ctx, map, extraMap) {
|
|
192
199
|
var _a, _b, _c;
|
|
193
200
|
let data = {};
|
|
194
201
|
for (let key in map || {}) {
|
|
195
202
|
let value = (_a = map) === null || _a === void 0 ? void 0 : _a[key];
|
|
196
|
-
let
|
|
197
|
-
let
|
|
203
|
+
let matched = key.match(DYNAMIC_KEY_REG);
|
|
204
|
+
let { key: processedKey, value: processedValue } = deserializeValue(ctx, key, value, extraMap[matched ? matched[1] : key]);
|
|
198
205
|
/* 选区结构处理 [CALS] to [formily] */
|
|
199
206
|
if (Array.isArray(processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) &&
|
|
200
207
|
((_b = processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) === null || _b === void 0 ? void 0 : _b.some((item) => item && item.selectableBlock))) {
|
|
201
|
-
|
|
202
|
-
(_c =
|
|
208
|
+
let valueTmp = (0, lodash_1.cloneDeep)(processedValue);
|
|
209
|
+
(_c = valueTmp === null || valueTmp === void 0 ? void 0 : valueTmp.value) === null || _c === void 0 ? void 0 : _c.forEach((_value) => {
|
|
203
210
|
var _a, _b, _c, _d;
|
|
204
211
|
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();
|
|
205
212
|
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();
|
|
@@ -211,21 +218,24 @@ function deserializeDynamicMap(ctx, map) {
|
|
|
211
218
|
return _value;
|
|
212
219
|
});
|
|
213
220
|
}
|
|
214
|
-
data[processedKey] =
|
|
221
|
+
data[processedKey] = processedValue;
|
|
215
222
|
}
|
|
216
223
|
return data;
|
|
217
224
|
}
|
|
218
225
|
exports.deserializeDynamicMap = deserializeDynamicMap;
|
|
219
226
|
function serializeAttributes(ctx, scope, attributes = {}) {
|
|
220
|
-
return
|
|
227
|
+
return serializeAttributesWithExtra(ctx, scope, attributes).data;
|
|
228
|
+
}
|
|
229
|
+
exports.serializeAttributes = serializeAttributes;
|
|
230
|
+
function serializeAttributesWithExtra(ctx, scope, attributes = {}) {
|
|
231
|
+
return serializeDynamicMapWithExtra({
|
|
221
232
|
ctx,
|
|
222
233
|
scope,
|
|
223
234
|
map: attributes,
|
|
224
235
|
streamlineDefaultValue: ctx.streamlineDefaultValue,
|
|
225
236
|
});
|
|
226
237
|
}
|
|
227
|
-
|
|
228
|
-
function deserializeAttributes(ctx, attributes = {}) {
|
|
238
|
+
function deserializeAttributes(ctx, attributes = {}, attributesExtraData = {}) {
|
|
229
239
|
const reservedAttributes = ['style', 'commonStyle', 'class'];
|
|
230
240
|
const reservedAttributesMap = reservedAttributes.reduce((map, key) => {
|
|
231
241
|
map[key] = true;
|
|
@@ -241,7 +251,7 @@ function deserializeAttributes(ctx, attributes = {}) {
|
|
|
241
251
|
restAttributes[key] = attributes[key];
|
|
242
252
|
}
|
|
243
253
|
}
|
|
244
|
-
return deserializeDynamicMap(ctx, restAttributes);
|
|
254
|
+
return deserializeDynamicMap(ctx, restAttributes, attributesExtraData);
|
|
245
255
|
}
|
|
246
256
|
exports.deserializeAttributes = deserializeAttributes;
|
|
247
257
|
/**
|
|
@@ -253,20 +263,20 @@ function serializeDataset(ctx, dataset) {
|
|
|
253
263
|
return dataset;
|
|
254
264
|
const result = JSON.parse(JSON.stringify(dataset));
|
|
255
265
|
Object.values(result.state).forEach((state) => {
|
|
256
|
-
var _a, _b;
|
|
266
|
+
var _a, _b, _c, _d;
|
|
257
267
|
if (state.varType !== 'datasource')
|
|
258
268
|
return;
|
|
259
269
|
if ((_a = state.initMethod) === null || _a === void 0 ? void 0 : _a.params) {
|
|
260
|
-
state.initMethod.params =
|
|
270
|
+
state.initMethod.params = (_b = serializeDynamicMapWithExtra({
|
|
261
271
|
ctx,
|
|
262
272
|
map: state.initMethod.params,
|
|
263
|
-
});
|
|
273
|
+
})) === null || _b === void 0 ? void 0 : _b.data;
|
|
264
274
|
}
|
|
265
|
-
if ((
|
|
266
|
-
state.updateMethod.params =
|
|
275
|
+
if ((_c = state.updateMethod) === null || _c === void 0 ? void 0 : _c.params) {
|
|
276
|
+
state.updateMethod.params = (_d = serializeDynamicMapWithExtra({
|
|
267
277
|
ctx,
|
|
268
278
|
map: state.updateMethod.params,
|
|
269
|
-
});
|
|
279
|
+
})) === null || _d === void 0 ? void 0 : _d.data;
|
|
270
280
|
}
|
|
271
281
|
});
|
|
272
282
|
return result;
|
|
@@ -376,10 +386,10 @@ function serializeListener(ctx, listener) {
|
|
|
376
386
|
module: /^comp\-\w+$/.test(listener.handler.moduleName)
|
|
377
387
|
? '$comp'
|
|
378
388
|
: listener.handler.moduleName,
|
|
379
|
-
params:
|
|
389
|
+
params: serializeDynamicMapWithExtra({
|
|
380
390
|
ctx,
|
|
381
391
|
map: listener.data,
|
|
382
|
-
}),
|
|
392
|
+
}).data,
|
|
383
393
|
},
|
|
384
394
|
isCapturePhase: listener.isCapturePhase,
|
|
385
395
|
};
|
|
@@ -491,45 +501,59 @@ function serializeComponent(ctx, component, scope = 'page') {
|
|
|
491
501
|
if (componentCtx.dependencies && !componentCtx.dependenciesMap) {
|
|
492
502
|
componentCtx.dependenciesMap = processDependenciesMap(componentCtx.dependencies || []);
|
|
493
503
|
}
|
|
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
|
+
}
|
|
494
528
|
return {
|
|
495
529
|
id: component.id,
|
|
496
530
|
type: undefined,
|
|
497
531
|
module: serializeModuleName(componentCtx, moduleName, componentName),
|
|
498
532
|
component: componentName,
|
|
499
533
|
attributes: (0, runtime_1.getValidValue)(component.xProps
|
|
500
|
-
? Object.assign(Object.assign({},
|
|
534
|
+
? Object.assign(Object.assign({}, attributes), { style: (_h = component.xProps) === null || _h === void 0 ? void 0 : _h.style, class: (_k = (_j = component.xProps) === null || _j === void 0 ? void 0 : _j.classList) === null || _k === void 0 ? void 0 : _k.join(' ') }) : undefined),
|
|
501
535
|
items: component.properties
|
|
502
536
|
? Object.keys(component.properties).map((key) => {
|
|
503
537
|
var _a;
|
|
504
538
|
return serializeComponent(componentCtx, Object.assign({ id: key }, (_a = component.properties) === null || _a === void 0 ? void 0 : _a[key]), scope);
|
|
505
539
|
})
|
|
506
540
|
: undefined,
|
|
507
|
-
listeners: (0, runtime_1.getValidValue)((
|
|
541
|
+
listeners: (0, runtime_1.getValidValue)((_m = (_l = component.xProps) === null || _l === void 0 ? void 0 : _l.listeners) === null || _m === void 0 ? void 0 : _m.map((listener) => {
|
|
508
542
|
return serializeListener(componentCtx, listener);
|
|
509
543
|
})),
|
|
510
|
-
directives: serializeDirecties(componentCtx, (((
|
|
544
|
+
directives: serializeDirecties(componentCtx, (((_o = component.xProps) === null || _o === void 0 ? void 0 : _o.directives) || {}), scope) || {
|
|
511
545
|
':if': true,
|
|
512
546
|
},
|
|
513
|
-
':class':
|
|
514
|
-
|
|
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,
|
|
547
|
+
':class': classListBindData ? classListBindData.value : undefined,
|
|
548
|
+
':style': styleBindData ? styleBindData.value : undefined,
|
|
528
549
|
extra: {
|
|
529
550
|
commonStyle: (_p = component.xProps) === null || _p === void 0 ? void 0 : _p.commonStyle,
|
|
530
551
|
xIndex: component.xIndex,
|
|
531
552
|
styleBindPath: (_q = component === null || component === void 0 ? void 0 : component.xProps) === null || _q === void 0 ? void 0 : _q.styleBindPath,
|
|
532
553
|
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,
|
|
533
557
|
},
|
|
534
558
|
};
|
|
535
559
|
}
|
|
@@ -537,11 +561,14 @@ exports.serializeComponent = serializeComponent;
|
|
|
537
561
|
function deserializeComponent(ctx, components) {
|
|
538
562
|
let componentMap = components.reduce((map, item) => {
|
|
539
563
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
564
|
+
const { attributeExtraData = {} } = item.extra;
|
|
540
565
|
let dynamicStyle = item[':style']
|
|
541
|
-
? deserializeValue(ctx, ':style', item[':style']
|
|
566
|
+
? deserializeValue(ctx, ':style', item[':style'], attributeExtraData['style'] // 此处就是 style,取的是原始的属性
|
|
567
|
+
).value
|
|
542
568
|
: undefined;
|
|
543
569
|
let dynamicClassList = item[':class']
|
|
544
|
-
? deserializeValue(ctx, ':class', item[':class']
|
|
570
|
+
? deserializeValue(ctx, ':class', item[':class'], attributeExtraData['class'] // 此处就是 class,取的是原始的属性
|
|
571
|
+
).value
|
|
545
572
|
: undefined;
|
|
546
573
|
const xComponent = {
|
|
547
574
|
moduleName: item.module,
|
|
@@ -553,7 +580,7 @@ function deserializeComponent(ctx, components) {
|
|
|
553
580
|
xComponent.moduleName;
|
|
554
581
|
}
|
|
555
582
|
const xProps = {
|
|
556
|
-
data: deserializeAttributes(ctx, item.attributes),
|
|
583
|
+
data: deserializeAttributes(ctx, item.attributes, attributeExtraData),
|
|
557
584
|
directives: deserializeDirecties(ctx, item.directives || {}),
|
|
558
585
|
style: (_a = item.attributes) === null || _a === void 0 ? void 0 : _a.style,
|
|
559
586
|
styleBind: dynamicStyle
|
|
@@ -562,9 +589,6 @@ function deserializeComponent(ctx, components) {
|
|
|
562
589
|
value: dynamicStyle.value,
|
|
563
590
|
}
|
|
564
591
|
: undefined,
|
|
565
|
-
// styleBindPath: item.styleBindPath
|
|
566
|
-
// ? deserializeValue('styleBindPath', item.styleBindPath).value
|
|
567
|
-
// : undefined, // 含义未知
|
|
568
592
|
commonStyle: (_b = item === null || item === void 0 ? void 0 : item.extra) === null || _b === void 0 ? void 0 : _b.commonStyle,
|
|
569
593
|
staticResourceAttribute: (_c = item === null || item === void 0 ? void 0 : item.extra) === null || _c === void 0 ? void 0 : _c.staticResourceAttribute,
|
|
570
594
|
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),
|
|
@@ -616,7 +640,7 @@ function serializePage(ctx, page) {
|
|
|
616
640
|
id: page.id,
|
|
617
641
|
type: 'PAGE',
|
|
618
642
|
component: 'Page',
|
|
619
|
-
attributes: (0, runtime_1.getValidValue)(
|
|
643
|
+
attributes: (0, runtime_1.getValidValue)(serializeAttributesWithExtra(pageCtx, 'page', page.data).data),
|
|
620
644
|
items: Object.keys(page.componentInstances || {}).map((id) => {
|
|
621
645
|
return serializeComponent(pageCtx, Object.assign({ id }, page.componentInstances[id]));
|
|
622
646
|
}),
|
|
@@ -630,7 +654,6 @@ function serializePage(ctx, page) {
|
|
|
630
654
|
return serializeListener(pageCtx, item);
|
|
631
655
|
})),
|
|
632
656
|
extra: {
|
|
633
|
-
pluginInstances: page === null || page === void 0 ? void 0 : page.pluginInstances,
|
|
634
657
|
commonStyle: page === null || page === void 0 ? void 0 : page.commonStyle,
|
|
635
658
|
xIndex: page.xIndex,
|
|
636
659
|
staticResourceAttribute: page === null || page === void 0 ? void 0 : page.staticResourceAttribute,
|
|
@@ -666,9 +689,8 @@ function deserializePage(ctx, page) {
|
|
|
666
689
|
return deserializeDataVariables(pageCtx, item);
|
|
667
690
|
})) || [],
|
|
668
691
|
},
|
|
669
|
-
data: deserializeAttributes(pageCtx, page.attributes),
|
|
692
|
+
data: deserializeAttributes(pageCtx, page.attributes, (_b = page === null || page === void 0 ? void 0 : page.extra) === null || _b === void 0 ? void 0 : _b.attributeExtraData),
|
|
670
693
|
componentInstances: deserializeComponent(pageCtx, page.items || []),
|
|
671
|
-
pluginInstances: (_b = page.extra) === null || _b === void 0 ? void 0 : _b.pluginInstances,
|
|
672
694
|
commonStyle: (_c = page === null || page === void 0 ? void 0 : page.extra) === null || _c === void 0 ? void 0 : _c.commonStyle,
|
|
673
695
|
staticResourceAttribute: (_d = page === null || page === void 0 ? void 0 : page.extra) === null || _d === void 0 ? void 0 : _d.staticResourceAttribute,
|
|
674
696
|
hideAdminPortalMenu: (_e = page === null || page === void 0 ? void 0 : page.extra) === null || _e === void 0 ? void 0 : _e.hideAdminPortalMenu,
|
|
@@ -782,7 +804,7 @@ function serializeRuntimePage(ctx, page //IPageInstance
|
|
|
782
804
|
id: page.id,
|
|
783
805
|
type: 'PAGE',
|
|
784
806
|
component: 'Page',
|
|
785
|
-
attributes:
|
|
807
|
+
attributes: serializeAttributesWithExtra(pageCtx, 'page', (0, runtime_1.readDynamicData)(page)).data,
|
|
786
808
|
items: (0, runtime_1.getValidValue)(Object.keys(((_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties) || {}).map((id) => {
|
|
787
809
|
var _a;
|
|
788
810
|
return serializeRuntimeComponent(pageCtx, Object.assign({ id }, (_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties[id]));
|
|
@@ -794,7 +816,6 @@ function serializeRuntimePage(ctx, page //IPageInstance
|
|
|
794
816
|
return serializeListener(pageCtx, item);
|
|
795
817
|
})),
|
|
796
818
|
extra: {
|
|
797
|
-
pluginInstances: (0, runtime_1.getValidValue)(page === null || page === void 0 ? void 0 : page.pluginInstances),
|
|
798
819
|
commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(page.style)),
|
|
799
820
|
styleBindPath: (0, runtime_1.getValidValue)(page.styleBindPath),
|
|
800
821
|
xIndex: page.xIndex,
|
|
@@ -854,33 +875,48 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
|
|
|
854
875
|
.filter((dataType) => dataType.type !== 'slot')
|
|
855
876
|
.map((dataType) => dataType.propertyPath);
|
|
856
877
|
let properties = component.properties || {};
|
|
857
|
-
|
|
878
|
+
const { data: attributes = {}, extra: attributeExtraData = {}, } = serializeAttributesWithExtra(componentCtx, 'page', (0, runtime_1.getValidValue)((0, runtime_1.readDynamicData)(props)) || {});
|
|
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)
|
|
858
909
|
.filter((key) => !excludeKeys.includes(key))
|
|
859
|
-
.map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, properties[key])))), listeners: (
|
|
910
|
+
.map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, properties[key])))), listeners: (_c = (0, runtime_1.getValidValue)((0, runtime_1.readListeners)(props.listenerInstances))) === null || _c === void 0 ? void 0 : _c.map((listener /* IEventListener */) => {
|
|
860
911
|
return serializeListener(componentCtx, listener);
|
|
861
|
-
}), directives: serializeDirecties(componentCtx, ((0, runtime_1.getValidValue)((0, runtime_1.readDirectives)(props)) || {})) || undefined, ':class': (0
|
|
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: {
|
|
912
|
+
}), directives: serializeDirecties(componentCtx, ((0, runtime_1.getValidValue)((0, runtime_1.readDirectives)(props)) || {})) || undefined, ':class': (classListBindData === null || classListBindData === void 0 ? void 0 : classListBindData.value) || undefined, ':style': (styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.value) || undefined, extra: {
|
|
880
913
|
commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(props.commonStyle)),
|
|
881
914
|
xIndex: (0, runtime_1.getValidValue)(component['x-index']),
|
|
882
915
|
styleBindPath: (0, runtime_1.getValidValue)(props.styleBindPath),
|
|
883
916
|
staticResourceAttribute: (0, runtime_1.getValidValue)(props.staticResourceAttribute),
|
|
917
|
+
attributeExtraData: (0, common_3.isEmptyObj)(attributeExtraData)
|
|
918
|
+
? undefined
|
|
919
|
+
: attributeExtraData,
|
|
884
920
|
} });
|
|
885
921
|
}
|
|
886
922
|
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.params:
|
|
112
112
|
case expression_1.PropBindType.stateData: {
|
|
113
113
|
const TYPE_MAP = {
|
|
114
|
-
[expression_1.PropBindType.
|
|
114
|
+
[expression_1.PropBindType.params]: 'params',
|
|
115
115
|
[expression_1.PropBindType.stateData]: 'state',
|
|
116
116
|
};
|
|
117
117
|
const type = TYPE_MAP[res.type];
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { IDynamicValue } from '../../expression';
|
|
1
2
|
export declare function readComponents(properties?: {
|
|
2
3
|
[key: string]: any;
|
|
3
4
|
}, excludeKeys?: string[]): Object;
|
|
4
5
|
export declare function readDirectives(cmp: any): any;
|
|
5
|
-
export declare function readDynamicData(cmp: any):
|
|
6
|
+
export declare function readDynamicData(cmp: any): {
|
|
7
|
+
[key: string]: IDynamicValue;
|
|
8
|
+
};
|
|
6
9
|
export declare function readListeners(listenerInstances?: any[]): any;
|
|
7
10
|
export declare function writeListeners(listeners?: any[]): any[];
|
|
8
11
|
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":"AAAA,OAAO,EAAE,aAAa,EAA2B,MAAM,kBAAkB,CAAA;AAUzE,wBAAgB,cAAc,CAC5B,UAAU,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAmB,EACnD,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,CAiER;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,OAwCtC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CA+B1E;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,OAkExE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAKjE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,OAWvC"}
|