@tarojs/shared 3.8.0-canary.0 → 3.8.0-canary.1
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/LICENSE +14 -0
- package/dist/components.d.ts +21 -0
- package/dist/components.js +337 -0
- package/dist/components.js.map +1 -0
- package/dist/constants.d.ts +25 -0
- package/dist/constants.js +28 -0
- package/dist/constants.js.map +1 -0
- package/dist/event-channel.d.ts +14 -0
- package/dist/event-channel.js +48 -0
- package/dist/event-channel.js.map +1 -0
- package/dist/event-emitter.d.ts +13 -0
- package/dist/event-emitter.js +97 -0
- package/dist/event-emitter.js.map +1 -0
- package/dist/index.cjs.d.ts +315 -0
- package/dist/index.cjs.js +1337 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +9 -291
- package/dist/index.js +9 -1279
- package/dist/index.js.map +1 -1
- package/dist/is.d.ts +11 -0
- package/dist/is.js +29 -0
- package/dist/is.js.map +1 -0
- package/dist/native-apis.d.ts +34 -0
- package/dist/native-apis.js +362 -0
- package/dist/native-apis.js.map +1 -0
- package/dist/runtime-hooks.d.ts +258 -0
- package/dist/runtime-hooks.js +178 -0
- package/dist/runtime-hooks.js.map +1 -0
- package/dist/shared.esm.d.ts +32 -8
- package/dist/shared.esm.js +76 -18
- package/dist/shared.esm.js.map +1 -1
- package/dist/shortcuts.d.ts +11 -0
- package/dist/shortcuts.js +16 -0
- package/dist/shortcuts.js.map +1 -0
- package/dist/template.d.ts +7 -3
- package/dist/template.js +65 -32
- package/dist/template.js.map +1 -1
- package/dist/utils.d.ts +57 -0
- package/dist/utils.js +220 -0
- package/dist/utils.js.map +1 -0
- package/package.json +11 -5
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// 字符串简写
|
|
2
|
+
var Shortcuts;
|
|
3
|
+
(function (Shortcuts) {
|
|
4
|
+
Shortcuts["Container"] = "container";
|
|
5
|
+
Shortcuts["Childnodes"] = "cn";
|
|
6
|
+
Shortcuts["Text"] = "v";
|
|
7
|
+
Shortcuts["NodeType"] = "nt";
|
|
8
|
+
Shortcuts["NodeName"] = "nn";
|
|
9
|
+
// Attrtibutes
|
|
10
|
+
Shortcuts["Style"] = "st";
|
|
11
|
+
Shortcuts["Class"] = "cl";
|
|
12
|
+
Shortcuts["Src"] = "src";
|
|
13
|
+
})(Shortcuts || (Shortcuts = {}));
|
|
14
|
+
|
|
15
|
+
export { Shortcuts };
|
|
16
|
+
//# sourceMappingURL=shortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortcuts.js","sources":["../src/shortcuts.ts"],"sourcesContent":["// 字符串简写\nexport const enum Shortcuts {\n Container = 'container',\n Childnodes = 'cn',\n Text = 'v',\n NodeType = 'nt',\n NodeName = 'nn',\n\n // Attrtibutes\n Style = 'st',\n Class = 'cl',\n Src = 'src'\n}\n"],"names":[],"mappings":"AAAA;IACkB,UAWjB;AAXD,CAAA,UAAkB,SAAS,EAAA;AACzB,IAAA,SAAA,CAAA,WAAA,CAAA,GAAA,WAAuB,CAAA;AACvB,IAAA,SAAA,CAAA,YAAA,CAAA,GAAA,IAAiB,CAAA;AACjB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,GAAU,CAAA;AACV,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,IAAe,CAAA;AACf,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,IAAe,CAAA;;AAGf,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,IAAY,CAAA;AACZ,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,IAAY,CAAA;AACZ,IAAA,SAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACb,CAAC,EAXiB,SAAS,KAAT,SAAS,GAW1B,EAAA,CAAA,CAAA;;;;"}
|
package/dist/template.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ declare class BaseTemplate {
|
|
|
58
58
|
protected modifyTemplateResult?: (res: string, nodeName: string, level: number, children: string) => string;
|
|
59
59
|
protected modifyThirdPartyLoopBody?: (child: string, nodeName: string) => string;
|
|
60
60
|
supportXS: boolean;
|
|
61
|
+
isXMLSupportRecursiveReference: boolean;
|
|
61
62
|
Adapter: IAdapter;
|
|
62
63
|
/** 组件列表 */
|
|
63
64
|
internalComponents: Record<string, Record<string, string>>;
|
|
@@ -72,7 +73,7 @@ declare class BaseTemplate {
|
|
|
72
73
|
get baseLevel(): number;
|
|
73
74
|
private buildAttribute;
|
|
74
75
|
protected replacePropName(name: string, value: string, _componentName?: string, _componentAlias?: any): string;
|
|
75
|
-
|
|
76
|
+
createMiniComponents(components: Components): Components;
|
|
76
77
|
protected buildBaseTemplate(): string;
|
|
77
78
|
protected buildThirdPartyAttr(attrs: Set<string>, patcher?: Record<string, string>): string;
|
|
78
79
|
protected buildComponentTemplate(comp: Component, level: number): string;
|
|
@@ -87,8 +88,11 @@ declare class BaseTemplate {
|
|
|
87
88
|
protected dataKeymap(keymap: string): string;
|
|
88
89
|
protected getEvents(): any;
|
|
89
90
|
protected getAttrValue(value: string, _key: string, _nodeName: string): string;
|
|
90
|
-
|
|
91
|
-
buildPageTemplate: (baseTempPath: string
|
|
91
|
+
buildXsTemplate(_filePath?: string): string;
|
|
92
|
+
buildPageTemplate: (baseTempPath: string, _page: {
|
|
93
|
+
content: Record<string, any>;
|
|
94
|
+
path: string;
|
|
95
|
+
}) => string;
|
|
92
96
|
buildBaseComponentTemplate: (ext: string) => string;
|
|
93
97
|
buildCustomComponentTemplate: (ext: string) => string;
|
|
94
98
|
buildXScript: () => string;
|
package/dist/template.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
const DEFAULT_EMPTY_ARRAY = '[]';
|
|
6
4
|
const NO_DEFAULT_VALUE = '';
|
|
7
5
|
const DEFAULT_TRUE = '!0';
|
|
@@ -43,12 +41,8 @@ const Progress = {
|
|
|
43
41
|
const RichText = {
|
|
44
42
|
nodes: DEFAULT_EMPTY_ARRAY
|
|
45
43
|
};
|
|
46
|
-
const Text = {
|
|
47
|
-
|
|
48
|
-
space: NO_DEFAULT_VALUE,
|
|
49
|
-
decode: DEFAULT_FALSE
|
|
50
|
-
};
|
|
51
|
-
const Button = Object.assign({ size: singleQuote('default'), type: NO_DEFAULT_VALUE, plain: DEFAULT_FALSE, disabled: NO_DEFAULT_VALUE, loading: DEFAULT_FALSE, 'form-type': NO_DEFAULT_VALUE, 'open-type': NO_DEFAULT_VALUE, 'hover-class': singleQuote('button-hover'), 'hover-stop-propagation': DEFAULT_FALSE, 'hover-start-time': '20', 'hover-stay-time': '70', name: NO_DEFAULT_VALUE }, touchEvents);
|
|
44
|
+
const Text = Object.assign({ selectable: DEFAULT_FALSE, space: NO_DEFAULT_VALUE, decode: DEFAULT_FALSE }, touchEvents);
|
|
45
|
+
const Button = Object.assign({ size: singleQuote('default'), type: NO_DEFAULT_VALUE, plain: DEFAULT_FALSE, disabled: NO_DEFAULT_VALUE, loading: DEFAULT_FALSE, 'form-type': NO_DEFAULT_VALUE, 'open-type': NO_DEFAULT_VALUE, 'hover-class': singleQuote('button-hover'), 'hover-stop-propagation': DEFAULT_FALSE, 'hover-start-time': '20', 'hover-stay-time': '70', name: NO_DEFAULT_VALUE, bindagreeprivacyauthorization: NO_DEFAULT_VALUE }, touchEvents);
|
|
52
46
|
const Checkbox = {
|
|
53
47
|
value: NO_DEFAULT_VALUE,
|
|
54
48
|
disabled: NO_DEFAULT_VALUE,
|
|
@@ -88,10 +82,7 @@ const Input = {
|
|
|
88
82
|
bindConfirm: NO_DEFAULT_VALUE,
|
|
89
83
|
name: NO_DEFAULT_VALUE
|
|
90
84
|
};
|
|
91
|
-
const Label = {
|
|
92
|
-
for: NO_DEFAULT_VALUE,
|
|
93
|
-
name: NO_DEFAULT_VALUE
|
|
94
|
-
};
|
|
85
|
+
const Label = Object.assign({ for: NO_DEFAULT_VALUE, name: NO_DEFAULT_VALUE }, touchEvents);
|
|
95
86
|
const Picker = {
|
|
96
87
|
mode: singleQuote('selector'),
|
|
97
88
|
disabled: NO_DEFAULT_VALUE,
|
|
@@ -254,6 +245,7 @@ const Slot = {
|
|
|
254
245
|
const NativeSlot = {
|
|
255
246
|
name: NO_DEFAULT_VALUE
|
|
256
247
|
};
|
|
248
|
+
const Script = {};
|
|
257
249
|
const internalComponents = {
|
|
258
250
|
View,
|
|
259
251
|
Icon,
|
|
@@ -295,7 +287,18 @@ const internalComponents = {
|
|
|
295
287
|
Slot,
|
|
296
288
|
SlotView,
|
|
297
289
|
NativeSlot,
|
|
290
|
+
Script,
|
|
298
291
|
};
|
|
292
|
+
new Set([
|
|
293
|
+
'input',
|
|
294
|
+
'checkbox',
|
|
295
|
+
'picker',
|
|
296
|
+
'picker-view',
|
|
297
|
+
'radio',
|
|
298
|
+
'slider',
|
|
299
|
+
'switch',
|
|
300
|
+
'textarea'
|
|
301
|
+
]);
|
|
299
302
|
const focusComponents = new Set([
|
|
300
303
|
'input',
|
|
301
304
|
'textarea'
|
|
@@ -329,7 +332,7 @@ const nestElements = new Map([
|
|
|
329
332
|
['form', 4],
|
|
330
333
|
['scroll-view', 4],
|
|
331
334
|
['swiper', 4],
|
|
332
|
-
['swiper-item', 4]
|
|
335
|
+
['swiper-item', 4],
|
|
333
336
|
]);
|
|
334
337
|
|
|
335
338
|
function isString(o) {
|
|
@@ -345,6 +348,20 @@ function isBooleanStringLiteral(o) {
|
|
|
345
348
|
return o === 'true' || o === 'false';
|
|
346
349
|
}
|
|
347
350
|
|
|
351
|
+
// 字符串简写
|
|
352
|
+
exports.Shortcuts = void 0;
|
|
353
|
+
(function (Shortcuts) {
|
|
354
|
+
Shortcuts["Container"] = "container";
|
|
355
|
+
Shortcuts["Childnodes"] = "cn";
|
|
356
|
+
Shortcuts["Text"] = "v";
|
|
357
|
+
Shortcuts["NodeType"] = "nt";
|
|
358
|
+
Shortcuts["NodeName"] = "nn";
|
|
359
|
+
// Attrtibutes
|
|
360
|
+
Shortcuts["Style"] = "st";
|
|
361
|
+
Shortcuts["Class"] = "cl";
|
|
362
|
+
Shortcuts["Src"] = "src";
|
|
363
|
+
})(exports.Shortcuts || (exports.Shortcuts = {}));
|
|
364
|
+
|
|
348
365
|
var PLATFORM_TYPE;
|
|
349
366
|
(function (PLATFORM_TYPE) {
|
|
350
367
|
PLATFORM_TYPE["MINI"] = "mini";
|
|
@@ -368,7 +385,7 @@ var PLATFORM_TYPE;
|
|
|
368
385
|
},
|
|
369
386
|
quickapp: {
|
|
370
387
|
type: PLATFORM_TYPE.QUICK
|
|
371
|
-
}
|
|
388
|
+
},
|
|
372
389
|
});
|
|
373
390
|
|
|
374
391
|
class Events {
|
|
@@ -576,6 +593,7 @@ new TaroHooks({
|
|
|
576
593
|
return this.call('getMiniLifecycle', defaultMiniLifecycle);
|
|
577
594
|
}),
|
|
578
595
|
getLifecycle: TaroHook(HOOK_TYPE.SINGLE, (instance, lifecycle) => instance[lifecycle]),
|
|
596
|
+
modifyRecursiveComponentConfig: TaroHook(HOOK_TYPE.SINGLE, (defaultConfig) => defaultConfig),
|
|
579
597
|
getPathIndex: TaroHook(HOOK_TYPE.SINGLE, indexOfNode => `[${indexOfNode}]`),
|
|
580
598
|
getEventCenter: TaroHook(HOOK_TYPE.SINGLE, Events => new Events()),
|
|
581
599
|
isBubbleEvents: TaroHook(HOOK_TYPE.SINGLE, eventName => {
|
|
@@ -607,6 +625,7 @@ new TaroHooks({
|
|
|
607
625
|
createPullDownComponent: TaroHook(HOOK_TYPE.SINGLE),
|
|
608
626
|
getDOMNode: TaroHook(HOOK_TYPE.SINGLE),
|
|
609
627
|
modifyHydrateData: TaroHook(HOOK_TYPE.SINGLE),
|
|
628
|
+
transferHydrateData: TaroHook(HOOK_TYPE.SINGLE),
|
|
610
629
|
modifySetAttrPayload: TaroHook(HOOK_TYPE.SINGLE),
|
|
611
630
|
modifyRmAttrPayload: TaroHook(HOOK_TYPE.SINGLE),
|
|
612
631
|
onAddEvent: TaroHook(HOOK_TYPE.SINGLE),
|
|
@@ -629,9 +648,12 @@ new TaroHooks({
|
|
|
629
648
|
node.dispatchEvent(e);
|
|
630
649
|
}),
|
|
631
650
|
dispatchTaroEventFinish: TaroHook(HOOK_TYPE.MULTI),
|
|
651
|
+
modifyTaroEventReturn: TaroHook(HOOK_TYPE.SINGLE, () => undefined),
|
|
632
652
|
modifyDispatchEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
633
653
|
initNativeApi: TaroHook(HOOK_TYPE.MULTI),
|
|
634
|
-
patchElement: TaroHook(HOOK_TYPE.MULTI)
|
|
654
|
+
patchElement: TaroHook(HOOK_TYPE.MULTI),
|
|
655
|
+
modifyAddEventListener: TaroHook(HOOK_TYPE.SINGLE),
|
|
656
|
+
modifyRemoveEventListener: TaroHook(HOOK_TYPE.SINGLE),
|
|
635
657
|
});
|
|
636
658
|
|
|
637
659
|
function toDashed(s) {
|
|
@@ -750,6 +772,7 @@ class BaseTemplate {
|
|
|
750
772
|
this.exportExpr = 'module.exports =';
|
|
751
773
|
this.thirdPartyPatcher = {};
|
|
752
774
|
this.supportXS = false;
|
|
775
|
+
this.isXMLSupportRecursiveReference = true;
|
|
753
776
|
this.Adapter = weixinAdapter;
|
|
754
777
|
/** 组件列表 */
|
|
755
778
|
this.internalComponents = internalComponents;
|
|
@@ -759,28 +782,32 @@ class BaseTemplate {
|
|
|
759
782
|
this.voidElements = voidElements;
|
|
760
783
|
/** 可以递归调用自身的组件 */
|
|
761
784
|
this.nestElements = nestElements;
|
|
762
|
-
this.buildPageTemplate = (baseTempPath) => {
|
|
785
|
+
this.buildPageTemplate = (baseTempPath, _page) => {
|
|
763
786
|
const template = `<import src="${baseTempPath}"/>
|
|
764
787
|
<template is="taro_tmpl" data="{{${this.dataKeymap('root:root')}}}" />`;
|
|
765
788
|
return template;
|
|
766
789
|
};
|
|
767
790
|
this.buildBaseComponentTemplate = (ext) => {
|
|
768
791
|
const data = !this.isSupportRecursive && this.supportXS
|
|
769
|
-
? this.dataKeymap(
|
|
792
|
+
? this.dataKeymap(`i:i,c:1,l:xs.f('',i.${"nn" /* Shortcuts.NodeName */})`)
|
|
770
793
|
: this.isSupportRecursive
|
|
771
794
|
? this.dataKeymap('i:i')
|
|
772
795
|
: this.dataKeymap('i:i,c:1');
|
|
796
|
+
// 此处需要重新引入 xs 函数,否则会出现 ws.f() 在 comp.wxml 和 custom-wrapper.wxml 中永远返回 undefined 的问题 #14599
|
|
773
797
|
return `<import src="./base${ext}" />
|
|
798
|
+
${this.buildXsTemplate()}
|
|
774
799
|
<template is="{{'tmpl_0_' + i.nn}}" data="{{${data}}}" />`;
|
|
775
800
|
};
|
|
776
801
|
this.buildCustomComponentTemplate = (ext) => {
|
|
777
802
|
const Adapter = this.Adapter;
|
|
778
803
|
const data = !this.isSupportRecursive && this.supportXS
|
|
779
|
-
? `${this.dataKeymap(
|
|
804
|
+
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"nn" /* Shortcuts.NodeName */})`)}`
|
|
780
805
|
: this.isSupportRecursive
|
|
781
806
|
? this.dataKeymap('i:item')
|
|
782
807
|
: this.dataKeymap('i:item,c:1');
|
|
808
|
+
// 此处需要重新引入 xs 函数,否则会出现 ws.f() 在 comp.wxml 和 custom-wrapper.wxml 中永远返回 undefined 的问题 #14599
|
|
783
809
|
return `<import src="./base${ext}" />
|
|
810
|
+
${this.buildXsTemplate()}
|
|
784
811
|
<block ${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="sid">
|
|
785
812
|
<template is="{{'tmpl_0_' + item.nn}}" data="{{${data}}}" />
|
|
786
813
|
</block>`;
|
|
@@ -908,7 +935,7 @@ class BaseTemplate {
|
|
|
908
935
|
buildBaseTemplate() {
|
|
909
936
|
const Adapter = this.Adapter;
|
|
910
937
|
const data = !this.isSupportRecursive && this.supportXS
|
|
911
|
-
? `${this.dataKeymap(
|
|
938
|
+
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"nn" /* Shortcuts.NodeName */})`)}`
|
|
912
939
|
: this.isSupportRecursive
|
|
913
940
|
? this.dataKeymap('i:item')
|
|
914
941
|
: this.dataKeymap('i:item,c:1');
|
|
@@ -933,10 +960,10 @@ class BaseTemplate {
|
|
|
933
960
|
if (value.indexOf('-') > -1) {
|
|
934
961
|
value = `:${value}`;
|
|
935
962
|
}
|
|
936
|
-
return str + `bind${value}="eh"
|
|
963
|
+
return str + ` bind${value}="eh"`;
|
|
937
964
|
}
|
|
938
965
|
else if (attr.startsWith('bind')) {
|
|
939
|
-
return str +
|
|
966
|
+
return str + ` ${attr}="eh"`;
|
|
940
967
|
}
|
|
941
968
|
else if (attr.startsWith('on')) {
|
|
942
969
|
// react, vue3
|
|
@@ -945,22 +972,22 @@ class BaseTemplate {
|
|
|
945
972
|
// 兼容如 vant 某些组件的 bind:a-b 这类属性
|
|
946
973
|
value = `:${value}`;
|
|
947
974
|
}
|
|
948
|
-
return str + `bind${value}="eh"
|
|
975
|
+
return str + ` bind${value}="eh"`;
|
|
949
976
|
}
|
|
950
977
|
else if (attr === 'class') {
|
|
951
|
-
return str + `class="{{i.${"cl" /* Shortcuts.Class */}}}"
|
|
978
|
+
return str + ` class="{{i.${"cl" /* Shortcuts.Class */}}}"`;
|
|
952
979
|
}
|
|
953
980
|
else if (attr === 'style') {
|
|
954
|
-
return str + `style="{{i.${"st" /* Shortcuts.Style */}}}"
|
|
981
|
+
return str + ` style="{{i.${"st" /* Shortcuts.Style */}}}"`;
|
|
955
982
|
}
|
|
956
983
|
const patchValue = patcher[attr];
|
|
957
984
|
if (isBooleanStringLiteral(patchValue) || isNumber(patchValue) || isString(patchValue)) {
|
|
958
985
|
const propValue = this.supportXS
|
|
959
986
|
? `xs.b(i.${toCamelCase(attr)},${patchValue})`
|
|
960
987
|
: `i.${toCamelCase(attr)}===undefined?${patchValue}:i.${toCamelCase(attr)}`;
|
|
961
|
-
return str +
|
|
988
|
+
return str + ` ${attr}="{{${propValue}}}"`;
|
|
962
989
|
}
|
|
963
|
-
return str +
|
|
990
|
+
return str + ` ${attr}="{{i.${toCamelCase(attr)}}}"`;
|
|
964
991
|
}, '');
|
|
965
992
|
}
|
|
966
993
|
buildComponentTemplate(comp, level) {
|
|
@@ -984,6 +1011,8 @@ class BaseTemplate {
|
|
|
984
1011
|
}
|
|
985
1012
|
else {
|
|
986
1013
|
const data = isUseXs
|
|
1014
|
+
// TODO: 此处直接 c+1,不是最优解,变量 c 的作用是监测组件嵌套的层级是否大于 baselevel
|
|
1015
|
+
// 但目前的监测方法用于所有组件嵌套的总和,应该分开组件计算,单个组件嵌套层级大于 baselevel 时,再进入 comp 组件中进行新的嵌套
|
|
987
1016
|
? `${this.dataKeymap(`i:item,c:c+1,l:xs.f(l,item.${"nn" /* Shortcuts.NodeName */})`)}`
|
|
988
1017
|
: this.isSupportRecursive
|
|
989
1018
|
? `${this.dataKeymap('i:item')}`
|
|
@@ -1106,13 +1135,16 @@ class BaseTemplate {
|
|
|
1106
1135
|
if (isFunction(this.modifyThirdPartyLoopBody)) {
|
|
1107
1136
|
child = this.modifyThirdPartyLoopBody(child, compName);
|
|
1108
1137
|
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1138
|
+
const children = this.voidElements.has(compName)
|
|
1139
|
+
? ''
|
|
1140
|
+
: `
|
|
1112
1141
|
<block ${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="sid">
|
|
1113
1142
|
${child}
|
|
1114
1143
|
</block>
|
|
1115
|
-
|
|
1144
|
+
`;
|
|
1145
|
+
template += `
|
|
1146
|
+
<template name="tmpl_${level}_${compName}">
|
|
1147
|
+
<${compName} ${this.buildThirdPartyAttr(attrs, this.thirdPartyPatcher[compName] || {})} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${compName}>
|
|
1116
1148
|
</template>
|
|
1117
1149
|
`;
|
|
1118
1150
|
}
|
|
@@ -1142,7 +1174,7 @@ class BaseTemplate {
|
|
|
1142
1174
|
getAttrValue(value, _key, _nodeName) {
|
|
1143
1175
|
return `{${value}}`;
|
|
1144
1176
|
}
|
|
1145
|
-
buildXsTemplate() {
|
|
1177
|
+
buildXsTemplate(_filePath) {
|
|
1146
1178
|
return '';
|
|
1147
1179
|
}
|
|
1148
1180
|
mergeComponents(ctx, patch) {
|
|
@@ -1269,6 +1301,7 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1269
1301
|
const listA = Array.from(isLoopCompsSet).map(item => { var _a; return ((_a = componentsAlias[item]) === null || _a === void 0 ? void 0 : _a._num) || item; });
|
|
1270
1302
|
const listB = hasMaxComps.map(item => { var _a; return ((_a = componentsAlias[item]) === null || _a === void 0 ? void 0 : _a._num) || item; });
|
|
1271
1303
|
const containerLevel = this.baseLevel - 1;
|
|
1304
|
+
// l >= containerLevel 是为了避免 baselevel 倒数两三层几层组件恰好不是 listA 中的组件,而最后一个组件又刚好是 listA 的组件,导致出现 l >= baselevel 却没有走入新的嵌套循环的问题 #14883
|
|
1272
1305
|
return `function (l, n, s) {
|
|
1273
1306
|
var a = ${JSON.stringify(listA)}
|
|
1274
1307
|
var b = ${JSON.stringify(listB)}
|
|
@@ -1283,7 +1316,7 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1283
1316
|
}
|
|
1284
1317
|
l = depth
|
|
1285
1318
|
}
|
|
1286
|
-
if (l
|
|
1319
|
+
if (l >= ${containerLevel}) {
|
|
1287
1320
|
return 'tmpl_${containerLevel}_${"container" /* Shortcuts.Container */}'
|
|
1288
1321
|
}
|
|
1289
1322
|
return 'tmpl_' + l + '_' + n
|