@cloudbase/cals 1.0.32 → 1.0.34-beta.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPlatformDataset, IPlatformListener } from '../../types/platform/common';
|
|
2
2
|
import { IAttributes, IPlatformApp, IPageComponent, IPlatformComponent, IDataSourceVariable, IDataVarMethod, // 勿删,为了生成d.ts
|
|
3
3
|
IPlatformDataSource, IDependencies, LCDS } from '../../types';
|
|
4
4
|
import { IDynamicValue, PropBindType } from '../expression';
|
|
@@ -82,6 +82,12 @@ export declare function deserializeAttributes(ctx: IDeserializeContext, attribut
|
|
|
82
82
|
* 目前仅转换 state 中的 initMethod.params 和 updateMethod.params
|
|
83
83
|
*/
|
|
84
84
|
export declare function serializeDataset(ctx: ISerializeContext, dataset: any): any;
|
|
85
|
+
/**
|
|
86
|
+
* 反序列化布局模板
|
|
87
|
+
* @param ctx
|
|
88
|
+
* @param templates
|
|
89
|
+
*/
|
|
90
|
+
export declare function deserializeTemplates(ctx: IDeserializeContext, templates: any): {};
|
|
85
91
|
/**
|
|
86
92
|
* 将dataset({state: {}, params: {}})从 cals 结构转换为weapp结构
|
|
87
93
|
* 目前仅转换 state 中的 initMethod.params 和 updateMethod.params
|
|
@@ -137,6 +143,26 @@ export declare function deserializeComponent(ctx: IDeserializeContext, component
|
|
|
137
143
|
[key: string]: object;
|
|
138
144
|
};
|
|
139
145
|
export declare function serializePage(ctx: Pick<ISerializeContext, 'app' | 'dependencies' | 'dependenciesMap'>, page: any): IPageComponent;
|
|
146
|
+
/**
|
|
147
|
+
* 序列化布局
|
|
148
|
+
*/
|
|
149
|
+
export declare function serializeLayouts(ctx: ISerializeContext, layouts?: {
|
|
150
|
+
[key: string]: {
|
|
151
|
+
data?: string;
|
|
152
|
+
name?: string;
|
|
153
|
+
label?: string;
|
|
154
|
+
};
|
|
155
|
+
}): {
|
|
156
|
+
name: string;
|
|
157
|
+
label: string;
|
|
158
|
+
data: {};
|
|
159
|
+
id: string;
|
|
160
|
+
items?: IPlatformComponent[];
|
|
161
|
+
dataset?: IPlatformDataset;
|
|
162
|
+
module?: string;
|
|
163
|
+
':class'?: string;
|
|
164
|
+
':style'?: string;
|
|
165
|
+
}[];
|
|
140
166
|
export declare function deserializePage(ctx: {
|
|
141
167
|
dependencies: IDeserializeContext['dependencies'];
|
|
142
168
|
homePageId: string;
|
|
@@ -209,6 +235,7 @@ export declare function deserializePage(ctx: {
|
|
|
209
235
|
* [WeApps协议] to [CALS协议]
|
|
210
236
|
*
|
|
211
237
|
* @param data
|
|
238
|
+
* @param optsions
|
|
212
239
|
*/
|
|
213
240
|
export declare function serializePlatformApp(data: any, optsions: {
|
|
214
241
|
dependencies: object[];
|
|
@@ -356,6 +383,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
356
383
|
};
|
|
357
384
|
dependencies: IDependencies;
|
|
358
385
|
schemaVersion: string;
|
|
386
|
+
layouts: {};
|
|
359
387
|
};
|
|
360
388
|
declare type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
|
|
361
389
|
export declare function deserializeCompositeComponent(component: ArrayElement<IPlatformApp['templates']>, options: any): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAuC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAuC,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEvH,OAAO,EACL,WAAW,EACX,YAAY,EAGZ,cAAc,EACd,kBAAkB,EAElB,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EAEL,MA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AM;sBACH,MAAM;;;6BACwB,OAAO;;;wBACnC,MAAM;;;;;;EAiCvB;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,SAAS,EAAE,GAA4B,EACvC,KAAK,EAAE,MAAM,OAkCd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,SAAK,EACZ,YAAY,QAAK,GAChB;IACD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,EAAE,OAAO,CAAC;CAClC,CA+BA;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,iBAAiB,EAAE,EAC9B,OAAO,CAAC,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAC5B;IACD,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,UAAU,EAAE,UAAU,EAAE,CAAC;CAC1B,CA4DA;AAED,wBAAgB,6BAA6B,CAAC,YAAY,GAAE,aAAkB,MAQ7E;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,UAWvD;AAED,wBAAgB,+BAA+B,CAAC,SAAS,QAAK;;;;;;;;;;;;;;;;;QA4BtD;;;WAGG;;;;;;;EAcV"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.processTemplatesToDependiencies = exports.parseDependenciesVersion = exports.processDependenciesVersionMap = exports.processListeners = exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimeDataset = exports.serializeRuntimePage = exports.deserializeCompositeComponent = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = exports.serializeDataset = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
|
|
17
|
+
exports.processTemplatesToDependiencies = exports.parseDependenciesVersion = exports.processDependenciesVersionMap = exports.processListeners = exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimeDataset = exports.serializeRuntimePage = exports.deserializeCompositeComponent = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializeLayouts = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = exports.deserializeTemplates = exports.serializeDataset = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
|
|
18
18
|
const get_1 = __importDefault(require("lodash/get"));
|
|
19
19
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
20
20
|
const unset_1 = __importDefault(require("lodash/unset"));
|
|
@@ -393,6 +393,30 @@ function serializeDataset(ctx, dataset) {
|
|
|
393
393
|
return result;
|
|
394
394
|
}
|
|
395
395
|
exports.serializeDataset = serializeDataset;
|
|
396
|
+
/**
|
|
397
|
+
* 反序列化布局模板
|
|
398
|
+
* @param ctx
|
|
399
|
+
* @param templates
|
|
400
|
+
*/
|
|
401
|
+
function deserializeTemplates(ctx, templates) {
|
|
402
|
+
const layout = {};
|
|
403
|
+
templates.forEach((template) => {
|
|
404
|
+
const { listeners = [] } = processListeners((template === null || template === void 0 ? void 0 : template.listeners) || []);
|
|
405
|
+
layout[template.id] = {
|
|
406
|
+
id: template.id,
|
|
407
|
+
name: template.name,
|
|
408
|
+
label: template.label,
|
|
409
|
+
data: (template === null || template === void 0 ? void 0 : template.data) || {},
|
|
410
|
+
dataset: deserializeDataset(ctx, template.dataset),
|
|
411
|
+
componentInstances: deserializeComponent(ctx, template.items || []),
|
|
412
|
+
listeners: (listeners === null || listeners === void 0 ? void 0 : listeners.map((item) => {
|
|
413
|
+
return deserializeListener(ctx, item);
|
|
414
|
+
})) || [],
|
|
415
|
+
};
|
|
416
|
+
});
|
|
417
|
+
return layout;
|
|
418
|
+
}
|
|
419
|
+
exports.deserializeTemplates = deserializeTemplates;
|
|
396
420
|
/**
|
|
397
421
|
* 将dataset({state: {}, params: {}})从 cals 结构转换为weapp结构
|
|
398
422
|
* 目前仅转换 state 中的 initMethod.params 和 updateMethod.params
|
|
@@ -799,6 +823,19 @@ function serializePage(ctx, page) {
|
|
|
799
823
|
return processedPage;
|
|
800
824
|
}
|
|
801
825
|
exports.serializePage = serializePage;
|
|
826
|
+
/**
|
|
827
|
+
* 序列化布局
|
|
828
|
+
*/
|
|
829
|
+
function serializeLayouts(ctx, layouts = {}) {
|
|
830
|
+
return Object.entries(layouts).map(([layoutId, layout]) => {
|
|
831
|
+
var _a;
|
|
832
|
+
const layoutExtraDetail = { name: layout.name, label: layout.label };
|
|
833
|
+
const temp = Object.assign({}, serializePage(ctx, layout));
|
|
834
|
+
const { type, component, attributes, directives, resources, dataVariables, listeners, extra } = temp, rest = __rest(temp, ["type", "component", "attributes", "directives", "resources", "dataVariables", "listeners", "extra"]);
|
|
835
|
+
return Object.assign(Object.assign(Object.assign({}, rest), { data: (_a = layout === null || layout === void 0 ? void 0 : layout.data) !== null && _a !== void 0 ? _a : {} }), layoutExtraDetail);
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
exports.serializeLayouts = serializeLayouts;
|
|
802
839
|
function deserializePage(ctx, page) {
|
|
803
840
|
var _a, _b, _c, _d, _e;
|
|
804
841
|
const { homePageId } = ctx, _pageCtx = __rest(ctx, ["homePageId"]);
|
|
@@ -833,10 +870,11 @@ function deserializeInstance(ctx, instance, scope = 'page') {
|
|
|
833
870
|
* [WeApps协议] to [CALS协议]
|
|
834
871
|
*
|
|
835
872
|
* @param data
|
|
873
|
+
* @param optsions
|
|
836
874
|
*/
|
|
837
875
|
function serializePlatformApp(data, optsions) {
|
|
838
876
|
var _a;
|
|
839
|
-
let { version, author, name, label, description, selectedPageId, pageInstanceList, lowCodes = [], datasources, vars, dataset, extra, dependencies: calsDependencies, miniprogramPlugins, lastDependencies, externalResources, schemaVersion } = data, restData = __rest(data, ["version", "author", "name", "label", "description", "selectedPageId", "pageInstanceList", "lowCodes", "datasources", "vars", "dataset", "extra", "dependencies", "miniprogramPlugins", "lastDependencies", "externalResources", "schemaVersion"]);
|
|
877
|
+
let { version, author, name, label, description, selectedPageId, pageInstanceList, lowCodes = [], datasources, vars, dataset, extra, dependencies: calsDependencies, miniprogramPlugins, lastDependencies, externalResources, schemaVersion, layouts } = data, restData = __rest(data, ["version", "author", "name", "label", "description", "selectedPageId", "pageInstanceList", "lowCodes", "datasources", "vars", "dataset", "extra", "dependencies", "miniprogramPlugins", "lastDependencies", "externalResources", "schemaVersion", "layouts"]);
|
|
840
878
|
let { dependencies = [] } = optsions || {};
|
|
841
879
|
const _b = extra || {}, { name: extraName, label: extraLabel, author: extraAuthor, description: extraDescription } = _b, restExtra = __rest(_b, ["name", "label", "author", "description"]);
|
|
842
880
|
const ctx = {
|
|
@@ -860,6 +898,7 @@ function serializePlatformApp(data, optsions) {
|
|
|
860
898
|
dataset: serializeDataset(ctx, dataset),
|
|
861
899
|
dataVariables: (0, runtime_1.getValidValue)(vars === null || vars === void 0 ? void 0 : vars.data.map((item) => serializeDataVariables(ctx, item))),
|
|
862
900
|
dependencies: calsDependencies,
|
|
901
|
+
templates: serializeLayouts(ctx, layouts),
|
|
863
902
|
extra: Object.assign(Object.assign(Object.assign({}, restExtra), restData), { miniprogramPlugins, historyType: data.historyType, npmDependencies: data.npmDependencies || {}, plugins: data.plugins, maxID: data.maxID, rootPath: data.rootPath, themeVars: data.themeVars, presetColors: data.presetColors, appConfig: data.appConfig, lastDependencies }),
|
|
864
903
|
};
|
|
865
904
|
return processed;
|
|
@@ -917,6 +956,7 @@ function deserializePlatformApp(data, optsions) {
|
|
|
917
956
|
// TODO
|
|
918
957
|
// emitEvents: [], { "name": "自定义校验规则", "eventName": "validator" }
|
|
919
958
|
schemaVersion: data.schemaVersion,
|
|
959
|
+
layouts: deserializeTemplates(ctx, data.templates || []),
|
|
920
960
|
};
|
|
921
961
|
return processed;
|
|
922
962
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Basic from '../basic/common';
|
|
2
2
|
import { IDataSourceVariable } from './datasource';
|
|
3
3
|
import { IDataSourceQuery } from './query';
|
|
4
|
+
import { IPlatformComponent } from './component';
|
|
4
5
|
/** 变量 */
|
|
5
6
|
export interface IPlatformDataset extends Basic.IDataset {
|
|
6
7
|
/** 状态 */
|
|
@@ -116,6 +117,32 @@ export interface ICodeResource extends Basic.IResource {
|
|
|
116
117
|
*/
|
|
117
118
|
codeType?: string;
|
|
118
119
|
}
|
|
120
|
+
export interface ITemplate {
|
|
121
|
+
/**
|
|
122
|
+
* 必填,模板的唯一标识
|
|
123
|
+
*/
|
|
124
|
+
id: string;
|
|
125
|
+
/**
|
|
126
|
+
* 必填,模板的组件内容
|
|
127
|
+
*/
|
|
128
|
+
items: IPlatformComponent[];
|
|
129
|
+
/**
|
|
130
|
+
* 必填,数据
|
|
131
|
+
*/
|
|
132
|
+
data: {
|
|
133
|
+
properties: {
|
|
134
|
+
[key: string]: any;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* 必填,模板的名称
|
|
139
|
+
*/
|
|
140
|
+
name: string;
|
|
141
|
+
/**
|
|
142
|
+
* 可选,模板的label
|
|
143
|
+
*/
|
|
144
|
+
label?: string;
|
|
145
|
+
}
|
|
119
146
|
export interface ILibraryResource extends Basic.IResource {
|
|
120
147
|
type: 'LIBRARY';
|
|
121
148
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/platform/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/platform/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,SAAS;AACT,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,QAAQ;IACtD,SAAS;IACT,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,GAAG,mBAAmB,CAAC,CAAC;IACnE,eAAe;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAC/C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;CAGhB,CAAC;AAEX,oBAAY,SAAS;IACnB;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,SAAS,aAAa;IACtB;;;OAGG;IACH,UAAU,eAAe;IACzB;;;OAGG;IACH,aAAa,kB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