@tarojs/shared 4.0.6-alpha.0 → 4.0.7-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/dist/components.js +1 -0
- package/dist/components.js.map +1 -1
- package/dist/index.cjs.js +8 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/runtime-hooks.d.ts +1 -1
- package/dist/runtime-hooks.js.map +1 -1
- package/dist/shared.esm.js +8 -5
- package/dist/shared.esm.js.map +1 -1
- package/dist/shortcuts.d.ts +5 -4
- package/dist/shortcuts.js +4 -3
- package/dist/shortcuts.js.map +1 -1
- package/dist/template.d.ts +5 -1
- package/dist/template.js +75 -65
- package/dist/template.js.map +1 -1
- package/dist/utils.js +3 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/template.js
CHANGED
|
@@ -310,6 +310,7 @@ const voidElements = new Set([
|
|
|
310
310
|
const nestElements = new Map([
|
|
311
311
|
['view', -1],
|
|
312
312
|
['catch-view', -1],
|
|
313
|
+
['click-view', -1],
|
|
313
314
|
['cover-view', -1],
|
|
314
315
|
['static-view', -1],
|
|
315
316
|
['pure-view', -1],
|
|
@@ -342,14 +343,15 @@ function isBooleanStringLiteral(o) {
|
|
|
342
343
|
exports.Shortcuts = void 0;
|
|
343
344
|
(function (Shortcuts) {
|
|
344
345
|
Shortcuts["Container"] = "container";
|
|
345
|
-
Shortcuts["Childnodes"] = "
|
|
346
|
+
Shortcuts["Childnodes"] = "c";
|
|
346
347
|
Shortcuts["Text"] = "v";
|
|
347
348
|
Shortcuts["NodeType"] = "nt";
|
|
348
|
-
Shortcuts["NodeName"] = "
|
|
349
|
+
Shortcuts["NodeName"] = "n";
|
|
349
350
|
// Attrtibutes
|
|
350
351
|
Shortcuts["Style"] = "st";
|
|
351
|
-
Shortcuts["Class"] = "
|
|
352
|
+
Shortcuts["Class"] = "l";
|
|
352
353
|
Shortcuts["Src"] = "src";
|
|
354
|
+
Shortcuts["Sid"] = "s";
|
|
353
355
|
})(exports.Shortcuts || (exports.Shortcuts = {}));
|
|
354
356
|
|
|
355
357
|
var PLATFORM_TYPE;
|
|
@@ -682,12 +684,13 @@ function getComponentsAlias(origin) {
|
|
|
682
684
|
StaticImage: origin.Image,
|
|
683
685
|
StaticText: origin.Text,
|
|
684
686
|
PureView: viewAttrs,
|
|
685
|
-
CatchView: viewAttrs
|
|
687
|
+
CatchView: viewAttrs,
|
|
688
|
+
ClickView: viewAttrs,
|
|
686
689
|
};
|
|
687
690
|
origin = Object.assign(Object.assign({}, origin), extraList);
|
|
688
691
|
Object.keys(origin)
|
|
689
692
|
.sort((a, b) => {
|
|
690
|
-
const reg = /^(Static|Pure|Catch)*(View|Image|Text)$/;
|
|
693
|
+
const reg = /^(Static|Pure|Catch|Click)*(View|Image|Text)$/;
|
|
691
694
|
const isACommonly = reg.test(a);
|
|
692
695
|
const isBCommonly = reg.test(b);
|
|
693
696
|
if (isACommonly && isBCommonly) {
|
|
@@ -741,7 +744,7 @@ function indent(str, size) {
|
|
|
741
744
|
*/
|
|
742
745
|
const styles = {
|
|
743
746
|
style: `i.${"st" /* Shortcuts.Style */}`,
|
|
744
|
-
class: `i.${"
|
|
747
|
+
class: `i.${"l" /* Shortcuts.Class */}`
|
|
745
748
|
};
|
|
746
749
|
const events = {
|
|
747
750
|
bindtap: 'eh'
|
|
@@ -760,6 +763,7 @@ const weixinAdapter = {
|
|
|
760
763
|
class BaseTemplate {
|
|
761
764
|
constructor() {
|
|
762
765
|
this._baseLevel = 0;
|
|
766
|
+
this._isUseXS = true;
|
|
763
767
|
this.exportExpr = 'module.exports =';
|
|
764
768
|
this.thirdPartyPatcher = {};
|
|
765
769
|
this.supportXS = false;
|
|
@@ -779,29 +783,26 @@ class BaseTemplate {
|
|
|
779
783
|
return template;
|
|
780
784
|
};
|
|
781
785
|
this.buildBaseComponentTemplate = (ext) => {
|
|
782
|
-
const data = !this.isSupportRecursive && this.
|
|
783
|
-
? this.dataKeymap(`i:i,c:1,l:xs.f('',i.${"
|
|
786
|
+
const data = !this.isSupportRecursive && this.isUseXS
|
|
787
|
+
? this.dataKeymap(`i:i,c:1,l:xs.f('',i.${"n" /* Shortcuts.NodeName */})`)
|
|
784
788
|
: this.isSupportRecursive
|
|
785
789
|
? this.dataKeymap('i:i')
|
|
786
790
|
: this.dataKeymap('i:i,c:1');
|
|
787
791
|
// 此处需要重新引入 xs 函数,否则会出现 ws.f() 在 comp.wxml 和 custom-wrapper.wxml 中永远返回 undefined 的问题 #14599
|
|
788
792
|
return `<import src="./base${ext}" />
|
|
789
|
-
${this.
|
|
790
|
-
<template is="{{'tmpl_0_' + i.nn}}" data="{{${data}}}" />`;
|
|
793
|
+
${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + i.${"n" /* Shortcuts.NodeName */}}}" data="{{${data}}}" />`;
|
|
791
794
|
};
|
|
792
795
|
this.buildCustomComponentTemplate = (ext) => {
|
|
793
796
|
const Adapter = this.Adapter;
|
|
794
|
-
const data = !this.isSupportRecursive && this.
|
|
795
|
-
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"
|
|
797
|
+
const data = !this.isSupportRecursive && this.isUseXS
|
|
798
|
+
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"n" /* Shortcuts.NodeName */})`)}`
|
|
796
799
|
: this.isSupportRecursive
|
|
797
800
|
? this.dataKeymap('i:item')
|
|
798
801
|
: this.dataKeymap('i:item,c:1');
|
|
799
802
|
// 此处需要重新引入 xs 函数,否则会出现 ws.f() 在 comp.wxml 和 custom-wrapper.wxml 中永远返回 undefined 的问题 #14599
|
|
800
803
|
return `<import src="./base${ext}" />
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
<template is="{{'tmpl_0_' + item.nn}}" data="{{${data}}}" />
|
|
804
|
-
</block>`;
|
|
804
|
+
${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"n" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${Adapter.for}="{{i.${"c" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"s" /* Shortcuts.Sid */}" />
|
|
805
|
+
`;
|
|
805
806
|
};
|
|
806
807
|
this.buildXScript = () => {
|
|
807
808
|
return `${this.exportExpr} {
|
|
@@ -809,7 +810,7 @@ ${this.buildXsTemplate()}
|
|
|
809
810
|
b: function (a, b) {
|
|
810
811
|
return a === undefined ? b : a
|
|
811
812
|
},
|
|
812
|
-
c: ${this.buildXSTepFocus("
|
|
813
|
+
c: ${this.buildXSTepFocus("n" /* Shortcuts.NodeName */)},
|
|
813
814
|
e: function (n) {
|
|
814
815
|
return 'tmpl_' + n + '_${"container" /* Shortcuts.Container */}'
|
|
815
816
|
},
|
|
@@ -823,6 +824,12 @@ ${this.buildXsTemplate()}
|
|
|
823
824
|
get baseLevel() {
|
|
824
825
|
return this._baseLevel;
|
|
825
826
|
}
|
|
827
|
+
set isUseXS(isUse) {
|
|
828
|
+
this._isUseXS = this.supportXS && isUse;
|
|
829
|
+
}
|
|
830
|
+
get isUseXS() {
|
|
831
|
+
return this._isUseXS;
|
|
832
|
+
}
|
|
826
833
|
buildAttribute(attrs, nodeName) {
|
|
827
834
|
return Object.keys(attrs)
|
|
828
835
|
.map(k => `${k}="${k.startsWith('bind') || k.startsWith('on') || k.startsWith('catch') ? attrs[k] : `{${this.getAttrValue(attrs[k], k, nodeName)}}`}" `)
|
|
@@ -862,7 +869,7 @@ ${this.buildXsTemplate()}
|
|
|
862
869
|
if (prop === 'cursor') {
|
|
863
870
|
propValue = `i.${componentAlias.value}?i.${componentAlias.value}.length:-1`;
|
|
864
871
|
}
|
|
865
|
-
propValue = this.
|
|
872
|
+
propValue = this.isUseXS
|
|
866
873
|
? `xs.b(i.${propAlias},${propValue})`
|
|
867
874
|
: `i.${propAlias}===undefined?${propValue}:i.${propAlias}`;
|
|
868
875
|
}
|
|
@@ -906,6 +913,11 @@ ${this.buildXsTemplate()}
|
|
|
906
913
|
style: comp.style,
|
|
907
914
|
class: comp.class
|
|
908
915
|
};
|
|
916
|
+
result['click-view'] = {
|
|
917
|
+
style: comp.style,
|
|
918
|
+
class: comp.class,
|
|
919
|
+
bindtap: 'eh'
|
|
920
|
+
};
|
|
909
921
|
}
|
|
910
922
|
}
|
|
911
923
|
if (compName === 'slot' || compName === 'slot-view') {
|
|
@@ -925,21 +937,18 @@ ${this.buildXsTemplate()}
|
|
|
925
937
|
}
|
|
926
938
|
buildBaseTemplate() {
|
|
927
939
|
const Adapter = this.Adapter;
|
|
928
|
-
const data = !this.isSupportRecursive && this.
|
|
929
|
-
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"
|
|
940
|
+
const data = !this.isSupportRecursive && this.isUseXS
|
|
941
|
+
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"n" /* Shortcuts.NodeName */})`)}`
|
|
930
942
|
: this.isSupportRecursive
|
|
931
943
|
? this.dataKeymap('i:item')
|
|
932
944
|
: this.dataKeymap('i:item,c:1');
|
|
933
|
-
const xs = this.
|
|
945
|
+
const xs = this.isUseXS
|
|
934
946
|
? (this.isSupportRecursive
|
|
935
|
-
? `xs.a(0, item.${"
|
|
936
|
-
: `xs.a(0, item.${"
|
|
937
|
-
:
|
|
938
|
-
return `${this.
|
|
939
|
-
<template
|
|
940
|
-
<block ${Adapter.for}="{{root.cn}}" ${Adapter.key}="sid">
|
|
941
|
-
<template is="{{${xs}}}" data="{{${data}}}" />
|
|
942
|
-
</block>
|
|
947
|
+
? `xs.a(0, item.${"n" /* Shortcuts.NodeName */})`
|
|
948
|
+
: `xs.a(0, item.${"n" /* Shortcuts.NodeName */}, '')`)
|
|
949
|
+
: `'tmpl_0_' + item.${"n" /* Shortcuts.NodeName */}`;
|
|
950
|
+
return `${this.buildXsImportTemplate()}<template name="taro_tmpl">
|
|
951
|
+
<template is="{{${xs}}}" data="{{${data}}}" ${Adapter.for}="{{root.${"c" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"s" /* Shortcuts.Sid */}" />
|
|
943
952
|
</template>
|
|
944
953
|
`;
|
|
945
954
|
}
|
|
@@ -966,14 +975,14 @@ ${this.buildXsTemplate()}
|
|
|
966
975
|
return str + ` bind${value}="eh"`;
|
|
967
976
|
}
|
|
968
977
|
else if (attr === 'class') {
|
|
969
|
-
return str + ` class="{{i.${"
|
|
978
|
+
return str + ` class="{{i.${"l" /* Shortcuts.Class */}}}"`;
|
|
970
979
|
}
|
|
971
980
|
else if (attr === 'style') {
|
|
972
981
|
return str + ` style="{{i.${"st" /* Shortcuts.Style */}}}"`;
|
|
973
982
|
}
|
|
974
983
|
const patchValue = patcher[attr];
|
|
975
984
|
if (isBooleanStringLiteral(patchValue) || isNumber(patchValue) || isString(patchValue)) {
|
|
976
|
-
const propValue = this.
|
|
985
|
+
const propValue = this.isUseXS
|
|
977
986
|
? `xs.b(i.${toCamelCase(attr)},${patchValue})`
|
|
978
987
|
: `i.${toCamelCase(attr)}===undefined?${patchValue}:i.${toCamelCase(attr)}`;
|
|
979
988
|
return str + ` ${attr}="{{${propValue}}}"`;
|
|
@@ -987,39 +996,40 @@ ${this.buildXsTemplate()}
|
|
|
987
996
|
: this.buildStandardComponentTemplate(comp, level);
|
|
988
997
|
}
|
|
989
998
|
getChildrenTemplate(level) {
|
|
990
|
-
const { isSupportRecursive,
|
|
999
|
+
const { isSupportRecursive, isUseXS, Adapter } = this;
|
|
991
1000
|
const isLastRecursiveComp = !isSupportRecursive && level + 1 === this.baseLevel;
|
|
992
|
-
const
|
|
1001
|
+
const isUnRecursiveXs = !this.isSupportRecursive && isUseXS;
|
|
1002
|
+
const forAttribute = `${Adapter.for}="{{i.${"c" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"s" /* Shortcuts.Sid */}"`;
|
|
993
1003
|
if (isLastRecursiveComp) {
|
|
994
|
-
const data =
|
|
1004
|
+
const data = isUnRecursiveXs
|
|
995
1005
|
? `${this.dataKeymap('i:item,c:c,l:l')}`
|
|
996
1006
|
: this.isSupportRecursive
|
|
997
1007
|
? this.dataKeymap('i:item')
|
|
998
1008
|
: this.dataKeymap('i:item,c:c');
|
|
999
|
-
return
|
|
1000
|
-
? `<template is="{{xs.e(${level})}}" data="{{${data}}}" />`
|
|
1001
|
-
: `<template is="tmpl_${level}_${"container" /* Shortcuts.Container */}" data="{{${data}}}" />`;
|
|
1009
|
+
return isUseXS
|
|
1010
|
+
? `<template is="{{xs.e(${level})}}" data="{{${data}}}" ${forAttribute} />`
|
|
1011
|
+
: `<template is="tmpl_${level}_${"container" /* Shortcuts.Container */}" data="{{${data}}}" ${forAttribute} />`;
|
|
1002
1012
|
}
|
|
1003
1013
|
else {
|
|
1004
|
-
const data =
|
|
1014
|
+
const data = isUnRecursiveXs
|
|
1005
1015
|
// TODO: 此处直接 c+1,不是最优解,变量 c 的作用是监测组件嵌套的层级是否大于 baselevel
|
|
1006
1016
|
// 但目前的监测方法用于所有组件嵌套的总和,应该分开组件计算,单个组件嵌套层级大于 baselevel 时,再进入 comp 组件中进行新的嵌套
|
|
1007
|
-
? `${this.dataKeymap(`i:item,c:c+1,l:xs.f(l,item.${"
|
|
1017
|
+
? `${this.dataKeymap(`i:item,c:c+1,l:xs.f(l,item.${"n" /* Shortcuts.NodeName */})`)}`
|
|
1008
1018
|
: this.isSupportRecursive
|
|
1009
1019
|
? `${this.dataKeymap('i:item')}`
|
|
1010
1020
|
: `${this.dataKeymap('i:item,c:c+1')}`;
|
|
1011
1021
|
const xs = !this.isSupportRecursive
|
|
1012
|
-
? `xs.a(c, item.${"
|
|
1013
|
-
: `xs.a(0, item.${"
|
|
1014
|
-
return
|
|
1015
|
-
? `<template is="{{${xs}}}" data="{{${data}}}" />`
|
|
1022
|
+
? `xs.a(c, item.${"n" /* Shortcuts.NodeName */}, l)`
|
|
1023
|
+
: `xs.a(0, item.${"n" /* Shortcuts.NodeName */})`;
|
|
1024
|
+
return isUseXS
|
|
1025
|
+
? `<template is="{{${xs}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1016
1026
|
: isSupportRecursive
|
|
1017
|
-
? `<template is="{{'tmpl_0_' + item.
|
|
1018
|
-
: `<template is="{{'tmpl_' + c + '_' + item.
|
|
1027
|
+
? `<template is="{{'tmpl_0_' + item.${"n" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1028
|
+
: `<template is="{{'tmpl_' + c + '_' + item.${"n" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`;
|
|
1019
1029
|
}
|
|
1020
1030
|
}
|
|
1021
1031
|
getChildren(comp, level) {
|
|
1022
|
-
const { isSupportRecursive
|
|
1032
|
+
const { isSupportRecursive } = this;
|
|
1023
1033
|
const nextLevel = isSupportRecursive ? 0 : level + 1;
|
|
1024
1034
|
let child = this.getChildrenTemplate(nextLevel);
|
|
1025
1035
|
if (isFunction(this.modifyLoopBody)) {
|
|
@@ -1028,9 +1038,7 @@ ${this.buildXsTemplate()}
|
|
|
1028
1038
|
let children = this.voidElements.has(comp.nodeName)
|
|
1029
1039
|
? ''
|
|
1030
1040
|
: `
|
|
1031
|
-
|
|
1032
|
-
${indent(child, 6)}
|
|
1033
|
-
</block>
|
|
1041
|
+
${indent(child, 6)}
|
|
1034
1042
|
`;
|
|
1035
1043
|
if (isFunction(this.modifyLoopContainer)) {
|
|
1036
1044
|
children = this.modifyLoopContainer(children, comp.nodeName);
|
|
@@ -1042,7 +1050,7 @@ ${this.buildXsTemplate()}
|
|
|
1042
1050
|
const nodeName = comp.nodeName;
|
|
1043
1051
|
const nodeAlias = comp.nodeAlias;
|
|
1044
1052
|
const attrs = Object.assign({}, comp.attributes);
|
|
1045
|
-
const templateName = this.
|
|
1053
|
+
const templateName = this.isUseXS
|
|
1046
1054
|
? `xs.c(i, 'tmpl_${level}_')`
|
|
1047
1055
|
: `i.focus ? 'tmpl_${level}_${nodeAlias}_focus' : 'tmpl_${level}_${nodeAlias}_blur'`;
|
|
1048
1056
|
delete attrs.focus;
|
|
@@ -1052,11 +1060,11 @@ ${this.buildXsTemplate()}
|
|
|
1052
1060
|
</template>
|
|
1053
1061
|
|
|
1054
1062
|
<template name="tmpl_${level}_${nodeAlias}_focus">
|
|
1055
|
-
<${nodeName} ${this.buildAttribute(comp.attributes, nodeName)} id="{{i.uid||i.
|
|
1063
|
+
<${nodeName} ${this.buildAttribute(comp.attributes, nodeName)} id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">${children}</${nodeName}>
|
|
1056
1064
|
</template>
|
|
1057
1065
|
|
|
1058
1066
|
<template name="tmpl_${level}_${nodeAlias}_blur">
|
|
1059
|
-
<${nodeName} ${this.buildAttribute(attrs, nodeName)} id="{{i.uid||i.
|
|
1067
|
+
<${nodeName} ${this.buildAttribute(attrs, nodeName)} id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">${children}</${nodeName}>
|
|
1060
1068
|
</template>
|
|
1061
1069
|
`;
|
|
1062
1070
|
if (isFunction(this.modifyTemplateResult)) {
|
|
@@ -1072,6 +1080,7 @@ ${this.buildXsTemplate()}
|
|
|
1072
1080
|
case 'slot':
|
|
1073
1081
|
case 'slot-view':
|
|
1074
1082
|
case 'catch-view':
|
|
1083
|
+
case 'click-view':
|
|
1075
1084
|
case 'static-view':
|
|
1076
1085
|
case 'pure-view':
|
|
1077
1086
|
nodeName = 'view';
|
|
@@ -1091,7 +1100,7 @@ ${this.buildXsTemplate()}
|
|
|
1091
1100
|
}
|
|
1092
1101
|
let res = `
|
|
1093
1102
|
<template name="tmpl_${level}_${nodeAlias}">
|
|
1094
|
-
<${nodeName} ${this.buildAttribute(comp.attributes, comp.nodeName)} id="{{i.uid||i.
|
|
1103
|
+
<${nodeName} ${this.buildAttribute(comp.attributes, comp.nodeName)} id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">${children}</${nodeName}>
|
|
1095
1104
|
</template>
|
|
1096
1105
|
`;
|
|
1097
1106
|
if (isFunction(this.modifyTemplateResult)) {
|
|
@@ -1107,20 +1116,20 @@ ${this.buildXsTemplate()}
|
|
|
1107
1116
|
`;
|
|
1108
1117
|
}
|
|
1109
1118
|
buildThirdPartyTemplate(level, componentConfig) {
|
|
1110
|
-
const {
|
|
1119
|
+
const { isSupportRecursive, isUseXS, nestElements } = this;
|
|
1111
1120
|
const nextLevel = isSupportRecursive ? 0 : level + 1;
|
|
1112
1121
|
let template = '';
|
|
1113
1122
|
componentConfig.thirdPartyComponents.forEach((attrs, compName) => {
|
|
1114
1123
|
if (compName === 'custom-wrapper') {
|
|
1115
1124
|
template += `
|
|
1116
1125
|
<template name="tmpl_${level}_${compName}">
|
|
1117
|
-
<${compName} i="{{i}}" l="{{l}}" id="{{i.uid||i.
|
|
1126
|
+
<${compName} i="{{i}}" l="{{l}}" id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">
|
|
1118
1127
|
</${compName}>
|
|
1119
1128
|
</template>
|
|
1120
1129
|
`;
|
|
1121
1130
|
}
|
|
1122
1131
|
else {
|
|
1123
|
-
if (!isSupportRecursive &&
|
|
1132
|
+
if (!isSupportRecursive && isUseXS && nestElements.has(compName) && level + 1 > nestElements.get(compName))
|
|
1124
1133
|
return;
|
|
1125
1134
|
let child = this.getChildrenTemplate(nextLevel);
|
|
1126
1135
|
if (isFunction(this.modifyThirdPartyLoopBody)) {
|
|
@@ -1129,13 +1138,11 @@ ${this.buildXsTemplate()}
|
|
|
1129
1138
|
const children = this.voidElements.has(compName)
|
|
1130
1139
|
? ''
|
|
1131
1140
|
: `
|
|
1132
|
-
|
|
1133
|
-
${child}
|
|
1134
|
-
</block>
|
|
1141
|
+
${child}
|
|
1135
1142
|
`;
|
|
1136
1143
|
template += `
|
|
1137
1144
|
<template name="tmpl_${level}_${compName}">
|
|
1138
|
-
<${compName} ${this.buildThirdPartyAttr(attrs, this.thirdPartyPatcher[compName] || {})} id="{{i.uid||i.
|
|
1145
|
+
<${compName} ${this.buildThirdPartyAttr(attrs, this.thirdPartyPatcher[compName] || {})} id="{{i.uid||i.${"s" /* Shortcuts.Sid */}}}" data-${"s" /* Shortcuts.Sid */}="{{i.${"s" /* Shortcuts.Sid */}}}">${children}</${compName}>
|
|
1139
1146
|
</template>
|
|
1140
1147
|
`;
|
|
1141
1148
|
}
|
|
@@ -1144,11 +1151,11 @@ ${this.buildXsTemplate()}
|
|
|
1144
1151
|
}
|
|
1145
1152
|
// 最后一层的 comp 需要引用 container 进行重新的模版循环,其他情况不需要 container
|
|
1146
1153
|
buildContainerTemplate(level) {
|
|
1147
|
-
const tmpl = `<block ${this.Adapter.if}="{{i.
|
|
1154
|
+
const tmpl = `<block ${this.Adapter.if}="{{i.${"n" /* Shortcuts.NodeName */} === '${this.componentsAlias['#text']._num}'}}">
|
|
1148
1155
|
<template is="tmpl_0_${this.componentsAlias['#text']._num}" data="{{${this.dataKeymap('i:i')}}}" />
|
|
1149
1156
|
</block>
|
|
1150
1157
|
<block ${this.Adapter.else}>
|
|
1151
|
-
${!this.isSupportRecursive && this.
|
|
1158
|
+
${!this.isSupportRecursive && this.isUseXS ? '<comp i="{{i}}" l="{{l}}" />' : '<comp i="{{i}}" />'}
|
|
1152
1159
|
</block>`;
|
|
1153
1160
|
return `
|
|
1154
1161
|
<template name="tmpl_${level}_${"container" /* Shortcuts.Container */}">
|
|
@@ -1168,6 +1175,9 @@ ${this.buildXsTemplate()}
|
|
|
1168
1175
|
buildXsTemplate(_filePath) {
|
|
1169
1176
|
return '';
|
|
1170
1177
|
}
|
|
1178
|
+
buildXsImportTemplate(_filePath) {
|
|
1179
|
+
return this.isUseXS ? this.buildXsTemplate(_filePath) + '\n' : '';
|
|
1180
|
+
}
|
|
1171
1181
|
mergeComponents(ctx, patch) {
|
|
1172
1182
|
ctx.helper.recursiveMerge(this.internalComponents, patch);
|
|
1173
1183
|
}
|
|
@@ -1179,10 +1189,10 @@ ${this.buildXsTemplate()}
|
|
|
1179
1189
|
return 'tmpl_' + l + '_' + n
|
|
1180
1190
|
}`;
|
|
1181
1191
|
}
|
|
1182
|
-
buildXSTepFocus(
|
|
1192
|
+
buildXSTepFocus(n) {
|
|
1183
1193
|
return `function(i, prefix) {
|
|
1184
1194
|
var s = i.focus !== undefined ? 'focus' : 'blur'
|
|
1185
|
-
return prefix + i.${
|
|
1195
|
+
return prefix + i.${n} + '_' + s
|
|
1186
1196
|
}`;
|
|
1187
1197
|
}
|
|
1188
1198
|
buildXSTmpExtra() {
|
|
@@ -1228,7 +1238,7 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1228
1238
|
.filter(c => componentConfig.includes.size && !componentConfig.includeAll ? componentConfig.includes.has(c) : true);
|
|
1229
1239
|
let template = this.buildBaseTemplate();
|
|
1230
1240
|
for (let i = 0; i < this.baseLevel; i++) {
|
|
1231
|
-
template += this.
|
|
1241
|
+
template += this.isUseXS
|
|
1232
1242
|
? this.buildOptimizeFloor(i, components, this.baseLevel === i + 1)
|
|
1233
1243
|
: this.buildFloor(i, components, this.baseLevel === i + 1);
|
|
1234
1244
|
}
|