@tarojs/shared 3.7.0-alpha.0 → 3.7.0-alpha.10
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/dist/index.d.ts +14 -24
- package/dist/index.js +62 -21
- package/dist/index.js.map +1 -1
- package/dist/shared.esm.d.ts +14 -24
- package/dist/shared.esm.js +62 -21
- package/dist/shared.esm.js.map +1 -1
- package/dist/template.d.ts +7 -4
- package/dist/template.js +118 -75
- package/dist/template.js.map +1 -1
- package/package.json +1 -1
package/dist/template.js
CHANGED
|
@@ -79,7 +79,7 @@ const Input = {
|
|
|
79
79
|
focus: DEFAULT_FALSE,
|
|
80
80
|
'confirm-type': singleQuote('done'),
|
|
81
81
|
'confirm-hold': DEFAULT_FALSE,
|
|
82
|
-
cursor: '
|
|
82
|
+
cursor: '-1',
|
|
83
83
|
'selection-start': '-1',
|
|
84
84
|
'selection-end': '-1',
|
|
85
85
|
bindInput: NO_DEFAULT_VALUE,
|
|
@@ -377,16 +377,21 @@ class Events {
|
|
|
377
377
|
this.callbacks = (_a = opts === null || opts === void 0 ? void 0 : opts.callbacks) !== null && _a !== void 0 ? _a : {};
|
|
378
378
|
}
|
|
379
379
|
on(eventName, callback, context) {
|
|
380
|
-
let event,
|
|
380
|
+
let event, tail, _eventName;
|
|
381
381
|
if (!callback) {
|
|
382
382
|
return this;
|
|
383
383
|
}
|
|
384
|
-
eventName
|
|
384
|
+
if (typeof eventName === 'symbol') {
|
|
385
|
+
_eventName = [eventName];
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
_eventName = eventName.split(Events.eventSplitter);
|
|
389
|
+
}
|
|
385
390
|
this.callbacks || (this.callbacks = {});
|
|
386
391
|
const calls = this.callbacks;
|
|
387
|
-
while ((event =
|
|
388
|
-
list = calls[event];
|
|
389
|
-
node = list ? list.tail : {};
|
|
392
|
+
while ((event = _eventName.shift())) {
|
|
393
|
+
const list = calls[event];
|
|
394
|
+
const node = list ? list.tail : {};
|
|
390
395
|
node.next = tail = {};
|
|
391
396
|
node.context = context;
|
|
392
397
|
node.callback = callback;
|
|
@@ -406,7 +411,7 @@ class Events {
|
|
|
406
411
|
return this;
|
|
407
412
|
}
|
|
408
413
|
off(events, callback, context) {
|
|
409
|
-
let event, calls,
|
|
414
|
+
let event, calls, _events;
|
|
410
415
|
if (!(calls = this.callbacks)) {
|
|
411
416
|
return this;
|
|
412
417
|
}
|
|
@@ -414,17 +419,22 @@ class Events {
|
|
|
414
419
|
delete this.callbacks;
|
|
415
420
|
return this;
|
|
416
421
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
422
|
+
if (typeof events === 'symbol') {
|
|
423
|
+
_events = [events];
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
_events = events ? events.split(Events.eventSplitter) : Object.keys(calls);
|
|
427
|
+
}
|
|
428
|
+
while ((event = _events.shift())) {
|
|
429
|
+
let node = calls[event];
|
|
420
430
|
delete calls[event];
|
|
421
431
|
if (!node || !(callback || context)) {
|
|
422
432
|
continue;
|
|
423
433
|
}
|
|
424
|
-
tail = node.tail;
|
|
434
|
+
const tail = node.tail;
|
|
425
435
|
while ((node = node.next) !== tail) {
|
|
426
|
-
cb = node.callback;
|
|
427
|
-
ctx = node.context;
|
|
436
|
+
const cb = node.callback;
|
|
437
|
+
const ctx = node.context;
|
|
428
438
|
if ((callback && cb !== callback) || (context && ctx !== context)) {
|
|
429
439
|
this.on(event, cb, ctx);
|
|
430
440
|
}
|
|
@@ -432,18 +442,22 @@ class Events {
|
|
|
432
442
|
}
|
|
433
443
|
return this;
|
|
434
444
|
}
|
|
435
|
-
trigger(events) {
|
|
436
|
-
let event, node, calls,
|
|
445
|
+
trigger(events, ...args) {
|
|
446
|
+
let event, node, calls, _events;
|
|
437
447
|
if (!(calls = this.callbacks)) {
|
|
438
448
|
return this;
|
|
439
449
|
}
|
|
440
|
-
events
|
|
441
|
-
|
|
442
|
-
|
|
450
|
+
if (typeof events === 'symbol') {
|
|
451
|
+
_events = [events];
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
_events = events.split(Events.eventSplitter);
|
|
455
|
+
}
|
|
456
|
+
while ((event = _events.shift())) {
|
|
443
457
|
if ((node = calls[event])) {
|
|
444
|
-
tail = node.tail;
|
|
458
|
+
const tail = node.tail;
|
|
445
459
|
while ((node = node.next) !== tail) {
|
|
446
|
-
node.callback.apply(node.context || this,
|
|
460
|
+
node.callback.apply(node.context || this, args);
|
|
447
461
|
}
|
|
448
462
|
}
|
|
449
463
|
}
|
|
@@ -475,7 +489,7 @@ const defaultMiniLifecycle = {
|
|
|
475
489
|
'onReachBottom',
|
|
476
490
|
'onPageScroll',
|
|
477
491
|
'onResize',
|
|
478
|
-
'onTabItemTap',
|
|
492
|
+
'defer:onTabItemTap',
|
|
479
493
|
'onTitleClick',
|
|
480
494
|
'onOptionMenuClick',
|
|
481
495
|
'onPopMenuClick',
|
|
@@ -596,6 +610,9 @@ new TaroHooks({
|
|
|
596
610
|
modifySetAttrPayload: TaroHook(HOOK_TYPE.SINGLE),
|
|
597
611
|
modifyRmAttrPayload: TaroHook(HOOK_TYPE.SINGLE),
|
|
598
612
|
onAddEvent: TaroHook(HOOK_TYPE.SINGLE),
|
|
613
|
+
proxyToRaw: TaroHook(HOOK_TYPE.SINGLE, function (proxyObj) {
|
|
614
|
+
return proxyObj;
|
|
615
|
+
}),
|
|
599
616
|
modifyMpEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
600
617
|
modifyMpEventImpl: TaroHook(HOOK_TYPE.SINGLE, function (e) {
|
|
601
618
|
try {
|
|
@@ -606,7 +623,12 @@ new TaroHooks({
|
|
|
606
623
|
console.warn('[Taro modifyMpEvent hook Error]: ' + (error === null || error === void 0 ? void 0 : error.message));
|
|
607
624
|
}
|
|
608
625
|
}),
|
|
626
|
+
injectNewStyleProperties: TaroHook(HOOK_TYPE.SINGLE),
|
|
609
627
|
modifyTaroEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
628
|
+
dispatchTaroEvent: TaroHook(HOOK_TYPE.SINGLE, (e, node) => {
|
|
629
|
+
node.dispatchEvent(e);
|
|
630
|
+
}),
|
|
631
|
+
dispatchTaroEventFinish: TaroHook(HOOK_TYPE.MULTI),
|
|
610
632
|
modifyDispatchEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
611
633
|
initNativeApi: TaroHook(HOOK_TYPE.MULTI),
|
|
612
634
|
patchElement: TaroHook(HOOK_TYPE.MULTI)
|
|
@@ -724,6 +746,7 @@ const weixinAdapter = {
|
|
|
724
746
|
};
|
|
725
747
|
class BaseTemplate {
|
|
726
748
|
constructor() {
|
|
749
|
+
this._baseLevel = 0;
|
|
727
750
|
this.exportExpr = 'module.exports =';
|
|
728
751
|
this.thirdPartyPatcher = {};
|
|
729
752
|
this.supportXS = false;
|
|
@@ -743,19 +766,23 @@ class BaseTemplate {
|
|
|
743
766
|
};
|
|
744
767
|
this.buildBaseComponentTemplate = (ext) => {
|
|
745
768
|
const data = !this.isSupportRecursive && this.supportXS
|
|
746
|
-
? this.dataKeymap('i:i,l:l')
|
|
747
|
-
: this.
|
|
769
|
+
? this.dataKeymap('i:i,c:1,l:l')
|
|
770
|
+
: this.isSupportRecursive
|
|
771
|
+
? this.dataKeymap('i:i')
|
|
772
|
+
: this.dataKeymap('i:i,c:1');
|
|
748
773
|
return `<import src="./base${ext}" />
|
|
749
|
-
<template is="tmpl_0_
|
|
774
|
+
<template is="{{'tmpl_0_' + i.nn}}" data="{{${data}}}" />`;
|
|
750
775
|
};
|
|
751
776
|
this.buildCustomComponentTemplate = (ext) => {
|
|
752
777
|
const Adapter = this.Adapter;
|
|
753
778
|
const data = !this.isSupportRecursive && this.supportXS
|
|
754
|
-
? `${this.dataKeymap('i:item,l:\'\'')}`
|
|
755
|
-
: this.
|
|
779
|
+
? `${this.dataKeymap('i:item,c:1,l:\'\'')}`
|
|
780
|
+
: this.isSupportRecursive
|
|
781
|
+
? this.dataKeymap('i:item')
|
|
782
|
+
: this.dataKeymap('i:item,c:1');
|
|
756
783
|
return `<import src="./base${ext}" />
|
|
757
784
|
<block ${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="sid">
|
|
758
|
-
<template is="
|
|
785
|
+
<template is="{{'tmpl_0_' + item.nn}}" data="{{${data}}}" />
|
|
759
786
|
</block>`;
|
|
760
787
|
};
|
|
761
788
|
this.buildXScript = () => {
|
|
@@ -765,9 +792,6 @@ class BaseTemplate {
|
|
|
765
792
|
return a === undefined ? b : a
|
|
766
793
|
},
|
|
767
794
|
c: ${this.buildXSTepFocus("nn" /* Shortcuts.NodeName */)},
|
|
768
|
-
d: function (i, v) {
|
|
769
|
-
return i === undefined ? v : i
|
|
770
|
-
},
|
|
771
795
|
e: function (n) {
|
|
772
796
|
return 'tmpl_' + n + '_${"container" /* Shortcuts.Container */}'
|
|
773
797
|
},
|
|
@@ -775,6 +799,12 @@ class BaseTemplate {
|
|
|
775
799
|
}`;
|
|
776
800
|
};
|
|
777
801
|
}
|
|
802
|
+
set baseLevel(lv) {
|
|
803
|
+
this._baseLevel = lv;
|
|
804
|
+
}
|
|
805
|
+
get baseLevel() {
|
|
806
|
+
return this._baseLevel;
|
|
807
|
+
}
|
|
778
808
|
buildAttribute(attrs, nodeName) {
|
|
779
809
|
return Object.keys(attrs)
|
|
780
810
|
.map(k => `${k}="${k.startsWith('bind') || k.startsWith('on') || k.startsWith('catch') ? attrs[k] : `{${this.getAttrValue(attrs[k], k, nodeName)}}`}" `)
|
|
@@ -810,6 +840,10 @@ class BaseTemplate {
|
|
|
810
840
|
else if (isBooleanStringLiteral(propValue) || isNumber(+propValue)) {
|
|
811
841
|
const propInCamelCase = toCamelCase(prop);
|
|
812
842
|
const propAlias = componentAlias[propInCamelCase] || propInCamelCase;
|
|
843
|
+
// cursor 默认取最后输入框最后一位 fix #13809
|
|
844
|
+
if (prop === 'cursor') {
|
|
845
|
+
propValue = `i.${componentAlias.value}?i.${componentAlias.value}.length:-1`;
|
|
846
|
+
}
|
|
813
847
|
propValue = this.supportXS
|
|
814
848
|
? `xs.b(i.${propAlias},${propValue})`
|
|
815
849
|
: `i.${propAlias}===undefined?${propValue}:i.${propAlias}`;
|
|
@@ -874,12 +908,19 @@ class BaseTemplate {
|
|
|
874
908
|
buildBaseTemplate() {
|
|
875
909
|
const Adapter = this.Adapter;
|
|
876
910
|
const data = !this.isSupportRecursive && this.supportXS
|
|
877
|
-
? `${this.dataKeymap('i:item,l:\'\'')}`
|
|
878
|
-
: this.
|
|
911
|
+
? `${this.dataKeymap('i:item,c:1,l:\'\'')}`
|
|
912
|
+
: this.isSupportRecursive
|
|
913
|
+
? this.dataKeymap('i:item')
|
|
914
|
+
: this.dataKeymap('i:item,c:1');
|
|
915
|
+
const xs = this.supportXS
|
|
916
|
+
? (this.isSupportRecursive
|
|
917
|
+
? `xs.a(0, item.${"nn" /* Shortcuts.NodeName */})`
|
|
918
|
+
: `xs.a(0, item.${"nn" /* Shortcuts.NodeName */}, '')`)
|
|
919
|
+
: "'tmpl_0_' + item.nn";
|
|
879
920
|
return `${this.buildXsTemplate()}
|
|
880
921
|
<template name="taro_tmpl">
|
|
881
922
|
<block ${Adapter.for}="{{root.cn}}" ${Adapter.key}="sid">
|
|
882
|
-
<template is="
|
|
923
|
+
<template is="{{${xs}}}" data="{{${data}}}" />
|
|
883
924
|
</block>
|
|
884
925
|
</template>
|
|
885
926
|
`;
|
|
@@ -927,15 +968,40 @@ class BaseTemplate {
|
|
|
927
968
|
? this.buildFocusComponentTemplate(comp, level)
|
|
928
969
|
: this.buildStandardComponentTemplate(comp, level);
|
|
929
970
|
}
|
|
971
|
+
getChildrenTemplate(level) {
|
|
972
|
+
const { isSupportRecursive, supportXS } = this;
|
|
973
|
+
const isLastRecursiveComp = !isSupportRecursive && level + 1 === this.baseLevel;
|
|
974
|
+
const isUseXs = !this.isSupportRecursive && this.supportXS;
|
|
975
|
+
if (isLastRecursiveComp) {
|
|
976
|
+
const data = isUseXs
|
|
977
|
+
? `${this.dataKeymap('i:item,c:c,l:l')}`
|
|
978
|
+
: this.isSupportRecursive
|
|
979
|
+
? this.dataKeymap('i:item')
|
|
980
|
+
: this.dataKeymap('i:item,c:c');
|
|
981
|
+
return supportXS
|
|
982
|
+
? `<template is="{{xs.e(${level})}}" data="{{${data}}}" />`
|
|
983
|
+
: `<template is="tmpl_${level}_${"container" /* Shortcuts.Container */}" data="{{${data}}}" />`;
|
|
984
|
+
}
|
|
985
|
+
else {
|
|
986
|
+
const data = isUseXs
|
|
987
|
+
? `${this.dataKeymap(`i:item,c:c+1,l:xs.f(l,item.${"nn" /* Shortcuts.NodeName */})`)}`
|
|
988
|
+
: this.isSupportRecursive
|
|
989
|
+
? `${this.dataKeymap('i:item')}`
|
|
990
|
+
: `${this.dataKeymap('i:item,c:c+1')}`;
|
|
991
|
+
const xs = !this.isSupportRecursive
|
|
992
|
+
? `xs.a(c, item.${"nn" /* Shortcuts.NodeName */}, l)`
|
|
993
|
+
: `xs.a(0, item.${"nn" /* Shortcuts.NodeName */})`;
|
|
994
|
+
return supportXS
|
|
995
|
+
? `<template is="{{${xs}}}" data="{{${data}}}" />`
|
|
996
|
+
: isSupportRecursive
|
|
997
|
+
? `<template is="{{'tmpl_0_' + item.nn}}" data="{{${data}}}" />`
|
|
998
|
+
: `<template is="{{'tmpl_' + c + '_' + item.nn}}" data="{{${data}}}" />`;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
930
1001
|
getChildren(comp, level) {
|
|
931
|
-
const { isSupportRecursive, Adapter
|
|
1002
|
+
const { isSupportRecursive, Adapter } = this;
|
|
932
1003
|
const nextLevel = isSupportRecursive ? 0 : level + 1;
|
|
933
|
-
|
|
934
|
-
? `${this.dataKeymap('i:item,l:l')}`
|
|
935
|
-
: this.dataKeymap('i:item');
|
|
936
|
-
let child = supportXS
|
|
937
|
-
? `<template is="{{xs.e(${isSupportRecursive ? 0 : 'cid+1'})}}" data="{{${data}}}" />`
|
|
938
|
-
: `<template is="tmpl_${nextLevel}_${"container" /* Shortcuts.Container */}" data="{{${data}}}" />`;
|
|
1004
|
+
let child = this.getChildrenTemplate(nextLevel);
|
|
939
1005
|
if (isFunction(this.modifyLoopBody)) {
|
|
940
1006
|
child = this.modifyLoopBody(child, comp.nodeName);
|
|
941
1007
|
}
|
|
@@ -962,7 +1028,7 @@ class BaseTemplate {
|
|
|
962
1028
|
delete attrs.focus;
|
|
963
1029
|
let res = `
|
|
964
1030
|
<template name="tmpl_${level}_${nodeAlias}">
|
|
965
|
-
<template is="{{${templateName}}}" data="{{${this.dataKeymap('i:i')
|
|
1031
|
+
<template is="{{${templateName}}}" data="{{${this.isSupportRecursive ? this.dataKeymap('i:i') : this.dataKeymap('i:i,c:c')}}}" />
|
|
966
1032
|
</template>
|
|
967
1033
|
|
|
968
1034
|
<template name="tmpl_${level}_${nodeAlias}_focus">
|
|
@@ -1024,9 +1090,6 @@ class BaseTemplate {
|
|
|
1024
1090
|
const { Adapter, isSupportRecursive, supportXS, nestElements } = this;
|
|
1025
1091
|
const nextLevel = isSupportRecursive ? 0 : level + 1;
|
|
1026
1092
|
let template = '';
|
|
1027
|
-
const data = !isSupportRecursive && supportXS
|
|
1028
|
-
? `${this.dataKeymap('i:item,l:l')}`
|
|
1029
|
-
: this.dataKeymap('i:item');
|
|
1030
1093
|
componentConfig.thirdPartyComponents.forEach((attrs, compName) => {
|
|
1031
1094
|
if (compName === 'custom-wrapper') {
|
|
1032
1095
|
template += `
|
|
@@ -1039,9 +1102,7 @@ class BaseTemplate {
|
|
|
1039
1102
|
else {
|
|
1040
1103
|
if (!isSupportRecursive && supportXS && nestElements.has(compName) && level + 1 > nestElements.get(compName))
|
|
1041
1104
|
return;
|
|
1042
|
-
let child =
|
|
1043
|
-
? `<template is="{{xs.e(${isSupportRecursive ? 0 : 'cid+1'})}}" data="{{${data}}}" />`
|
|
1044
|
-
: `<template is="tmpl_${nextLevel}_${"container" /* Shortcuts.Container */}" data="{{${data}}}" />`;
|
|
1105
|
+
let child = this.getChildrenTemplate(nextLevel);
|
|
1045
1106
|
if (isFunction(this.modifyThirdPartyLoopBody)) {
|
|
1046
1107
|
child = this.modifyThirdPartyLoopBody(child, compName);
|
|
1047
1108
|
}
|
|
@@ -1058,27 +1119,14 @@ class BaseTemplate {
|
|
|
1058
1119
|
});
|
|
1059
1120
|
return template;
|
|
1060
1121
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
if
|
|
1064
|
-
|
|
1065
|
-
<template is="tmpl_0_#text" data="{{i:i}}" />
|
|
1122
|
+
// 最后一层的 comp 需要引用 container 进行重新的模版循环,其他情况不需要 container
|
|
1123
|
+
buildContainerTemplate(level) {
|
|
1124
|
+
const tmpl = `<block ${this.Adapter.if}="{{i.nn === '${this.componentsAlias['#text']._num}'}}">
|
|
1125
|
+
<template is="tmpl_0_${this.componentsAlias['#text']._num}" data="{{${this.dataKeymap('i:i')}}}" />
|
|
1066
1126
|
</block>
|
|
1067
1127
|
<block ${this.Adapter.else}>
|
|
1068
1128
|
${!this.isSupportRecursive && this.supportXS ? '<comp i="{{i}}" l="{{l}}" />' : '<comp i="{{i}}" />'}
|
|
1069
1129
|
</block>`;
|
|
1070
|
-
}
|
|
1071
|
-
else {
|
|
1072
|
-
const xs = !this.isSupportRecursive
|
|
1073
|
-
? `xs.a(${level}, i.${"nn" /* Shortcuts.NodeName */}, l)`
|
|
1074
|
-
: `xs.a(${level}, i.${"nn" /* Shortcuts.NodeName */})`;
|
|
1075
|
-
const data = !this.isSupportRecursive
|
|
1076
|
-
? `${this.dataKeymap(`i:i,cid:${level},l:xs.f(l,i.${"nn" /* Shortcuts.NodeName */})`)}`
|
|
1077
|
-
: `${this.dataKeymap('i:i')}`;
|
|
1078
|
-
tmpl = this.supportXS
|
|
1079
|
-
? `<template is="{{${xs}}}" data="{{${data}}}" />`
|
|
1080
|
-
: `<template is="{{'tmpl_${level}_' + i.${"nn" /* Shortcuts.NodeName */}}}" data="{{${this.dataKeymap('i:i')}}}" />`;
|
|
1081
|
-
}
|
|
1082
1130
|
return `
|
|
1083
1131
|
<template name="tmpl_${level}_${"container" /* Shortcuts.Container */}">
|
|
1084
1132
|
${tmpl}
|
|
@@ -1138,7 +1186,6 @@ class RecursiveTemplate extends BaseTemplate {
|
|
|
1138
1186
|
}, template);
|
|
1139
1187
|
template += this.buildPlainTextTemplate(ZERO_FLOOR);
|
|
1140
1188
|
template += this.buildThirdPartyTemplate(ZERO_FLOOR, componentConfig);
|
|
1141
|
-
template += this.buildContainerTemplate(ZERO_FLOOR);
|
|
1142
1189
|
return template;
|
|
1143
1190
|
};
|
|
1144
1191
|
}
|
|
@@ -1165,15 +1212,9 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1165
1212
|
return template;
|
|
1166
1213
|
};
|
|
1167
1214
|
}
|
|
1168
|
-
set baseLevel(lv) {
|
|
1169
|
-
this._baseLevel = lv;
|
|
1170
|
-
}
|
|
1171
|
-
get baseLevel() {
|
|
1172
|
-
return this._baseLevel;
|
|
1173
|
-
}
|
|
1174
1215
|
buildFloor(level, components, restart = false) {
|
|
1175
1216
|
if (restart)
|
|
1176
|
-
return this.buildContainerTemplate(level
|
|
1217
|
+
return this.buildContainerTemplate(level);
|
|
1177
1218
|
let template = components.reduce((current, nodeName) => {
|
|
1178
1219
|
const attributes = this.miniComponents[nodeName];
|
|
1179
1220
|
const nodeAlias = this.componentsAlias[nodeName]._num;
|
|
@@ -1181,12 +1222,11 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1181
1222
|
}, '');
|
|
1182
1223
|
template += this.buildPlainTextTemplate(level);
|
|
1183
1224
|
template += this.buildThirdPartyTemplate(level, this.componentConfig);
|
|
1184
|
-
template += this.buildContainerTemplate(level, restart);
|
|
1185
1225
|
return template;
|
|
1186
1226
|
}
|
|
1187
1227
|
buildOptimizeFloor(level, components, restart = false) {
|
|
1188
1228
|
if (restart)
|
|
1189
|
-
return this.buildContainerTemplate(level
|
|
1229
|
+
return this.buildContainerTemplate(level);
|
|
1190
1230
|
let template = components.reduce((current, nodeName) => {
|
|
1191
1231
|
if (level !== 0) {
|
|
1192
1232
|
if (!this.nestElements.has(nodeName)) {
|
|
@@ -1208,7 +1248,6 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1208
1248
|
if (level === 0)
|
|
1209
1249
|
template += this.buildPlainTextTemplate(level);
|
|
1210
1250
|
template += this.buildThirdPartyTemplate(level, this.componentConfig);
|
|
1211
|
-
template += this.buildContainerTemplate(level);
|
|
1212
1251
|
return template;
|
|
1213
1252
|
}
|
|
1214
1253
|
buildXSTmplName() {
|
|
@@ -1229,6 +1268,7 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1229
1268
|
const componentsAlias = this.componentsAlias;
|
|
1230
1269
|
const listA = Array.from(isLoopCompsSet).map(item => { var _a; return ((_a = componentsAlias[item]) === null || _a === void 0 ? void 0 : _a._num) || item; });
|
|
1231
1270
|
const listB = hasMaxComps.map(item => { var _a; return ((_a = componentsAlias[item]) === null || _a === void 0 ? void 0 : _a._num) || item; });
|
|
1271
|
+
const containerLevel = this.baseLevel - 1;
|
|
1232
1272
|
return `function (l, n, s) {
|
|
1233
1273
|
var a = ${JSON.stringify(listA)}
|
|
1234
1274
|
var b = ${JSON.stringify(listB)}
|
|
@@ -1243,6 +1283,9 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1243
1283
|
}
|
|
1244
1284
|
l = depth
|
|
1245
1285
|
}
|
|
1286
|
+
if (l === ${containerLevel}) {
|
|
1287
|
+
return 'tmpl_${containerLevel}_${"container" /* Shortcuts.Container */}'
|
|
1288
|
+
}
|
|
1246
1289
|
return 'tmpl_' + l + '_' + n
|
|
1247
1290
|
}`;
|
|
1248
1291
|
}
|