@cloudbase/cals 0.3.6 → 0.3.10-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 +1 -0
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +63 -51
- package/lib/parser/cals/utils/block/index.d.ts +15 -0
- package/lib/parser/cals/utils/block/index.d.ts.map +1 -0
- package/lib/parser/cals/utils/block/index.js +148 -0
- package/lib/parser/cals/utils/runtime.js +3 -3
- package/lib/parser/cals/utils/style.js +3 -3
- package/lib/parser/cals/utils/version/common.js +14 -14
- package/lib/parser/cals/utils/version/index.js +6 -6
- package/lib/parser/cals/utils/version/parses.js +24 -24
- package/lib/parser/cals/utils/version/utils.js +1 -1
- package/lib/parser/expression/index.d.ts +3 -1
- package/lib/parser/expression/index.d.ts.map +1 -1
- package/lib/parser/expression/index.js +14 -5
- package/lib/parser/index.d.ts +1 -0
- package/lib/parser/index.d.ts.map +1 -1
- package/lib/parser/index.js +3 -1
- package/lib/tsconfig.tsbuildinfo +1 -1636
- package/lib/types/platform/app.d.ts +24 -3
- package/lib/types/platform/app.d.ts.map +1 -1
- package/lib/types/platform/common.d.ts +40 -0
- package/lib/types/platform/common.d.ts.map +1 -1
- package/lib/types/platform/common.js +42 -1
- package/lib/types/platform/datasource.d.ts +1 -1
- package/lib/types/platform/datasource.d.ts.map +1 -1
- package/lib/utils/build.js +7 -7
- package/lib/utils/constant.d.ts +11 -0
- package/lib/utils/constant.d.ts.map +1 -0
- package/lib/utils/constant.js +13 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../parser/cals/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,YAAY,EAEZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,IAAI,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AAE;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;;sBAEH,MAAM;;;6BACwB,OAAO;;;;;;EA+BpD"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -156,9 +156,9 @@ function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultV
|
|
|
156
156
|
let matched = processedKey.match(/^:(.*)$/);
|
|
157
157
|
if (matched) {
|
|
158
158
|
const originValue = matched[1];
|
|
159
|
-
lodash_1.unset(data, originValue);
|
|
159
|
+
(0, lodash_1.unset)(data, originValue);
|
|
160
160
|
}
|
|
161
|
-
if (lodash_1.get(data, processedKey) == undefined) {
|
|
161
|
+
if ((0, lodash_1.get)(data, processedKey) == undefined) {
|
|
162
162
|
data[processedKey] = processedValue;
|
|
163
163
|
}
|
|
164
164
|
});
|
|
@@ -297,7 +297,8 @@ function deserializeDirecties(ctx, directives) {
|
|
|
297
297
|
let waIf = (directives === null || directives === void 0 ? void 0 : directives[':if']) != undefined
|
|
298
298
|
? deserializeValue(ctx, ':if', directives[':if']).value
|
|
299
299
|
: { value: true };
|
|
300
|
-
let waFor = (directives === null || directives === void 0 ? void 0 : directives[':for'])
|
|
300
|
+
let waFor = (directives === null || directives === void 0 ? void 0 : directives[':for'])
|
|
301
|
+
? deserializeValue(ctx, ':for', directives[':for']).value
|
|
301
302
|
: undefined;
|
|
302
303
|
if (waFor) {
|
|
303
304
|
let { type, value } = waFor;
|
|
@@ -451,7 +452,7 @@ function serializeComponent(ctx, component, scope = 'page') {
|
|
|
451
452
|
type: undefined,
|
|
452
453
|
module: serializeModuleName(componentCtx, moduleName, componentName),
|
|
453
454
|
component: componentName,
|
|
454
|
-
attributes: runtime_1.getValidValue(component.xProps
|
|
455
|
+
attributes: (0, runtime_1.getValidValue)(component.xProps
|
|
455
456
|
? 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),
|
|
456
457
|
items: component.properties
|
|
457
458
|
? Object.keys(component.properties).map((key) => {
|
|
@@ -459,24 +460,26 @@ function serializeComponent(ctx, component, scope = 'page') {
|
|
|
459
460
|
return serializeComponent(componentCtx, Object.assign({ id: key }, (_a = component.properties) === null || _a === void 0 ? void 0 : _a[key]), scope);
|
|
460
461
|
})
|
|
461
462
|
: undefined,
|
|
462
|
-
listeners: runtime_1.getValidValue((_h = (_g = component.xProps) === null || _g === void 0 ? void 0 : _g.listeners) === null || _h === void 0 ? void 0 : _h.map((listener) => {
|
|
463
|
+
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) => {
|
|
463
464
|
return serializeListener(componentCtx, listener);
|
|
464
465
|
})),
|
|
465
466
|
directives: serializeDirecties(componentCtx, (((_j = component.xProps) === null || _j === void 0 ? void 0 : _j.directives) || {}), scope) || {
|
|
466
467
|
':if': true,
|
|
467
468
|
},
|
|
468
|
-
':class': ((_k = component === null || component === void 0 ? void 0 : component.xProps) === null || _k === void 0 ? void 0 : _k.classListBind)
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
469
|
+
':class': ((_k = component === null || component === void 0 ? void 0 : component.xProps) === null || _k === void 0 ? void 0 : _k.classListBind)
|
|
470
|
+
? serializeValue({
|
|
471
|
+
ctx: componentCtx,
|
|
472
|
+
key: 'classListBind',
|
|
473
|
+
dynamicValue: (_l = component === null || component === void 0 ? void 0 : component.xProps) === null || _l === void 0 ? void 0 : _l.classListBind,
|
|
474
|
+
scope,
|
|
475
|
+
}).value
|
|
474
476
|
: undefined,
|
|
475
|
-
':style': ((_m = component === null || component === void 0 ? void 0 : component.xProps) === null || _m === void 0 ? void 0 : _m.styleBind)
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
477
|
+
':style': ((_m = component === null || component === void 0 ? void 0 : component.xProps) === null || _m === void 0 ? void 0 : _m.styleBind)
|
|
478
|
+
? serializeValue({
|
|
479
|
+
ctx: componentCtx,
|
|
480
|
+
key: 'styleBind',
|
|
481
|
+
dynamicValue: (_o = component === null || component === void 0 ? void 0 : component.xProps) === null || _o === void 0 ? void 0 : _o.styleBind,
|
|
482
|
+
}).value
|
|
480
483
|
: undefined,
|
|
481
484
|
extra: {
|
|
482
485
|
commonStyle: (_p = component.xProps) === null || _p === void 0 ? void 0 : _p.commonStyle,
|
|
@@ -539,7 +542,7 @@ function deserializeComponent(ctx, components) {
|
|
|
539
542
|
if (Array.isArray(item)) {
|
|
540
543
|
return !!item.length;
|
|
541
544
|
}
|
|
542
|
-
return item != undefined && !common_2.isEmptyObj(item);
|
|
545
|
+
return item != undefined && !(0, common_2.isEmptyObj)(item);
|
|
543
546
|
})
|
|
544
547
|
? xProps
|
|
545
548
|
: undefined,
|
|
@@ -547,7 +550,8 @@ function deserializeComponent(ctx, components) {
|
|
|
547
550
|
* TODO
|
|
548
551
|
*/
|
|
549
552
|
xIndex: ((_h = item.extra) === null || _h === void 0 ? void 0 : _h.xIndex) !== undefined
|
|
550
|
-
? (_j = item.extra) === null || _j === void 0 ? void 0 : _j.xIndex
|
|
553
|
+
? (_j = item.extra) === null || _j === void 0 ? void 0 : _j.xIndex
|
|
554
|
+
: undefined /*0*/,
|
|
551
555
|
properties: item.items
|
|
552
556
|
? deserializeComponent(ctx, item.items)
|
|
553
557
|
: undefined,
|
|
@@ -568,7 +572,7 @@ function serializePage(ctx, page) {
|
|
|
568
572
|
id: page.id,
|
|
569
573
|
type: types_1.EComponentType.PAGE,
|
|
570
574
|
component: 'Page',
|
|
571
|
-
attributes: runtime_1.getValidValue(serializeAttributes(pageCtx, 'page', page.data)),
|
|
575
|
+
attributes: (0, runtime_1.getValidValue)(serializeAttributes(pageCtx, 'page', page.data)),
|
|
572
576
|
items: Object.keys(page.componentInstances || {}).map((id) => {
|
|
573
577
|
return serializeComponent(pageCtx, Object.assign({ id }, page.componentInstances[id]));
|
|
574
578
|
}),
|
|
@@ -577,8 +581,8 @@ function serializePage(ctx, page) {
|
|
|
577
581
|
},
|
|
578
582
|
resources: (_a = page === null || page === void 0 ? void 0 : page.lowCodes) === null || _a === void 0 ? void 0 : _a.map((item) => serializeCodeSource(pageCtx, item)),
|
|
579
583
|
dataset: serializeDataset(ctx, page === null || page === void 0 ? void 0 : page.dataset),
|
|
580
|
-
dataVariables: runtime_1.getValidValue((_c = (_b = page === null || page === void 0 ? void 0 : page.vars) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.map((item) => serializeDataVariables(pageCtx, item))),
|
|
581
|
-
listeners: runtime_1.getValidValue((_d = page === null || page === void 0 ? void 0 : page.listeners) === null || _d === void 0 ? void 0 : _d.map((item) => {
|
|
584
|
+
dataVariables: (0, runtime_1.getValidValue)((_c = (_b = page === null || page === void 0 ? void 0 : page.vars) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.map((item) => serializeDataVariables(pageCtx, item))),
|
|
585
|
+
listeners: (0, runtime_1.getValidValue)((_d = page === null || page === void 0 ? void 0 : page.listeners) === null || _d === void 0 ? void 0 : _d.map((item) => {
|
|
582
586
|
return serializeListener(pageCtx, item);
|
|
583
587
|
})),
|
|
584
588
|
extra: {
|
|
@@ -628,6 +632,9 @@ function deserializePage(ctx, page) {
|
|
|
628
632
|
listeners: ((_g = page === null || page === void 0 ? void 0 : page.listeners) === null || _g === void 0 ? void 0 : _g.map((item) => {
|
|
629
633
|
return deserializeListener(pageCtx, item);
|
|
630
634
|
})) || [],
|
|
635
|
+
// TODO
|
|
636
|
+
// children: [],
|
|
637
|
+
// styleBindPath: item.styleBindPath,
|
|
631
638
|
};
|
|
632
639
|
}
|
|
633
640
|
exports.deserializePage = deserializePage;
|
|
@@ -638,7 +645,7 @@ exports.deserializePage = deserializePage;
|
|
|
638
645
|
*/
|
|
639
646
|
function serializePlatformApp(data, optsions) {
|
|
640
647
|
var _a;
|
|
641
|
-
let { version, author, name, label, description, selectedPageId, pageInstanceList, lowCodes = [], datasources, vars, dataset, extra, miniprogramPlugins } = data, restData = __rest(data, ["version", "author", "name", "label", "description", "selectedPageId", "pageInstanceList", "lowCodes", "datasources", "vars", "dataset", "extra", "miniprogramPlugins"]);
|
|
648
|
+
let { version, author, name, label, description, selectedPageId, pageInstanceList, lowCodes = [], datasources, vars, dataset, extra, dependencies: calsDependencies, miniprogramPlugins } = data, restData = __rest(data, ["version", "author", "name", "label", "description", "selectedPageId", "pageInstanceList", "lowCodes", "datasources", "vars", "dataset", "extra", "dependencies", "miniprogramPlugins"]);
|
|
642
649
|
let { dependencies = [] } = optsions || {};
|
|
643
650
|
const _b = extra || {}, { name: extraName, label: extraLabel, author: extraAuthor, description: extraDescription } = _b, restExtra = __rest(_b, ["name", "label", "author", "description"]);
|
|
644
651
|
const ctx = {
|
|
@@ -658,7 +665,8 @@ function serializePlatformApp(data, optsions) {
|
|
|
658
665
|
resources: lowCodes === null || lowCodes === void 0 ? void 0 : lowCodes.map((item) => serializeCodeSource(ctx, item)),
|
|
659
666
|
dataSources: datasources,
|
|
660
667
|
dataset: serializeDataset(ctx, dataset),
|
|
661
|
-
dataVariables: runtime_1.getValidValue(vars === null || vars === void 0 ? void 0 : vars.data.map((item) => serializeDataVariables(ctx, item))),
|
|
668
|
+
dataVariables: (0, runtime_1.getValidValue)(vars === null || vars === void 0 ? void 0 : vars.data.map((item) => serializeDataVariables(ctx, item))),
|
|
669
|
+
dependencies: calsDependencies,
|
|
662
670
|
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 }),
|
|
663
671
|
};
|
|
664
672
|
return processed;
|
|
@@ -710,6 +718,9 @@ function deserializePlatformApp(data, optsions) {
|
|
|
710
718
|
appConfig: appConfig,
|
|
711
719
|
miniprogramPlugins,
|
|
712
720
|
extra: Object.assign(Object.assign({}, restExtra), { name: data.name, author: data.author, description: data.description }),
|
|
721
|
+
dependencies: data.dependencies,
|
|
722
|
+
// TODO
|
|
723
|
+
// emitEvents: [], { "name": "自定义校验规则", "eventName": "validator" }
|
|
713
724
|
};
|
|
714
725
|
return processed;
|
|
715
726
|
}
|
|
@@ -726,34 +737,34 @@ function serializeRuntimePage(ctx, page //IPageInstance
|
|
|
726
737
|
id: page.id,
|
|
727
738
|
type: types_1.EComponentType.PAGE,
|
|
728
739
|
component: 'Page',
|
|
729
|
-
attributes: serializeAttributes(pageCtx, 'page', runtime_1.readDynamicData(page)),
|
|
730
|
-
items: runtime_1.getValidValue(Object.keys(((_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties) || {}).map((id) => {
|
|
740
|
+
attributes: serializeAttributes(pageCtx, 'page', (0, runtime_1.readDynamicData)(page)),
|
|
741
|
+
items: (0, runtime_1.getValidValue)(Object.keys(((_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties) || {}).map((id) => {
|
|
731
742
|
var _a;
|
|
732
743
|
return serializeRuntimeComponent(pageCtx, Object.assign({ id }, (_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties[id]));
|
|
733
744
|
})),
|
|
734
745
|
resources: (_b = page === null || page === void 0 ? void 0 : page.codeModules) === null || _b === void 0 ? void 0 : _b.map((item) => serializeCodeSource(pageCtx, item)),
|
|
735
746
|
dataset: page === null || page === void 0 ? void 0 : page.dataset,
|
|
736
|
-
dataVariables: 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))),
|
|
737
|
-
listeners: runtime_1.getValidValue(runtime_1.readListeners(page.listenerInstances || []).map((item) => {
|
|
747
|
+
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))),
|
|
748
|
+
listeners: (0, runtime_1.getValidValue)((0, runtime_1.readListeners)(page.listenerInstances || []).map((item) => {
|
|
738
749
|
return serializeListener(pageCtx, item);
|
|
739
750
|
})),
|
|
740
751
|
extra: {
|
|
741
|
-
pluginInstances: runtime_1.getValidValue(page === null || page === void 0 ? void 0 : page.pluginInstances),
|
|
742
|
-
commonStyle: runtime_1.getValidValue(style_1.removeInvalidStyleFormValue(page.style)),
|
|
743
|
-
styleBindPath: runtime_1.getValidValue(page.styleBindPath),
|
|
752
|
+
pluginInstances: (0, runtime_1.getValidValue)(page === null || page === void 0 ? void 0 : page.pluginInstances),
|
|
753
|
+
commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(page.style)),
|
|
754
|
+
styleBindPath: (0, runtime_1.getValidValue)(page.styleBindPath),
|
|
744
755
|
xIndex: page.xIndex,
|
|
745
|
-
children: runtime_1.getValidValue((_e = page.children) === null || _e === void 0 ? void 0 : _e.map((child) => serializeRuntimePage(ctx, child))),
|
|
756
|
+
children: (0, runtime_1.getValidValue)((_e = page.children) === null || _e === void 0 ? void 0 : _e.map((child) => serializeRuntimePage(ctx, child))),
|
|
746
757
|
},
|
|
747
758
|
};
|
|
748
|
-
if (common_2.isValidStyleBind(page.styleBind) && runtime_1.getValidValue(page.styleBind)) {
|
|
759
|
+
if ((0, common_2.isValidStyleBind)(page.styleBind) && (0, runtime_1.getValidValue)(page.styleBind)) {
|
|
749
760
|
page[':style'] = serializeValue({
|
|
750
761
|
ctx: pageCtx,
|
|
751
762
|
key: 'styleBind',
|
|
752
763
|
dynamicValue: page.styleBind,
|
|
753
764
|
}).value;
|
|
754
765
|
}
|
|
755
|
-
if (common_2.isValidClassNameListBind(page.classListBind) &&
|
|
756
|
-
runtime_1.getValidValue(page.classListBind)) {
|
|
766
|
+
if ((0, common_2.isValidClassNameListBind)(page.classListBind) &&
|
|
767
|
+
(0, runtime_1.getValidValue)(page.classListBind)) {
|
|
757
768
|
page[':class'] = serializeValue({
|
|
758
769
|
ctx: pageCtx,
|
|
759
770
|
key: 'classListBind',
|
|
@@ -798,37 +809,38 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
|
|
|
798
809
|
.filter((dataType) => dataType.type !== 'slot')
|
|
799
810
|
.map((dataType) => dataType.propertyPath);
|
|
800
811
|
let properties = component.properties || {};
|
|
801
|
-
processed = Object.assign(Object.assign({}, processed), { module: serializeModuleName(componentCtx, moduleName, name), component: name, attributes: Object.assign(Object.assign({}, serializeAttributes(componentCtx, 'page', (runtime_1.getValidValue(runtime_1.readDynamicData(props)) || {}))), { style: runtime_1.getValidValue(props.style), class: (_a = runtime_1.getValidValue(props.classNameList)) === null || _a === void 0 ? void 0 : _a.join(' ') }), items: runtime_1.getValidValue(Object.keys(properties)
|
|
812
|
+
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)
|
|
802
813
|
.filter((key) => !excludeKeys.includes(key))
|
|
803
|
-
.map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, properties[key])))), listeners: (_b = runtime_1.getValidValue(runtime_1.readListeners(props.listenerInstances))) === null || _b === void 0 ? void 0 : _b.map((listener /* IEventListener */) => {
|
|
814
|
+
.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 */) => {
|
|
804
815
|
return serializeListener(componentCtx, listener);
|
|
805
|
-
}), directives: serializeDirecties(componentCtx, (runtime_1.getValidValue(runtime_1.readDirectives(props)) || {})) || undefined, ':class': common_2.isValidClassNameListBind(props.classNameListBind)
|
|
816
|
+
}), directives: serializeDirecties(componentCtx, ((0, runtime_1.getValidValue)((0, runtime_1.readDirectives)(props)) || {})) || undefined, ':class': (0, common_2.isValidClassNameListBind)(props.classNameListBind)
|
|
806
817
|
? serializeValue({
|
|
807
818
|
ctx: componentCtx,
|
|
808
819
|
key: 'classListBind',
|
|
809
|
-
dynamicValue: runtime_1.getValidValue({
|
|
820
|
+
dynamicValue: (0, runtime_1.getValidValue)({
|
|
810
821
|
type: props.classNameListBind.type,
|
|
811
822
|
value: props.classNameListBind.bindDataPath,
|
|
812
823
|
}),
|
|
813
824
|
}).value
|
|
814
|
-
: undefined, ':style': ((_c = props === null || props === void 0 ? void 0 : props.styleBind) === null || _c === void 0 ? void 0 : _c.bindDataPath)
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
825
|
+
: undefined, ':style': ((_c = props === null || props === void 0 ? void 0 : props.styleBind) === null || _c === void 0 ? void 0 : _c.bindDataPath)
|
|
826
|
+
? serializeValue({
|
|
827
|
+
ctx: componentCtx,
|
|
828
|
+
key: 'styleBind',
|
|
829
|
+
dynamicValue: {
|
|
830
|
+
type: props.styleBind.type,
|
|
831
|
+
value: props.styleBind.bindDataPath,
|
|
832
|
+
},
|
|
833
|
+
}).value
|
|
822
834
|
: undefined, extra: {
|
|
823
|
-
commonStyle: runtime_1.getValidValue(style_1.removeInvalidStyleFormValue(props.commonStyle)),
|
|
824
|
-
xIndex: runtime_1.getValidValue(component['x-index']),
|
|
825
|
-
styleBindPath: runtime_1.getValidValue(props.styleBindPath),
|
|
826
|
-
staticResourceAttribute: runtime_1.getValidValue(props.staticResourceAttribute)
|
|
835
|
+
commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(props.commonStyle)),
|
|
836
|
+
xIndex: (0, runtime_1.getValidValue)(component['x-index']),
|
|
837
|
+
styleBindPath: (0, runtime_1.getValidValue)(props.styleBindPath),
|
|
838
|
+
staticResourceAttribute: (0, runtime_1.getValidValue)(props.staticResourceAttribute)
|
|
827
839
|
} });
|
|
828
840
|
}
|
|
829
841
|
else {
|
|
830
842
|
let items = Object.keys(component.properties || {}).map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, component.properties[key])));
|
|
831
|
-
processed = Object.assign(Object.assign({}, processed), { items: runtime_1.getValidValue(items) });
|
|
843
|
+
processed = Object.assign(Object.assign({}, processed), { items: (0, runtime_1.getValidValue)(items) });
|
|
832
844
|
}
|
|
833
845
|
return processed;
|
|
834
846
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IComplexComponent, IBasicComponent } from '../../../../types';
|
|
2
|
+
interface IParseContext {
|
|
3
|
+
component?: {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
forContext: Record<string, boolean>;
|
|
7
|
+
datasetMap: Record<string, any>;
|
|
8
|
+
dataSourceMap: Record<string, any>;
|
|
9
|
+
componentMap: Record<string, any>;
|
|
10
|
+
lowcodeMap: Record<string, any>;
|
|
11
|
+
componentLibMap: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export declare function parseComponentCals(ctx: IParseContext, cals: IBasicComponent | IComplexComponent): IParseContext;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EAEhB,MAAM,mBAAmB,CAAA;AAQ1B,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE;QACV,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IACD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAClC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACrC;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,eAAe,GAAG,iBAAiB,GACxC,aAAa,CAyDf"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseComponentCals = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const expression_1 = require("../../../expression");
|
|
6
|
+
function parseComponentCals(ctx, cals) {
|
|
7
|
+
if (!ctx.datasetMap) {
|
|
8
|
+
ctx.datasetMap = {};
|
|
9
|
+
}
|
|
10
|
+
if (!ctx.dataSourceMap) {
|
|
11
|
+
ctx.dataSourceMap = {};
|
|
12
|
+
}
|
|
13
|
+
if (!ctx.componentMap) {
|
|
14
|
+
ctx.componentMap = {};
|
|
15
|
+
}
|
|
16
|
+
if (!ctx.lowcodeMap) {
|
|
17
|
+
ctx.lowcodeMap = {};
|
|
18
|
+
}
|
|
19
|
+
if (!ctx.componentLibMap) {
|
|
20
|
+
ctx.componentLibMap = {};
|
|
21
|
+
}
|
|
22
|
+
ctx.component = {
|
|
23
|
+
id: cals.id || '',
|
|
24
|
+
};
|
|
25
|
+
const { component, module, attributes = {}, items = [], listeners = [], directives = {}, [':class']: dynamicClassList, [':style']: dynamicStyle, } = cals;
|
|
26
|
+
if (module && component && !(0, lodash_1.get)(ctx.componentMap, `${module}.${component}`)) {
|
|
27
|
+
(0, lodash_1.set)(ctx.componentMap, `${module}.${component}`, true);
|
|
28
|
+
ctx.componentLibMap[module] = true;
|
|
29
|
+
}
|
|
30
|
+
// 优先处理 directives 因为其他绑定会用到for
|
|
31
|
+
parseDirectivesCals(ctx, directives);
|
|
32
|
+
pasrseDynamicMapCals(ctx, attributes);
|
|
33
|
+
for (let item of listeners) {
|
|
34
|
+
parseListenertCals(ctx, item);
|
|
35
|
+
}
|
|
36
|
+
if (dynamicClassList) {
|
|
37
|
+
parseValueCals(ctx, dynamicClassList);
|
|
38
|
+
}
|
|
39
|
+
if (dynamicStyle) {
|
|
40
|
+
parseValueCals(ctx, dynamicStyle);
|
|
41
|
+
}
|
|
42
|
+
for (let item of items) {
|
|
43
|
+
parseComponentCals(ctx, item);
|
|
44
|
+
}
|
|
45
|
+
return ctx;
|
|
46
|
+
}
|
|
47
|
+
exports.parseComponentCals = parseComponentCals;
|
|
48
|
+
function parseListenertCals(ctx, listener) {
|
|
49
|
+
let { type, handler } = listener;
|
|
50
|
+
switch (type) {
|
|
51
|
+
case expression_1.ActionType.Rematch: {
|
|
52
|
+
if (handler === null || handler === void 0 ? void 0 : handler.name) {
|
|
53
|
+
ctx.lowcodeMap[handler === null || handler === void 0 ? void 0 : handler.name] = true;
|
|
54
|
+
}
|
|
55
|
+
pasrseDynamicMapCals(ctx, handler === null || handler === void 0 ? void 0 : handler.params);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case expression_1.ActionType.DataSource: {
|
|
59
|
+
let params = handler === null || handler === void 0 ? void 0 : handler.params;
|
|
60
|
+
pasrseDynamicMapCals(params);
|
|
61
|
+
if (params === null || params === void 0 ? void 0 : params.dataSourceName) {
|
|
62
|
+
ctx.dataSourceMap[params === null || params === void 0 ? void 0 : params.dataSourceName] = true;
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case expression_1.ActionType.Material: {
|
|
67
|
+
if (handler === null || handler === void 0 ? void 0 : handler.module) {
|
|
68
|
+
ctx.componentLibMap[handler === null || handler === void 0 ? void 0 : handler.module] = true;
|
|
69
|
+
}
|
|
70
|
+
pasrseDynamicMapCals(ctx, handler === null || handler === void 0 ? void 0 : handler.params);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case expression_1.ActionType.Platform: {
|
|
74
|
+
console.log(handler === null || handler === void 0 ? void 0 : handler.params);
|
|
75
|
+
pasrseDynamicMapCals(ctx, handler === null || handler === void 0 ? void 0 : handler.params);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function pasrseDynamicMapCals(ctx, map = {}) {
|
|
81
|
+
for (let key in map) {
|
|
82
|
+
if (/^:/.test(key) && typeof map[key] === 'string') {
|
|
83
|
+
parseValueCals(ctx, map[key]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function parseDirectivesCals(ctx, directives) {
|
|
88
|
+
var _a;
|
|
89
|
+
// 优先处理for,因为其他的可能会用到 foritem
|
|
90
|
+
let forValue = directives[':for'];
|
|
91
|
+
if (typeof forValue === 'string') {
|
|
92
|
+
parseValueCals(ctx, forValue);
|
|
93
|
+
if (!ctx.forContext) {
|
|
94
|
+
ctx.forContext = {};
|
|
95
|
+
}
|
|
96
|
+
if ((_a = ctx.component) === null || _a === void 0 ? void 0 : _a.id) {
|
|
97
|
+
ctx.forContext[ctx.component.id] = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let visibleValue = directives[':if'];
|
|
101
|
+
if (typeof visibleValue === 'string') {
|
|
102
|
+
parseValueCals(ctx, visibleValue);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function parseValueCals(ctx, value) {
|
|
106
|
+
var _a, _b, _c;
|
|
107
|
+
try {
|
|
108
|
+
let parser = new expression_1.DynamicValueParser(value, { pageId: '$page' });
|
|
109
|
+
let res = parser.parse();
|
|
110
|
+
switch (res.type) {
|
|
111
|
+
case expression_1.PropBindType.paramData:
|
|
112
|
+
case expression_1.PropBindType.stateData: {
|
|
113
|
+
const TYPE_MAP = {
|
|
114
|
+
[expression_1.PropBindType.paramData]: 'params',
|
|
115
|
+
[expression_1.PropBindType.stateData]: 'state',
|
|
116
|
+
};
|
|
117
|
+
const type = TYPE_MAP[res.type];
|
|
118
|
+
const path = ((_a = res.value) === null || _a === void 0 ? void 0 : _a.split('.')) || [];
|
|
119
|
+
let key = path[0];
|
|
120
|
+
if (!ctx.datasetMap[key]) {
|
|
121
|
+
ctx.datasetMap[key] = {};
|
|
122
|
+
}
|
|
123
|
+
if (path.length === 1) {
|
|
124
|
+
ctx.datasetMap[key][type] = true;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
ctx.datasetMap[key][`${type}.${path[1].replace(/\[.*/, '')}`] = true;
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case expression_1.PropBindType.forItem: {
|
|
132
|
+
const [id] = ((_b = res.value) === null || _b === void 0 ? void 0 : _b.split('.')) || [];
|
|
133
|
+
if (!ctx.forContext[id]) {
|
|
134
|
+
throw {
|
|
135
|
+
code: 'INVALID_FOR_CONTEXT',
|
|
136
|
+
message: '缺少循环上下文,无法保存为区块',
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
if (((_c = e) === null || _c === void 0 ? void 0 : _c.code) === 'INVALID_FOR_CONTEXT') {
|
|
145
|
+
throw e;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -24,7 +24,7 @@ function readComponents(properties = {}, excludeKeys = []) {
|
|
|
24
24
|
setValidValue(componentXProps, 'listeners', readListeners(srcProps.listenerInstances));
|
|
25
25
|
setValidValue(componentXProps, 'directives', readDirectives(srcProps));
|
|
26
26
|
setValidValue(componentXProps, 'style', srcProps.style);
|
|
27
|
-
setValidValue(componentXProps, 'commonStyle', style_1.removeInvalidStyleFormValue(srcProps.commonStyle));
|
|
27
|
+
setValidValue(componentXProps, 'commonStyle', (0, style_1.removeInvalidStyleFormValue)(srcProps.commonStyle));
|
|
28
28
|
setValidValue(componentXProps, 'styleBindPath', srcProps.styleBindPath);
|
|
29
29
|
if (srcProps.styleBind && srcProps.styleBind.bindDataPath) {
|
|
30
30
|
componentXProps.styleBind = {
|
|
@@ -32,7 +32,7 @@ function readComponents(properties = {}, excludeKeys = []) {
|
|
|
32
32
|
value: srcProps.styleBind.bindDataPath,
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
if (common_1.isValidClassNameListBind(srcProps.classNameListBind)) {
|
|
35
|
+
if ((0, common_1.isValidClassNameListBind)(srcProps.classNameListBind)) {
|
|
36
36
|
const classList = srcProps.classNameListBind;
|
|
37
37
|
setValidValue(componentXProps, 'classListBind', {
|
|
38
38
|
type: classList.type,
|
|
@@ -147,7 +147,7 @@ function getValidValue(value) {
|
|
|
147
147
|
if (Array.isArray(value) && value.length === 0) {
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
if (common_1.isPlainObject(value) && common_1.isEmptyObj(value)) {
|
|
150
|
+
if ((0, common_1.isPlainObject)(value) && (0, common_1.isEmptyObj)(value)) {
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
return value;
|
|
@@ -5,7 +5,7 @@ const common_1 = require("./common");
|
|
|
5
5
|
function removeInvalidStyleFormValue(styleForm = {}) {
|
|
6
6
|
return Object.keys(styleForm).reduce((result, key) => {
|
|
7
7
|
const propStyleFormData = styleForm[key];
|
|
8
|
-
if (common_1.isPlainObject(propStyleFormData)) {
|
|
8
|
+
if ((0, common_1.isPlainObject)(propStyleFormData)) {
|
|
9
9
|
setStyleValue(result, key, removeInvalidStyleFormValue(propStyleFormData));
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
@@ -23,8 +23,8 @@ function setStyleValue(object, key, value) {
|
|
|
23
23
|
if (key === 'open') {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
if (common_1.isEmptyObj(value)) {
|
|
26
|
+
if ((0, common_1.isEmptyObj)(value)) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
object[common_1.camelcase(key)] = value;
|
|
29
|
+
object[(0, common_1.camelcase)(key)] = value;
|
|
30
30
|
}
|
|
@@ -70,8 +70,8 @@ function translateComponentModuleName(comp) {
|
|
|
70
70
|
const { xComponent } = comp;
|
|
71
71
|
if (xComponent) {
|
|
72
72
|
const { name } = xComponent;
|
|
73
|
-
const complexName = utils_1.isComplexComponent(name);
|
|
74
|
-
const gsdH5ReactName = utils_1.isGsdH5ReactComponent(name);
|
|
73
|
+
const complexName = (0, utils_1.isComplexComponent)(name);
|
|
74
|
+
const gsdH5ReactName = (0, utils_1.isGsdH5ReactComponent)(name);
|
|
75
75
|
if (complexName) {
|
|
76
76
|
xComponent.moduleName = 'CLOUDBASE_STANDARD';
|
|
77
77
|
xComponent.name = complexName;
|
|
@@ -167,7 +167,7 @@ function translateComponent(comp) {
|
|
|
167
167
|
comp.properties = {
|
|
168
168
|
contentSlot: {
|
|
169
169
|
properties: {
|
|
170
|
-
[utils_1.getId()]: {
|
|
170
|
+
[(0, utils_1.getId)()]: {
|
|
171
171
|
xComponent: {
|
|
172
172
|
moduleName: 'gsd-h5-react',
|
|
173
173
|
name: 'Text',
|
|
@@ -246,7 +246,7 @@ function translateStyleToCommonStyle(comp) {
|
|
|
246
246
|
if (xProps && xProps.style) {
|
|
247
247
|
xProps.commonStyle = xProps.commonStyle || {};
|
|
248
248
|
xProps.commonStyle.self = xProps.commonStyle.self || {};
|
|
249
|
-
xProps.commonStyle.self = lodash_1.merge(xProps.style, xProps.commonStyle.self);
|
|
249
|
+
xProps.commonStyle.self = (0, lodash_1.merge)(xProps.style, xProps.commonStyle.self);
|
|
250
250
|
delete xProps.style;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
@@ -280,11 +280,11 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
280
280
|
};
|
|
281
281
|
if (!rulesValue.type || rulesValue.type === 'static') {
|
|
282
282
|
rulesValue.value = (rulesValue.value || []).filter((meta) => {
|
|
283
|
-
return meta && !common_1.isEmptyObj(meta);
|
|
283
|
+
return meta && !(0, common_1.isEmptyObj)(meta);
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
|
-
if (utils_1.isPlainObject(rulesValue.value)) {
|
|
287
|
-
if (utils_1.isEmptyObject(rulesValue.value)) {
|
|
286
|
+
if ((0, utils_1.isPlainObject)(rulesValue.value)) {
|
|
287
|
+
if ((0, utils_1.isEmptyObject)(rulesValue.value)) {
|
|
288
288
|
rulesValue.value = [];
|
|
289
289
|
}
|
|
290
290
|
else {
|
|
@@ -307,15 +307,15 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
307
307
|
let isShowTitleSlot = false;
|
|
308
308
|
if (properties) {
|
|
309
309
|
Object.keys(properties).map((subKey) => {
|
|
310
|
-
if (utils_1.isWeAppId(subKey)) {
|
|
310
|
+
if ((0, utils_1.isWeAppId)(subKey)) {
|
|
311
311
|
delete properties[subKey];
|
|
312
312
|
}
|
|
313
313
|
if (subKey === 'label') {
|
|
314
314
|
const targetLabelSlot = properties[subKey];
|
|
315
|
-
utils_1.getComponentChildren(targetLabelSlot).map(([key, item]) => {
|
|
315
|
+
(0, utils_1.getComponentChildren)(targetLabelSlot).map(([key, item]) => {
|
|
316
316
|
labelText = lodash_1.default.get(item, 'xProps.data.text.value');
|
|
317
317
|
const cloneItem = lodash_1.default.cloneDeep(item);
|
|
318
|
-
index_1.deepParse(cloneItem, key, comp);
|
|
318
|
+
(0, index_1.deepParse)(cloneItem, key, comp);
|
|
319
319
|
isShowTitleSlot = true;
|
|
320
320
|
});
|
|
321
321
|
delete comp.properties.label;
|
|
@@ -323,7 +323,7 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
const titleSlot = {
|
|
326
|
-
[utils_1.getId()]: {
|
|
326
|
+
[(0, utils_1.getId)()]: {
|
|
327
327
|
xComponent: {
|
|
328
328
|
moduleName: 'gsd-h5-react',
|
|
329
329
|
name: 'Text',
|
|
@@ -358,7 +358,7 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
358
358
|
if (!parent.xComponent ||
|
|
359
359
|
(parent.xComponent && parent.xComponent.name !== 'FormItem')) {
|
|
360
360
|
// add FormItem
|
|
361
|
-
const newFormItemId = utils_1.getId();
|
|
361
|
+
const newFormItemId = (0, utils_1.getId)();
|
|
362
362
|
// @ts-ignore
|
|
363
363
|
parent.properties[newFormItemId] = {
|
|
364
364
|
xComponent: {
|
|
@@ -420,7 +420,7 @@ function renameRepeatId(json) {
|
|
|
420
420
|
for (const i in componentInstances) {
|
|
421
421
|
const comp = componentInstances[i];
|
|
422
422
|
if (_compIds[i] && i.startsWith('id')) {
|
|
423
|
-
const newId = utils_1.getId();
|
|
423
|
+
const newId = (0, utils_1.getId)();
|
|
424
424
|
componentInstances[newId] = comp;
|
|
425
425
|
delete componentInstances[i];
|
|
426
426
|
}
|
|
@@ -439,7 +439,7 @@ function renameRepeatId(json) {
|
|
|
439
439
|
keys.forEach((key) => {
|
|
440
440
|
const _comp = topComp['properties'][key];
|
|
441
441
|
if (_compIds[key] && key.startsWith('id')) {
|
|
442
|
-
const newId = utils_1.getId();
|
|
442
|
+
const newId = (0, utils_1.getId)();
|
|
443
443
|
topComp['properties'][newId] = _comp;
|
|
444
444
|
delete topComp['properties'][key];
|
|
445
445
|
}
|
|
@@ -26,12 +26,12 @@ const CompParse = __importStar(require("./parses"));
|
|
|
26
26
|
const index_1 = require("../../index");
|
|
27
27
|
function upgrageToVersion2(app) {
|
|
28
28
|
if (app.selectedPageId) {
|
|
29
|
-
utils_1.init(app);
|
|
30
|
-
common_1.renameRepeatId(app);
|
|
29
|
+
(0, utils_1.init)(app);
|
|
30
|
+
(0, common_1.renameRepeatId)(app);
|
|
31
31
|
parse2V2(app);
|
|
32
32
|
let str = JSON.stringify(app);
|
|
33
33
|
let obj = JSON.parse(str.replace(/app\.getPageOptions/g, '(()=>{})').replace(/\\\\n/g, '\\n'));
|
|
34
|
-
return index_1.serializePlatformApp(obj, { dependencies: [] });
|
|
34
|
+
return (0, index_1.serializePlatformApp)(obj, { dependencies: [] });
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
return app;
|
|
@@ -46,7 +46,7 @@ function parse2V2(json) {
|
|
|
46
46
|
findSelectedPage = true;
|
|
47
47
|
}
|
|
48
48
|
CompParse.addFormWrapperComp(pageInstance);
|
|
49
|
-
if (utils_1.isComplexJSON(json)) {
|
|
49
|
+
if ((0, utils_1.isComplexJSON)(json)) {
|
|
50
50
|
CompParse.parseComplexComponentInstance(pageInstance);
|
|
51
51
|
}
|
|
52
52
|
const { componentInstances } = pageInstance;
|
|
@@ -71,10 +71,10 @@ function deepParse(comp, key, parent) {
|
|
|
71
71
|
const { xComponent } = comp;
|
|
72
72
|
if (xComponent) {
|
|
73
73
|
const { name } = xComponent;
|
|
74
|
-
common_1.beforeCommonParse(comp);
|
|
74
|
+
(0, common_1.beforeCommonParse)(comp);
|
|
75
75
|
const parseFunction = CompParse[`parseGsdKbone${name}`];
|
|
76
76
|
parseFunction && parseFunction(comp, key, parent);
|
|
77
|
-
common_1.afterCommonParse(comp);
|
|
77
|
+
(0, common_1.afterCommonParse)(comp);
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
80
|
// 当前为 slot
|