@cloudbase/cals 0.3.21 → 0.3.22-alpha.3
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 +133 -96
- 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,CA8HrC;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 === null || extraMap === void 0 ? void 0 : 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,25 @@ 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
|
-
|
|
227
|
+
var _a;
|
|
228
|
+
return (_a = serializeAttributesWithExtra(ctx, scope, attributes)) === null || _a === void 0 ? void 0 : _a.data;
|
|
229
|
+
}
|
|
230
|
+
exports.serializeAttributes = serializeAttributes;
|
|
231
|
+
function serializeAttributesWithExtra(ctx, scope, attributes = {}) {
|
|
232
|
+
return serializeDynamicMapWithExtra({
|
|
221
233
|
ctx,
|
|
222
234
|
scope,
|
|
223
235
|
map: attributes,
|
|
224
236
|
streamlineDefaultValue: ctx.streamlineDefaultValue,
|
|
225
237
|
});
|
|
226
238
|
}
|
|
227
|
-
|
|
228
|
-
function deserializeAttributes(ctx, attributes = {}) {
|
|
239
|
+
function deserializeAttributes(ctx, attributes = {}, attributesExtraData = {}) {
|
|
229
240
|
const reservedAttributes = ['style', 'commonStyle', 'class'];
|
|
230
241
|
const reservedAttributesMap = reservedAttributes.reduce((map, key) => {
|
|
231
242
|
map[key] = true;
|
|
@@ -241,7 +252,7 @@ function deserializeAttributes(ctx, attributes = {}) {
|
|
|
241
252
|
restAttributes[key] = attributes[key];
|
|
242
253
|
}
|
|
243
254
|
}
|
|
244
|
-
return deserializeDynamicMap(ctx, restAttributes);
|
|
255
|
+
return deserializeDynamicMap(ctx, restAttributes, attributesExtraData);
|
|
245
256
|
}
|
|
246
257
|
exports.deserializeAttributes = deserializeAttributes;
|
|
247
258
|
/**
|
|
@@ -253,20 +264,20 @@ function serializeDataset(ctx, dataset) {
|
|
|
253
264
|
return dataset;
|
|
254
265
|
const result = JSON.parse(JSON.stringify(dataset));
|
|
255
266
|
Object.values(result.state).forEach((state) => {
|
|
256
|
-
var _a, _b;
|
|
267
|
+
var _a, _b, _c, _d;
|
|
257
268
|
if (state.varType !== 'datasource')
|
|
258
269
|
return;
|
|
259
270
|
if ((_a = state.initMethod) === null || _a === void 0 ? void 0 : _a.params) {
|
|
260
|
-
state.initMethod.params =
|
|
271
|
+
state.initMethod.params = (_b = serializeDynamicMapWithExtra({
|
|
261
272
|
ctx,
|
|
262
273
|
map: state.initMethod.params,
|
|
263
|
-
});
|
|
274
|
+
})) === null || _b === void 0 ? void 0 : _b.data;
|
|
264
275
|
}
|
|
265
|
-
if ((
|
|
266
|
-
state.updateMethod.params =
|
|
276
|
+
if ((_c = state.updateMethod) === null || _c === void 0 ? void 0 : _c.params) {
|
|
277
|
+
state.updateMethod.params = (_d = serializeDynamicMapWithExtra({
|
|
267
278
|
ctx,
|
|
268
279
|
map: state.updateMethod.params,
|
|
269
|
-
});
|
|
280
|
+
})) === null || _d === void 0 ? void 0 : _d.data;
|
|
270
281
|
}
|
|
271
282
|
});
|
|
272
283
|
return result;
|
|
@@ -376,10 +387,10 @@ function serializeListener(ctx, listener) {
|
|
|
376
387
|
module: /^comp\-\w+$/.test(listener.handler.moduleName)
|
|
377
388
|
? '$comp'
|
|
378
389
|
: listener.handler.moduleName,
|
|
379
|
-
params:
|
|
390
|
+
params: serializeDynamicMapWithExtra({
|
|
380
391
|
ctx,
|
|
381
392
|
map: listener.data,
|
|
382
|
-
}),
|
|
393
|
+
}).data,
|
|
383
394
|
},
|
|
384
395
|
isCapturePhase: listener.isCapturePhase,
|
|
385
396
|
};
|
|
@@ -491,45 +502,59 @@ function serializeComponent(ctx, component, scope = 'page') {
|
|
|
491
502
|
if (componentCtx.dependencies && !componentCtx.dependenciesMap) {
|
|
492
503
|
componentCtx.dependenciesMap = processDependenciesMap(componentCtx.dependencies || []);
|
|
493
504
|
}
|
|
505
|
+
const { data: attributes = {}, extra: attributeExtraData = {} } = serializeAttributesWithExtra(componentCtx, scope, (component.xProps.data || {})) || {};
|
|
506
|
+
let classListBindData = null;
|
|
507
|
+
let styleBindData = null;
|
|
508
|
+
if ((_d = component === null || component === void 0 ? void 0 : component.xProps) === null || _d === void 0 ? void 0 : _d.classListBind) {
|
|
509
|
+
classListBindData = serializeValue({
|
|
510
|
+
ctx: componentCtx,
|
|
511
|
+
key: 'classListBind',
|
|
512
|
+
dynamicValue: (_e = component === null || component === void 0 ? void 0 : component.xProps) === null || _e === void 0 ? void 0 : _e.classListBind,
|
|
513
|
+
scope,
|
|
514
|
+
});
|
|
515
|
+
if (classListBindData.extra) {
|
|
516
|
+
attributeExtraData['class'] = classListBindData.extra;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
if ((_f = component === null || component === void 0 ? void 0 : component.xProps) === null || _f === void 0 ? void 0 : _f.styleBind) {
|
|
520
|
+
styleBindData = serializeValue({
|
|
521
|
+
ctx: componentCtx,
|
|
522
|
+
key: 'styleBind',
|
|
523
|
+
dynamicValue: (_g = component === null || component === void 0 ? void 0 : component.xProps) === null || _g === void 0 ? void 0 : _g.styleBind,
|
|
524
|
+
});
|
|
525
|
+
if (styleBindData.extra) {
|
|
526
|
+
attributeExtraData['style'] = styleBindData.extra;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
494
529
|
return {
|
|
495
530
|
id: component.id,
|
|
496
531
|
type: undefined,
|
|
497
532
|
module: serializeModuleName(componentCtx, moduleName, componentName),
|
|
498
533
|
component: componentName,
|
|
499
534
|
attributes: (0, runtime_1.getValidValue)(component.xProps
|
|
500
|
-
? Object.assign(Object.assign({},
|
|
535
|
+
? 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
536
|
items: component.properties
|
|
502
537
|
? Object.keys(component.properties).map((key) => {
|
|
503
538
|
var _a;
|
|
504
539
|
return serializeComponent(componentCtx, Object.assign({ id: key }, (_a = component.properties) === null || _a === void 0 ? void 0 : _a[key]), scope);
|
|
505
540
|
})
|
|
506
541
|
: undefined,
|
|
507
|
-
listeners: (0, runtime_1.getValidValue)((
|
|
542
|
+
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
543
|
return serializeListener(componentCtx, listener);
|
|
509
544
|
})),
|
|
510
|
-
directives: serializeDirecties(componentCtx, (((
|
|
545
|
+
directives: serializeDirecties(componentCtx, (((_o = component.xProps) === null || _o === void 0 ? void 0 : _o.directives) || {}), scope) || {
|
|
511
546
|
':if': true,
|
|
512
547
|
},
|
|
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,
|
|
548
|
+
':class': classListBindData ? classListBindData.value : undefined,
|
|
549
|
+
':style': styleBindData ? styleBindData.value : undefined,
|
|
528
550
|
extra: {
|
|
529
551
|
commonStyle: (_p = component.xProps) === null || _p === void 0 ? void 0 : _p.commonStyle,
|
|
530
552
|
xIndex: component.xIndex,
|
|
531
553
|
styleBindPath: (_q = component === null || component === void 0 ? void 0 : component.xProps) === null || _q === void 0 ? void 0 : _q.styleBindPath,
|
|
532
554
|
staticResourceAttribute: (_r = component === null || component === void 0 ? void 0 : component.xProps) === null || _r === void 0 ? void 0 : _r.staticResourceAttribute,
|
|
555
|
+
attributeExtraData: (0, common_3.isEmptyObj)(attributeExtraData)
|
|
556
|
+
? undefined
|
|
557
|
+
: attributeExtraData,
|
|
533
558
|
},
|
|
534
559
|
};
|
|
535
560
|
}
|
|
@@ -537,11 +562,14 @@ exports.serializeComponent = serializeComponent;
|
|
|
537
562
|
function deserializeComponent(ctx, components) {
|
|
538
563
|
let componentMap = components.reduce((map, item) => {
|
|
539
564
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
565
|
+
const { attributeExtraData = {} } = item.extra || {};
|
|
540
566
|
let dynamicStyle = item[':style']
|
|
541
|
-
? deserializeValue(ctx, ':style', item[':style']
|
|
567
|
+
? deserializeValue(ctx, ':style', item[':style'], attributeExtraData['style'] // 此处就是 style,取的是原始的属性
|
|
568
|
+
).value
|
|
542
569
|
: undefined;
|
|
543
570
|
let dynamicClassList = item[':class']
|
|
544
|
-
? deserializeValue(ctx, ':class', item[':class']
|
|
571
|
+
? deserializeValue(ctx, ':class', item[':class'], attributeExtraData['class'] // 此处就是 class,取的是原始的属性
|
|
572
|
+
).value
|
|
545
573
|
: undefined;
|
|
546
574
|
const xComponent = {
|
|
547
575
|
moduleName: item.module,
|
|
@@ -553,7 +581,7 @@ function deserializeComponent(ctx, components) {
|
|
|
553
581
|
xComponent.moduleName;
|
|
554
582
|
}
|
|
555
583
|
const xProps = {
|
|
556
|
-
data: deserializeAttributes(ctx, item.attributes),
|
|
584
|
+
data: deserializeAttributes(ctx, item.attributes, attributeExtraData),
|
|
557
585
|
directives: deserializeDirecties(ctx, item.directives || {}),
|
|
558
586
|
style: (_a = item.attributes) === null || _a === void 0 ? void 0 : _a.style,
|
|
559
587
|
styleBind: dynamicStyle
|
|
@@ -562,9 +590,6 @@ function deserializeComponent(ctx, components) {
|
|
|
562
590
|
value: dynamicStyle.value,
|
|
563
591
|
}
|
|
564
592
|
: undefined,
|
|
565
|
-
// styleBindPath: item.styleBindPath
|
|
566
|
-
// ? deserializeValue('styleBindPath', item.styleBindPath).value
|
|
567
|
-
// : undefined, // 含义未知
|
|
568
593
|
commonStyle: (_b = item === null || item === void 0 ? void 0 : item.extra) === null || _b === void 0 ? void 0 : _b.commonStyle,
|
|
569
594
|
staticResourceAttribute: (_c = item === null || item === void 0 ? void 0 : item.extra) === null || _c === void 0 ? void 0 : _c.staticResourceAttribute,
|
|
570
595
|
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),
|
|
@@ -607,7 +632,7 @@ function deserializeComponent(ctx, components) {
|
|
|
607
632
|
}
|
|
608
633
|
exports.deserializeComponent = deserializeComponent;
|
|
609
634
|
function serializePage(ctx, page) {
|
|
610
|
-
var _a, _b, _c, _d;
|
|
635
|
+
var _a, _b, _c, _d, _e;
|
|
611
636
|
const pageCtx = Object.assign(Object.assign({}, ctx), { page });
|
|
612
637
|
if (pageCtx.dependencies && !pageCtx.dependenciesMap) {
|
|
613
638
|
pageCtx.dependenciesMap = processDependenciesMap(pageCtx.dependencies || []);
|
|
@@ -616,21 +641,20 @@ function serializePage(ctx, page) {
|
|
|
616
641
|
id: page.id,
|
|
617
642
|
type: 'PAGE',
|
|
618
643
|
component: 'Page',
|
|
619
|
-
attributes: (0, runtime_1.getValidValue)(
|
|
644
|
+
attributes: (0, runtime_1.getValidValue)((_a = serializeAttributesWithExtra(pageCtx, 'page', page.data)) === null || _a === void 0 ? void 0 : _a.data),
|
|
620
645
|
items: Object.keys(page.componentInstances || {}).map((id) => {
|
|
621
646
|
return serializeComponent(pageCtx, Object.assign({ id }, page.componentInstances[id]));
|
|
622
647
|
}),
|
|
623
648
|
directives: {
|
|
624
649
|
':if': true,
|
|
625
650
|
},
|
|
626
|
-
resources: (
|
|
651
|
+
resources: (_b = page === null || page === void 0 ? void 0 : page.lowCodes) === null || _b === void 0 ? void 0 : _b.map((item) => serializeCodeSource(pageCtx, item)),
|
|
627
652
|
dataset: serializeDataset(ctx, page === null || page === void 0 ? void 0 : page.dataset),
|
|
628
|
-
dataVariables: (0, runtime_1.getValidValue)((
|
|
629
|
-
listeners: (0, runtime_1.getValidValue)((
|
|
653
|
+
dataVariables: (0, runtime_1.getValidValue)((_d = (_c = page === null || page === void 0 ? void 0 : page.vars) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.map((item) => serializeDataVariables(pageCtx, item))),
|
|
654
|
+
listeners: (0, runtime_1.getValidValue)((_e = page === null || page === void 0 ? void 0 : page.listeners) === null || _e === void 0 ? void 0 : _e.map((item) => {
|
|
630
655
|
return serializeListener(pageCtx, item);
|
|
631
656
|
})),
|
|
632
657
|
extra: {
|
|
633
|
-
pluginInstances: page === null || page === void 0 ? void 0 : page.pluginInstances,
|
|
634
658
|
commonStyle: page === null || page === void 0 ? void 0 : page.commonStyle,
|
|
635
659
|
xIndex: page.xIndex,
|
|
636
660
|
staticResourceAttribute: page === null || page === void 0 ? void 0 : page.staticResourceAttribute,
|
|
@@ -666,9 +690,8 @@ function deserializePage(ctx, page) {
|
|
|
666
690
|
return deserializeDataVariables(pageCtx, item);
|
|
667
691
|
})) || [],
|
|
668
692
|
},
|
|
669
|
-
data: deserializeAttributes(pageCtx, page.attributes),
|
|
693
|
+
data: deserializeAttributes(pageCtx, page.attributes, (_b = page === null || page === void 0 ? void 0 : page.extra) === null || _b === void 0 ? void 0 : _b.attributeExtraData),
|
|
670
694
|
componentInstances: deserializeComponent(pageCtx, page.items || []),
|
|
671
|
-
pluginInstances: (_b = page.extra) === null || _b === void 0 ? void 0 : _b.pluginInstances,
|
|
672
695
|
commonStyle: (_c = page === null || page === void 0 ? void 0 : page.extra) === null || _c === void 0 ? void 0 : _c.commonStyle,
|
|
673
696
|
staticResourceAttribute: (_d = page === null || page === void 0 ? void 0 : page.extra) === null || _d === void 0 ? void 0 : _d.staticResourceAttribute,
|
|
674
697
|
hideAdminPortalMenu: (_e = page === null || page === void 0 ? void 0 : page.extra) === null || _e === void 0 ? void 0 : _e.hideAdminPortalMenu,
|
|
@@ -776,29 +799,28 @@ exports.deserializePlatformApp = deserializePlatformApp;
|
|
|
776
799
|
*/
|
|
777
800
|
function serializeRuntimePage(ctx, page //IPageInstance
|
|
778
801
|
) {
|
|
779
|
-
var _a, _b, _c, _d, _e;
|
|
802
|
+
var _a, _b, _c, _d, _e, _f;
|
|
780
803
|
const pageCtx = Object.assign(Object.assign({}, ctx), { dependenciesMap: processDependenciesMap(ctx.dependencies || []), page: { id: page.id } });
|
|
781
804
|
let processedPage = {
|
|
782
805
|
id: page.id,
|
|
783
806
|
type: 'PAGE',
|
|
784
807
|
component: 'Page',
|
|
785
|
-
attributes:
|
|
786
|
-
items: (0, runtime_1.getValidValue)(Object.keys(((
|
|
808
|
+
attributes: (_a = serializeAttributesWithExtra(pageCtx, 'page', (0, runtime_1.readDynamicData)(page))) === null || _a === void 0 ? void 0 : _a.data,
|
|
809
|
+
items: (0, runtime_1.getValidValue)(Object.keys(((_b = page.componentSchemaJson) === null || _b === void 0 ? void 0 : _b.properties) || {}).map((id) => {
|
|
787
810
|
var _a;
|
|
788
811
|
return serializeRuntimeComponent(pageCtx, Object.assign({ id }, (_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties[id]));
|
|
789
812
|
})),
|
|
790
|
-
resources: (
|
|
813
|
+
resources: (_c = page === null || page === void 0 ? void 0 : page.codeModules) === null || _c === void 0 ? void 0 : _c.map((item) => serializeCodeSource(pageCtx, item)),
|
|
791
814
|
dataset: page === null || page === void 0 ? void 0 : page.dataset,
|
|
792
|
-
dataVariables: (0, runtime_1.getValidValue)((
|
|
815
|
+
dataVariables: (0, runtime_1.getValidValue)((_e = (_d = page === null || page === void 0 ? void 0 : page.vars) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.map((item) => serializeDataVariables(pageCtx, item))),
|
|
793
816
|
listeners: (0, runtime_1.getValidValue)((0, runtime_1.readListeners)(page.listenerInstances || []).map((item) => {
|
|
794
817
|
return serializeListener(pageCtx, item);
|
|
795
818
|
})),
|
|
796
819
|
extra: {
|
|
797
|
-
pluginInstances: (0, runtime_1.getValidValue)(page === null || page === void 0 ? void 0 : page.pluginInstances),
|
|
798
820
|
commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(page.style)),
|
|
799
821
|
styleBindPath: (0, runtime_1.getValidValue)(page.styleBindPath),
|
|
800
822
|
xIndex: page.xIndex,
|
|
801
|
-
children: (0, runtime_1.getValidValue)((
|
|
823
|
+
children: (0, runtime_1.getValidValue)((_f = page.children) === null || _f === void 0 ? void 0 : _f.map((child) => serializeRuntimePage(ctx, child))),
|
|
802
824
|
},
|
|
803
825
|
};
|
|
804
826
|
if ((0, common_3.isValidStyleBind)(page.styleBind) && (0, runtime_1.getValidValue)(page.styleBind)) {
|
|
@@ -854,33 +876,48 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
|
|
|
854
876
|
.filter((dataType) => dataType.type !== 'slot')
|
|
855
877
|
.map((dataType) => dataType.propertyPath);
|
|
856
878
|
let properties = component.properties || {};
|
|
857
|
-
|
|
879
|
+
const { data: attributes = {}, extra: attributeExtraData = {} } = serializeAttributesWithExtra(componentCtx, 'page', (0, runtime_1.getValidValue)((0, runtime_1.readDynamicData)(props)) || {}) || {};
|
|
880
|
+
let styleBindData = null;
|
|
881
|
+
let classListBindData = null;
|
|
882
|
+
if ((_a = props === null || props === void 0 ? void 0 : props.styleBind) === null || _a === void 0 ? void 0 : _a.bindDataPath) {
|
|
883
|
+
styleBindData = serializeValue({
|
|
884
|
+
ctx: componentCtx,
|
|
885
|
+
key: 'styleBind',
|
|
886
|
+
dynamicValue: {
|
|
887
|
+
type: props.styleBind.type,
|
|
888
|
+
value: props.styleBind.bindDataPath,
|
|
889
|
+
extra: props.styleBind.extra,
|
|
890
|
+
},
|
|
891
|
+
});
|
|
892
|
+
if (styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.extra) {
|
|
893
|
+
attributeExtraData.style = styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.extra;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
if ((0, common_3.isValidClassNameListBind)(props.classNameListBind)) {
|
|
897
|
+
classListBindData = serializeValue({
|
|
898
|
+
ctx: componentCtx,
|
|
899
|
+
key: 'classListBind',
|
|
900
|
+
dynamicValue: (0, runtime_1.getValidValue)({
|
|
901
|
+
type: props.classNameListBind.type,
|
|
902
|
+
value: props.classNameListBind.bindDataPath,
|
|
903
|
+
}),
|
|
904
|
+
});
|
|
905
|
+
if (classListBindData === null || classListBindData === void 0 ? void 0 : classListBindData.extra) {
|
|
906
|
+
attributeExtraData.class = classListBindData === null || classListBindData === void 0 ? void 0 : classListBindData.extra;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
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
910
|
.filter((key) => !excludeKeys.includes(key))
|
|
859
|
-
.map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, properties[key])))), listeners: (
|
|
911
|
+
.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
912
|
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: {
|
|
913
|
+
}), 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
914
|
commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(props.commonStyle)),
|
|
881
915
|
xIndex: (0, runtime_1.getValidValue)(component['x-index']),
|
|
882
916
|
styleBindPath: (0, runtime_1.getValidValue)(props.styleBindPath),
|
|
883
917
|
staticResourceAttribute: (0, runtime_1.getValidValue)(props.staticResourceAttribute),
|
|
918
|
+
attributeExtraData: (0, common_3.isEmptyObj)(attributeExtraData)
|
|
919
|
+
? undefined
|
|
920
|
+
: attributeExtraData,
|
|
884
921
|
} });
|
|
885
922
|
}
|
|
886
923
|
else {
|