@tarojs/shared 4.0.8-beta.1 → 4.0.8-beta.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.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/event-channel.js.map +1 -1
- package/dist/event-emitter.js.map +1 -1
- package/dist/index.cjs.js +7 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/is.js +1 -1
- package/dist/is.js.map +1 -1
- package/dist/native-apis.js.map +1 -1
- package/dist/runtime-hooks.js +1 -0
- package/dist/runtime-hooks.js.map +1 -1
- package/dist/shared.esm.js +7 -2
- package/dist/shared.esm.js.map +1 -1
- package/dist/shortcuts.js +1 -1
- package/dist/shortcuts.js.map +1 -1
- package/dist/template.js +23 -10
- package/dist/template.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
package/dist/template.js
CHANGED
|
@@ -329,6 +329,7 @@ const nestElements = new Map([
|
|
|
329
329
|
var PLATFORM_TYPE;
|
|
330
330
|
(function (PLATFORM_TYPE) {
|
|
331
331
|
PLATFORM_TYPE["MINI"] = "mini";
|
|
332
|
+
PLATFORM_TYPE["ASCF"] = "ascf";
|
|
332
333
|
PLATFORM_TYPE["WEB"] = "web";
|
|
333
334
|
PLATFORM_TYPE["RN"] = "rn";
|
|
334
335
|
PLATFORM_TYPE["HARMONY"] = "harmony";
|
|
@@ -342,6 +343,9 @@ const COMPILE_MODE_IDENTIFIER_PREFIX = 'f';
|
|
|
342
343
|
harmony: {
|
|
343
344
|
type: PLATFORM_TYPE.HARMONY
|
|
344
345
|
},
|
|
346
|
+
ascf: {
|
|
347
|
+
type: PLATFORM_TYPE.ASCF
|
|
348
|
+
},
|
|
345
349
|
mini: {
|
|
346
350
|
type: PLATFORM_TYPE.MINI
|
|
347
351
|
},
|
|
@@ -365,7 +369,7 @@ function isNumber(o) {
|
|
|
365
369
|
return typeof o === 'number';
|
|
366
370
|
}
|
|
367
371
|
function isBooleanStringLiteral(o) {
|
|
368
|
-
return o === 'true' || o === 'false';
|
|
372
|
+
return o === 'true' || o === 'false' || o === '!0' || o === '!1';
|
|
369
373
|
}
|
|
370
374
|
function isObjectStringLiteral(o) {
|
|
371
375
|
return o === '{}';
|
|
@@ -379,7 +383,7 @@ exports.Shortcuts = void 0;
|
|
|
379
383
|
Shortcuts["Text"] = "v";
|
|
380
384
|
Shortcuts["NodeType"] = "nt";
|
|
381
385
|
Shortcuts["NodeName"] = "nn";
|
|
382
|
-
//
|
|
386
|
+
// Attributes
|
|
383
387
|
Shortcuts["Sid"] = "sid";
|
|
384
388
|
Shortcuts["Style"] = "st";
|
|
385
389
|
Shortcuts["Class"] = "cl";
|
|
@@ -507,6 +511,7 @@ const defaultMiniLifecycle = {
|
|
|
507
511
|
'defer:onTabItemTap', // defer: 需要等页面组件挂载后再调用
|
|
508
512
|
'onTitleClick',
|
|
509
513
|
'onOptionMenuClick',
|
|
514
|
+
'events:onKeyboardHeight', // events: 支付宝平台需要挂载到 config.events 上
|
|
510
515
|
'onPopMenuClick',
|
|
511
516
|
'onPullIntercept',
|
|
512
517
|
'onAddToFavorites'
|
|
@@ -879,10 +884,6 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
879
884
|
propValue = `i.${propAlias}`;
|
|
880
885
|
}
|
|
881
886
|
else if (isBooleanStringLiteral(propValue) || isNumber(+propValue)) {
|
|
882
|
-
// cursor 默认取最后输入框最后一位 fix #13809
|
|
883
|
-
if (prop === 'cursor') {
|
|
884
|
-
propValue = `i.${componentAlias.value}?i.${componentAlias.value}.length:-1`;
|
|
885
|
-
}
|
|
886
887
|
propValue = this.isUseXS
|
|
887
888
|
? `xs.b(i.${propAlias},${propValue})`
|
|
888
889
|
: `i.${propAlias}===undefined?${propValue}:i.${propAlias}`;
|
|
@@ -941,6 +942,9 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
941
942
|
name: newComp === null || newComp === void 0 ? void 0 : newComp.name,
|
|
942
943
|
};
|
|
943
944
|
}
|
|
945
|
+
else if (compName === 'list-builder') {
|
|
946
|
+
result[compName] = Object.assign(Object.assign({}, newComp), { list: 'i.cn' });
|
|
947
|
+
}
|
|
944
948
|
else {
|
|
945
949
|
result[compName] = newComp;
|
|
946
950
|
}
|
|
@@ -1015,7 +1019,7 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1015
1019
|
? this.buildFocusComponentTemplate(comp, level)
|
|
1016
1020
|
: this.buildStandardComponentTemplate(comp, level);
|
|
1017
1021
|
}
|
|
1018
|
-
getChildrenTemplate(level) {
|
|
1022
|
+
getChildrenTemplate(level, useSlotItem = false) {
|
|
1019
1023
|
const { isSupportRecursive, isUseXS, Adapter, isUseCompileMode = true } = this;
|
|
1020
1024
|
const isLastRecursiveComp = !isSupportRecursive && level + 1 === this.baseLevel;
|
|
1021
1025
|
const isUnRecursiveXs = !this.isSupportRecursive && isUseXS;
|
|
@@ -1026,9 +1030,13 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1026
1030
|
: this.isSupportRecursive
|
|
1027
1031
|
? this.dataKeymap('i:item')
|
|
1028
1032
|
: this.dataKeymap('i:item,c:c');
|
|
1029
|
-
|
|
1033
|
+
const tmpl = isUseXS
|
|
1030
1034
|
? `<template is="{{xs.e(${level})}}" data="{{${data}}}" ${forAttribute} />`
|
|
1031
1035
|
: `<template is="tmpl_${level}_${"container" /* Shortcuts.Container */}" data="{{${data}}}" ${forAttribute} />`;
|
|
1036
|
+
if (useSlotItem) {
|
|
1037
|
+
return `<block slot:item slot:index>${tmpl.replace(forAttribute, '')}</block>`;
|
|
1038
|
+
}
|
|
1039
|
+
return tmpl;
|
|
1032
1040
|
}
|
|
1033
1041
|
else {
|
|
1034
1042
|
const data = isUnRecursiveXs
|
|
@@ -1041,19 +1049,24 @@ ${this.buildXsImportTemplate()}<template is="{{'tmpl_0_' + item.${"nn" /* Shortc
|
|
|
1041
1049
|
const xs = !this.isSupportRecursive
|
|
1042
1050
|
? `xs.a(c, item.${"nn" /* Shortcuts.NodeName */}, l)`
|
|
1043
1051
|
: `xs.a(0, item.${"nn" /* Shortcuts.NodeName */})`;
|
|
1044
|
-
|
|
1052
|
+
const tmpl = isUseXS
|
|
1045
1053
|
? `<template is="{{${xs}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1046
1054
|
: isSupportRecursive
|
|
1047
1055
|
? `<template is="{{'tmpl_0_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1048
1056
|
: isUseCompileMode
|
|
1049
1057
|
? `<template is="{{'tmpl_' + (item.${"nn" /* Shortcuts.NodeName */}[0]==='${COMPILE_MODE_IDENTIFIER_PREFIX}' ? 0 : c) + '_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`
|
|
1050
1058
|
: `<template is="{{'tmpl_' + c + '_' + item.${"nn" /* Shortcuts.NodeName */}}}" data="{{${data}}}" ${forAttribute} />`;
|
|
1059
|
+
if (useSlotItem) {
|
|
1060
|
+
return `<block slot:item slot:index>${tmpl.replace(forAttribute, '')}</block>`;
|
|
1061
|
+
}
|
|
1062
|
+
return tmpl;
|
|
1051
1063
|
}
|
|
1052
1064
|
}
|
|
1053
1065
|
getChildren(comp, level) {
|
|
1054
1066
|
const { isSupportRecursive } = this;
|
|
1055
1067
|
const nextLevel = isSupportRecursive ? 0 : level + 1;
|
|
1056
|
-
|
|
1068
|
+
const isListBuilder = comp.nodeName === 'list-builder';
|
|
1069
|
+
let child = this.getChildrenTemplate(nextLevel, isListBuilder);
|
|
1057
1070
|
if (isFunction(this.modifyLoopBody)) {
|
|
1058
1071
|
child = this.modifyLoopBody(child, comp.nodeName);
|
|
1059
1072
|
}
|