@tarojs/shared 4.0.7-alpha.2 → 4.0.7-alpha.3
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 +0 -1
- package/dist/components.js.map +1 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +1 -2
- package/dist/constants.js.map +1 -1
- package/dist/index.cjs.js +8 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/is.d.ts +1 -0
- package/dist/is.js +6 -1
- package/dist/is.js.map +1 -1
- package/dist/shared.esm.js +8 -7
- package/dist/shared.esm.js.map +1 -1
- package/dist/shortcuts.d.ts +0 -1
- package/dist/shortcuts.js +0 -1
- package/dist/shortcuts.js.map +1 -1
- package/dist/template.d.ts +0 -7
- package/dist/template.js +94 -98
- package/dist/template.js.map +1 -1
- package/dist/utils.js +2 -3
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/template.js
CHANGED
|
@@ -310,7 +310,6 @@ const voidElements = new Set([
|
|
|
310
310
|
const nestElements = new Map([
|
|
311
311
|
['view', -1],
|
|
312
312
|
['catch-view', -1],
|
|
313
|
-
['click-view', -1],
|
|
314
313
|
['cover-view', -1],
|
|
315
314
|
['static-view', -1],
|
|
316
315
|
['pure-view', -1],
|
|
@@ -326,33 +325,6 @@ const nestElements = new Map([
|
|
|
326
325
|
['swiper-item', 4],
|
|
327
326
|
]);
|
|
328
327
|
|
|
329
|
-
var PLATFORM_TYPE;
|
|
330
|
-
(function (PLATFORM_TYPE) {
|
|
331
|
-
PLATFORM_TYPE["MINI"] = "mini";
|
|
332
|
-
PLATFORM_TYPE["WEB"] = "web";
|
|
333
|
-
PLATFORM_TYPE["RN"] = "rn";
|
|
334
|
-
PLATFORM_TYPE["HARMONY"] = "harmony";
|
|
335
|
-
PLATFORM_TYPE["QUICK"] = "quickapp";
|
|
336
|
-
})(PLATFORM_TYPE || (PLATFORM_TYPE = {}));
|
|
337
|
-
const COMPILE_MODE_IDENTIFIER_PREFIX = 'f';
|
|
338
|
-
({
|
|
339
|
-
h5: {
|
|
340
|
-
type: PLATFORM_TYPE.WEB
|
|
341
|
-
},
|
|
342
|
-
harmony: {
|
|
343
|
-
type: PLATFORM_TYPE.HARMONY
|
|
344
|
-
},
|
|
345
|
-
mini: {
|
|
346
|
-
type: PLATFORM_TYPE.MINI
|
|
347
|
-
},
|
|
348
|
-
rn: {
|
|
349
|
-
type: PLATFORM_TYPE.RN
|
|
350
|
-
},
|
|
351
|
-
quickapp: {
|
|
352
|
-
type: PLATFORM_TYPE.QUICK
|
|
353
|
-
},
|
|
354
|
-
});
|
|
355
|
-
|
|
356
328
|
function isString(o) {
|
|
357
329
|
return typeof o === 'string';
|
|
358
330
|
}
|
|
@@ -360,11 +332,16 @@ function isFunction(o) {
|
|
|
360
332
|
return typeof o === 'function';
|
|
361
333
|
}
|
|
362
334
|
function isNumber(o) {
|
|
335
|
+
if (Number.isFinite)
|
|
336
|
+
return Number.isFinite(o);
|
|
363
337
|
return typeof o === 'number';
|
|
364
338
|
}
|
|
365
339
|
function isBooleanStringLiteral(o) {
|
|
366
340
|
return o === 'true' || o === 'false';
|
|
367
341
|
}
|
|
342
|
+
function isObjectStringLiteral(o) {
|
|
343
|
+
return o === '{}';
|
|
344
|
+
}
|
|
368
345
|
|
|
369
346
|
// 字符串简写
|
|
370
347
|
exports.Shortcuts = void 0;
|
|
@@ -375,12 +352,37 @@ exports.Shortcuts = void 0;
|
|
|
375
352
|
Shortcuts["NodeType"] = "nt";
|
|
376
353
|
Shortcuts["NodeName"] = "nn";
|
|
377
354
|
// Attrtibutes
|
|
378
|
-
Shortcuts["Sid"] = "sid";
|
|
379
355
|
Shortcuts["Style"] = "st";
|
|
380
356
|
Shortcuts["Class"] = "cl";
|
|
381
357
|
Shortcuts["Src"] = "src";
|
|
382
358
|
})(exports.Shortcuts || (exports.Shortcuts = {}));
|
|
383
359
|
|
|
360
|
+
var PLATFORM_TYPE;
|
|
361
|
+
(function (PLATFORM_TYPE) {
|
|
362
|
+
PLATFORM_TYPE["MINI"] = "mini";
|
|
363
|
+
PLATFORM_TYPE["WEB"] = "web";
|
|
364
|
+
PLATFORM_TYPE["RN"] = "rn";
|
|
365
|
+
PLATFORM_TYPE["HARMONY"] = "harmony";
|
|
366
|
+
PLATFORM_TYPE["QUICK"] = "quickapp";
|
|
367
|
+
})(PLATFORM_TYPE || (PLATFORM_TYPE = {}));
|
|
368
|
+
({
|
|
369
|
+
h5: {
|
|
370
|
+
type: PLATFORM_TYPE.WEB
|
|
371
|
+
},
|
|
372
|
+
harmony: {
|
|
373
|
+
type: PLATFORM_TYPE.HARMONY
|
|
374
|
+
},
|
|
375
|
+
mini: {
|
|
376
|
+
type: PLATFORM_TYPE.MINI
|
|
377
|
+
},
|
|
378
|
+
rn: {
|
|
379
|
+
type: PLATFORM_TYPE.RN
|
|
380
|
+
},
|
|
381
|
+
quickapp: {
|
|
382
|
+
type: PLATFORM_TYPE.QUICK
|
|
383
|
+
},
|
|
384
|
+
});
|
|
385
|
+
|
|
384
386
|
class Events {
|
|
385
387
|
constructor(opts) {
|
|
386
388
|
var _a;
|
|
@@ -685,13 +687,12 @@ function getComponentsAlias(origin) {
|
|
|
685
687
|
StaticImage: origin.Image,
|
|
686
688
|
StaticText: origin.Text,
|
|
687
689
|
PureView: viewAttrs,
|
|
688
|
-
CatchView: viewAttrs
|
|
689
|
-
ClickView: viewAttrs,
|
|
690
|
+
CatchView: viewAttrs
|
|
690
691
|
};
|
|
691
692
|
origin = Object.assign(Object.assign({}, origin), extraList);
|
|
692
693
|
Object.keys(origin)
|
|
693
694
|
.sort((a, b) => {
|
|
694
|
-
const reg = /^(Static|Pure|Catch
|
|
695
|
+
const reg = /^(Static|Pure|Catch)*(View|Image|Text)$/;
|
|
695
696
|
const isACommonly = reg.test(a);
|
|
696
697
|
const isBCommonly = reg.test(b);
|
|
697
698
|
if (isACommonly && isBCommonly) {
|
|
@@ -764,8 +765,6 @@ const weixinAdapter = {
|
|
|
764
765
|
class BaseTemplate {
|
|
765
766
|
constructor() {
|
|
766
767
|
this._baseLevel = 0;
|
|
767
|
-
this._isUseXS = true;
|
|
768
|
-
this._isUseCompileMode = false;
|
|
769
768
|
this.exportExpr = 'module.exports =';
|
|
770
769
|
this.thirdPartyPatcher = {};
|
|
771
770
|
this.supportXS = false;
|
|
@@ -785,26 +784,29 @@ class BaseTemplate {
|
|
|
785
784
|
return template;
|
|
786
785
|
};
|
|
787
786
|
this.buildBaseComponentTemplate = (ext) => {
|
|
788
|
-
const data = !this.isSupportRecursive && this.
|
|
787
|
+
const data = !this.isSupportRecursive && this.supportXS
|
|
789
788
|
? this.dataKeymap(`i:i,c:1,l:xs.f('',i.${"nn" /* Shortcuts.NodeName */})`)
|
|
790
789
|
: this.isSupportRecursive
|
|
791
790
|
? this.dataKeymap('i:i')
|
|
792
791
|
: this.dataKeymap('i:i,c:1');
|
|
793
792
|
// 此处需要重新引入 xs 函数,否则会出现 ws.f() 在 comp.wxml 和 custom-wrapper.wxml 中永远返回 undefined 的问题 #14599
|
|
794
793
|
return `<import src="./base${ext}" />
|
|
795
|
-
${this.
|
|
794
|
+
${this.buildXsTemplate()}
|
|
795
|
+
<template is="{{'tmpl_0_' + i.nn}}" data="{{${data}}}" />`;
|
|
796
796
|
};
|
|
797
797
|
this.buildCustomComponentTemplate = (ext) => {
|
|
798
798
|
const Adapter = this.Adapter;
|
|
799
|
-
const data = !this.isSupportRecursive && this.
|
|
799
|
+
const data = !this.isSupportRecursive && this.supportXS
|
|
800
800
|
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"nn" /* Shortcuts.NodeName */})`)}`
|
|
801
801
|
: this.isSupportRecursive
|
|
802
802
|
? this.dataKeymap('i:item')
|
|
803
803
|
: this.dataKeymap('i:item,c:1');
|
|
804
804
|
// 此处需要重新引入 xs 函数,否则会出现 ws.f() 在 comp.wxml 和 custom-wrapper.wxml 中永远返回 undefined 的问题 #14599
|
|
805
805
|
return `<import src="./base${ext}" />
|
|
806
|
-
${this.
|
|
807
|
-
|
|
806
|
+
${this.buildXsTemplate()}
|
|
807
|
+
<block ${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="sid">
|
|
808
|
+
<template is="{{'tmpl_0_' + item.nn}}" data="{{${data}}}" />
|
|
809
|
+
</block>`;
|
|
808
810
|
};
|
|
809
811
|
this.buildXScript = () => {
|
|
810
812
|
return `${this.exportExpr} {
|
|
@@ -813,6 +815,9 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
813
815
|
return a === undefined ? b : a
|
|
814
816
|
},
|
|
815
817
|
c: ${this.buildXSTepFocus("nn" /* Shortcuts.NodeName */)},
|
|
818
|
+
d: function (a) {
|
|
819
|
+
return a === undefined ? {} : a
|
|
820
|
+
},
|
|
816
821
|
e: function (n) {
|
|
817
822
|
return 'tmpl_' + n + '_${"container" /* Shortcuts.Container */}'
|
|
818
823
|
},
|
|
@@ -826,18 +831,6 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
826
831
|
get baseLevel() {
|
|
827
832
|
return this._baseLevel;
|
|
828
833
|
}
|
|
829
|
-
set isUseCompileMode(isUse) {
|
|
830
|
-
this._isUseCompileMode = isUse;
|
|
831
|
-
}
|
|
832
|
-
get isUseCompileMode() {
|
|
833
|
-
return this._isUseCompileMode;
|
|
834
|
-
}
|
|
835
|
-
set isUseXS(isUse) {
|
|
836
|
-
this._isUseXS = this.supportXS && isUse;
|
|
837
|
-
}
|
|
838
|
-
get isUseXS() {
|
|
839
|
-
return this._isUseXS;
|
|
840
|
-
}
|
|
841
834
|
buildAttribute(attrs, nodeName) {
|
|
842
835
|
return Object.keys(attrs)
|
|
843
836
|
.map(k => `${k}="${k.startsWith('bind') || k.startsWith('on') || k.startsWith('catch') ? attrs[k] : `{${this.getAttrValue(attrs[k], k, nodeName)}}`}" `)
|
|
@@ -861,29 +854,30 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
861
854
|
}
|
|
862
855
|
for (let prop in component) {
|
|
863
856
|
if (hasOwn(component, prop)) {
|
|
857
|
+
const propInCamelCase = toCamelCase(prop);
|
|
858
|
+
const propAlias = componentAlias[propInCamelCase] || propInCamelCase;
|
|
864
859
|
let propValue = component[prop];
|
|
865
860
|
if (prop.startsWith('bind') || propValue === 'eh') {
|
|
866
861
|
propValue = 'eh';
|
|
867
862
|
}
|
|
868
863
|
else if (propValue === '') {
|
|
869
|
-
const propInCamelCase = toCamelCase(prop);
|
|
870
|
-
const propAlias = componentAlias[propInCamelCase] || propInCamelCase;
|
|
871
864
|
propValue = `i.${propAlias}`;
|
|
872
865
|
}
|
|
873
866
|
else if (isBooleanStringLiteral(propValue) || isNumber(+propValue)) {
|
|
874
|
-
const propInCamelCase = toCamelCase(prop);
|
|
875
|
-
const propAlias = componentAlias[propInCamelCase] || propInCamelCase;
|
|
876
867
|
// cursor 默认取最后输入框最后一位 fix #13809
|
|
877
868
|
if (prop === 'cursor') {
|
|
878
869
|
propValue = `i.${componentAlias.value}?i.${componentAlias.value}.length:-1`;
|
|
879
870
|
}
|
|
880
|
-
propValue = this.
|
|
871
|
+
propValue = this.supportXS
|
|
881
872
|
? `xs.b(i.${propAlias},${propValue})`
|
|
882
873
|
: `i.${propAlias}===undefined?${propValue}:i.${propAlias}`;
|
|
883
874
|
}
|
|
875
|
+
else if (isObjectStringLiteral(propValue)) {
|
|
876
|
+
propValue = this.supportXS
|
|
877
|
+
? `xs.d(i.${propAlias})`
|
|
878
|
+
: `i.${propAlias}===undefined?${propValue}:i.${propAlias}`;
|
|
879
|
+
}
|
|
884
880
|
else {
|
|
885
|
-
const propInCamelCase = toCamelCase(prop);
|
|
886
|
-
const propAlias = componentAlias[propInCamelCase] || propInCamelCase;
|
|
887
881
|
propValue = `i.${propAlias}||${propValue || singleQuote('')}`;
|
|
888
882
|
}
|
|
889
883
|
prop = this.replacePropName(prop, propValue, compName, componentAlias);
|
|
@@ -921,11 +915,6 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
921
915
|
style: comp.style,
|
|
922
916
|
class: comp.class
|
|
923
917
|
};
|
|
924
|
-
result['click-view'] = {
|
|
925
|
-
style: comp.style,
|
|
926
|
-
class: comp.class,
|
|
927
|
-
bindtap: 'eh'
|
|
928
|
-
};
|
|
929
918
|
}
|
|
930
919
|
}
|
|
931
920
|
if (compName === 'slot' || compName === 'slot-view') {
|
|
@@ -945,18 +934,21 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
945
934
|
}
|
|
946
935
|
buildBaseTemplate() {
|
|
947
936
|
const Adapter = this.Adapter;
|
|
948
|
-
const data = !this.isSupportRecursive && this.
|
|
937
|
+
const data = !this.isSupportRecursive && this.supportXS
|
|
949
938
|
? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"nn" /* Shortcuts.NodeName */})`)}`
|
|
950
939
|
: this.isSupportRecursive
|
|
951
940
|
? this.dataKeymap('i:item')
|
|
952
941
|
: this.dataKeymap('i:item,c:1');
|
|
953
|
-
const xs = this.
|
|
942
|
+
const xs = this.supportXS
|
|
954
943
|
? (this.isSupportRecursive
|
|
955
944
|
? `xs.a(0, item.${"nn" /* Shortcuts.NodeName */})`
|
|
956
945
|
: `xs.a(0, item.${"nn" /* Shortcuts.NodeName */}, '')`)
|
|
957
|
-
:
|
|
958
|
-
return `${this.
|
|
959
|
-
|
|
946
|
+
: "'tmpl_0_' + item.nn";
|
|
947
|
+
return `${this.buildXsTemplate()}
|
|
948
|
+
<template name="taro_tmpl">
|
|
949
|
+
<block ${Adapter.for}="{{root.cn}}" ${Adapter.key}="sid">
|
|
950
|
+
<template is="{{${xs}}}" data="{{${data}}}" />
|
|
951
|
+
</block>
|
|
960
952
|
</template>
|
|
961
953
|
`;
|
|
962
954
|
}
|
|
@@ -990,9 +982,16 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
990
982
|
}
|
|
991
983
|
const patchValue = patcher[attr];
|
|
992
984
|
if (isBooleanStringLiteral(patchValue) || isNumber(patchValue) || isString(patchValue)) {
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
985
|
+
let propValue = '';
|
|
986
|
+
if (this.supportXS) {
|
|
987
|
+
if (isObjectStringLiteral(patchValue)) {
|
|
988
|
+
propValue = `xs.d(i.${toCamelCase(attr)})`;
|
|
989
|
+
}
|
|
990
|
+
propValue = `xs.b(i.${toCamelCase(attr)},${patchValue})`;
|
|
991
|
+
}
|
|
992
|
+
else {
|
|
993
|
+
propValue = `i.${toCamelCase(attr)}===undefined?${patchValue}:i.${toCamelCase(attr)}`;
|
|
994
|
+
}
|
|
996
995
|
return str + ` ${attr}="{{${propValue}}}"`;
|
|
997
996
|
}
|
|
998
997
|
return str + ` ${attr}="{{i.${toCamelCase(attr)}}}"`;
|
|
@@ -1004,22 +1003,21 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1004
1003
|
: this.buildStandardComponentTemplate(comp, level);
|
|
1005
1004
|
}
|
|
1006
1005
|
getChildrenTemplate(level) {
|
|
1007
|
-
const { isSupportRecursive,
|
|
1006
|
+
const { isSupportRecursive, supportXS } = this;
|
|
1008
1007
|
const isLastRecursiveComp = !isSupportRecursive && level + 1 === this.baseLevel;
|
|
1009
|
-
const
|
|
1010
|
-
const forAttribute = `${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="${"sid" /* Shortcuts.Sid */}"`;
|
|
1008
|
+
const isUseXs = !this.isSupportRecursive && this.supportXS;
|
|
1011
1009
|
if (isLastRecursiveComp) {
|
|
1012
|
-
const data =
|
|
1010
|
+
const data = isUseXs
|
|
1013
1011
|
? `${this.dataKeymap('i:item,c:c,l:l')}`
|
|
1014
1012
|
: this.isSupportRecursive
|
|
1015
1013
|
? this.dataKeymap('i:item')
|
|
1016
1014
|
: this.dataKeymap('i:item,c:c');
|
|
1017
|
-
return
|
|
1018
|
-
? `<template is="{{xs.e(${level})}}" data="{{${data}}}"
|
|
1019
|
-
: `<template is="tmpl_${level}_${"container" /* Shortcuts.Container */}" data="{{${data}}}"
|
|
1015
|
+
return supportXS
|
|
1016
|
+
? `<template is="{{xs.e(${level})}}" data="{{${data}}}" />`
|
|
1017
|
+
: `<template is="tmpl_${level}_${"container" /* Shortcuts.Container */}" data="{{${data}}}" />`;
|
|
1020
1018
|
}
|
|
1021
1019
|
else {
|
|
1022
|
-
const data =
|
|
1020
|
+
const data = isUseXs
|
|
1023
1021
|
// TODO: 此处直接 c+1,不是最优解,变量 c 的作用是监测组件嵌套的层级是否大于 baselevel
|
|
1024
1022
|
// 但目前的监测方法用于所有组件嵌套的总和,应该分开组件计算,单个组件嵌套层级大于 baselevel 时,再进入 comp 组件中进行新的嵌套
|
|
1025
1023
|
? `${this.dataKeymap(`i:item,c:c+1,l:xs.f(l,item.${"nn" /* Shortcuts.NodeName */})`)}`
|
|
@@ -1029,17 +1027,15 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1029
1027
|
const xs = !this.isSupportRecursive
|
|
1030
1028
|
? `xs.a(c, item.${"nn" /* Shortcuts.NodeName */}, l)`
|
|
1031
1029
|
: `xs.a(0, item.${"nn" /* Shortcuts.NodeName */})`;
|
|
1032
|
-
return
|
|
1033
|
-
? `<template is="{{${xs}}}" data="{{${data}}}"
|
|
1030
|
+
return supportXS
|
|
1031
|
+
? `<template is="{{${xs}}}" data="{{${data}}}" />`
|
|
1034
1032
|
: isSupportRecursive
|
|
1035
|
-
? `<template is="{{'tmpl_0_' + item
|
|
1036
|
-
:
|
|
1037
|
-
? `<template is="{{'tmpl_' + (item.${"nn" /* Shortcuts.NodeName */}[0]==='${COMPILE_MODE_IDENTIFIER_PREFIX}' ? 0 : c) + '_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1038
|
-
: `<template is="{{'tmpl_' + c + '_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`;
|
|
1033
|
+
? `<template is="{{'tmpl_0_' + item.nn}}" data="{{${data}}}" />`
|
|
1034
|
+
: `<template is="{{'tmpl_' + c + '_' + item.nn}}" data="{{${data}}}" />`;
|
|
1039
1035
|
}
|
|
1040
1036
|
}
|
|
1041
1037
|
getChildren(comp, level) {
|
|
1042
|
-
const { isSupportRecursive } = this;
|
|
1038
|
+
const { isSupportRecursive, Adapter } = this;
|
|
1043
1039
|
const nextLevel = isSupportRecursive ? 0 : level + 1;
|
|
1044
1040
|
let child = this.getChildrenTemplate(nextLevel);
|
|
1045
1041
|
if (isFunction(this.modifyLoopBody)) {
|
|
@@ -1048,7 +1044,9 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1048
1044
|
let children = this.voidElements.has(comp.nodeName)
|
|
1049
1045
|
? ''
|
|
1050
1046
|
: `
|
|
1051
|
-
${
|
|
1047
|
+
<block ${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="sid">
|
|
1048
|
+
${indent(child, 6)}
|
|
1049
|
+
</block>
|
|
1052
1050
|
`;
|
|
1053
1051
|
if (isFunction(this.modifyLoopContainer)) {
|
|
1054
1052
|
children = this.modifyLoopContainer(children, comp.nodeName);
|
|
@@ -1060,7 +1058,7 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1060
1058
|
const nodeName = comp.nodeName;
|
|
1061
1059
|
const nodeAlias = comp.nodeAlias;
|
|
1062
1060
|
const attrs = Object.assign({}, comp.attributes);
|
|
1063
|
-
const templateName = this.
|
|
1061
|
+
const templateName = this.supportXS
|
|
1064
1062
|
? `xs.c(i, 'tmpl_${level}_')`
|
|
1065
1063
|
: `i.focus ? 'tmpl_${level}_${nodeAlias}_focus' : 'tmpl_${level}_${nodeAlias}_blur'`;
|
|
1066
1064
|
delete attrs.focus;
|
|
@@ -1090,7 +1088,6 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1090
1088
|
case 'slot':
|
|
1091
1089
|
case 'slot-view':
|
|
1092
1090
|
case 'catch-view':
|
|
1093
|
-
case 'click-view':
|
|
1094
1091
|
case 'static-view':
|
|
1095
1092
|
case 'pure-view':
|
|
1096
1093
|
nodeName = 'view';
|
|
@@ -1126,20 +1123,20 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1126
1123
|
`;
|
|
1127
1124
|
}
|
|
1128
1125
|
buildThirdPartyTemplate(level, componentConfig) {
|
|
1129
|
-
const { isSupportRecursive,
|
|
1126
|
+
const { Adapter, isSupportRecursive, supportXS, nestElements } = this;
|
|
1130
1127
|
const nextLevel = isSupportRecursive ? 0 : level + 1;
|
|
1131
1128
|
let template = '';
|
|
1132
1129
|
componentConfig.thirdPartyComponents.forEach((attrs, compName) => {
|
|
1133
1130
|
if (compName === 'custom-wrapper') {
|
|
1134
1131
|
template += `
|
|
1135
1132
|
<template name="tmpl_${level}_${compName}">
|
|
1136
|
-
<${compName} i="{{i}}"
|
|
1133
|
+
<${compName} i="{{i}}" l="{{l}}" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
|
|
1137
1134
|
</${compName}>
|
|
1138
1135
|
</template>
|
|
1139
1136
|
`;
|
|
1140
1137
|
}
|
|
1141
1138
|
else {
|
|
1142
|
-
if (!isSupportRecursive &&
|
|
1139
|
+
if (!isSupportRecursive && supportXS && nestElements.has(compName) && level + 1 > nestElements.get(compName))
|
|
1143
1140
|
return;
|
|
1144
1141
|
let child = this.getChildrenTemplate(nextLevel);
|
|
1145
1142
|
if (isFunction(this.modifyThirdPartyLoopBody)) {
|
|
@@ -1148,7 +1145,9 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1148
1145
|
const children = this.voidElements.has(compName)
|
|
1149
1146
|
? ''
|
|
1150
1147
|
: `
|
|
1151
|
-
${
|
|
1148
|
+
<block ${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="sid">
|
|
1149
|
+
${child}
|
|
1150
|
+
</block>
|
|
1152
1151
|
`;
|
|
1153
1152
|
template += `
|
|
1154
1153
|
<template name="tmpl_${level}_${compName}">
|
|
@@ -1165,7 +1164,7 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1165
1164
|
<template is="tmpl_0_${this.componentsAlias['#text']._num}" data="{{${this.dataKeymap('i:i')}}}" />
|
|
1166
1165
|
</block>
|
|
1167
1166
|
<block ${this.Adapter.else}>
|
|
1168
|
-
${!this.isSupportRecursive && this.
|
|
1167
|
+
${!this.isSupportRecursive && this.supportXS ? '<comp i="{{i}}" l="{{l}}" />' : '<comp i="{{i}}" />'}
|
|
1169
1168
|
</block>`;
|
|
1170
1169
|
return `
|
|
1171
1170
|
<template name="tmpl_${level}_${"container" /* Shortcuts.Container */}">
|
|
@@ -1185,9 +1184,6 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1185
1184
|
buildXsTemplate(_filePath) {
|
|
1186
1185
|
return '';
|
|
1187
1186
|
}
|
|
1188
|
-
buildXsImportTemplate(_filePath) {
|
|
1189
|
-
return this.isUseXS ? this.buildXsTemplate(_filePath) + '\n' : '';
|
|
1190
|
-
}
|
|
1191
1187
|
mergeComponents(ctx, patch) {
|
|
1192
1188
|
ctx.helper.recursiveMerge(this.internalComponents, patch);
|
|
1193
1189
|
}
|
|
@@ -1248,7 +1244,7 @@ class UnRecursiveTemplate extends BaseTemplate {
|
|
|
1248
1244
|
.filter(c => componentConfig.includes.size && !componentConfig.includeAll ? componentConfig.includes.has(c) : true);
|
|
1249
1245
|
let template = this.buildBaseTemplate();
|
|
1250
1246
|
for (let i = 0; i < this.baseLevel; i++) {
|
|
1251
|
-
template += this.
|
|
1247
|
+
template += this.supportXS
|
|
1252
1248
|
? this.buildOptimizeFloor(i, components, this.baseLevel === i + 1)
|
|
1253
1249
|
: this.buildFloor(i, components, this.baseLevel === i + 1);
|
|
1254
1250
|
}
|