@tarojs/shared 3.7.0-alpha.2 → 3.7.0-alpha.22

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.
@@ -47,6 +47,7 @@ declare const events: {
47
47
  bindtap: string;
48
48
  };
49
49
  declare class BaseTemplate {
50
+ protected _baseLevel: number;
50
51
  protected exportExpr: string;
51
52
  protected isSupportRecursive: boolean;
52
53
  protected miniComponents: Components;
@@ -67,18 +68,22 @@ declare class BaseTemplate {
67
68
  /** 可以递归调用自身的组件 */
68
69
  nestElements: Map<string, number>;
69
70
  componentsAlias: any;
71
+ set baseLevel(lv: number);
72
+ get baseLevel(): number;
70
73
  private buildAttribute;
71
74
  protected replacePropName(name: string, value: string, _componentName?: string, _componentAlias?: any): string;
72
75
  protected createMiniComponents(components: Components): Components;
73
76
  protected buildBaseTemplate(): string;
74
77
  protected buildThirdPartyAttr(attrs: Set<string>, patcher?: Record<string, string>): string;
75
78
  protected buildComponentTemplate(comp: Component, level: number): string;
79
+ private getChildrenTemplate;
76
80
  private getChildren;
77
81
  protected buildFocusComponentTemplate(comp: Component, level: number): string;
78
82
  protected buildStandardComponentTemplate(comp: Component, level: number): string;
79
83
  protected buildPlainTextTemplate(level: number): string;
80
84
  protected buildThirdPartyTemplate(level: number, componentConfig: ComponentConfig): string;
81
- protected buildContainerTemplate(level: number, restart?: boolean): string;
85
+ // 最后一层的 comp 需要引用 container 进行重新的模版循环,其他情况不需要 container
86
+ protected buildContainerTemplate(level: number): string;
82
87
  protected dataKeymap(keymap: string): string;
83
88
  protected getEvents(): any;
84
89
  protected getAttrValue(value: string, _key: string, _nodeName: string): string;
@@ -99,10 +104,8 @@ declare class RecursiveTemplate extends BaseTemplate {
99
104
  }
100
105
  declare class UnRecursiveTemplate extends BaseTemplate {
101
106
  isSupportRecursive: boolean;
102
- private _baseLevel;
107
+ protected _baseLevel: number;
103
108
  private componentConfig;
104
- set baseLevel(lv: number);
105
- get baseLevel(): number;
106
109
  buildTemplate: (componentConfig: ComponentConfig) => string;
107
110
  protected buildFloor(level: number, components: string[], restart?: boolean): string;
108
111
  protected buildOptimizeFloor(level: number, components: string[], restart?: boolean): string;
package/dist/template.js CHANGED
@@ -48,7 +48,7 @@ const Text = {
48
48
  space: NO_DEFAULT_VALUE,
49
49
  decode: DEFAULT_FALSE
50
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);
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, bindagreeprivacyauthorization: NO_DEFAULT_VALUE }, touchEvents);
52
52
  const Checkbox = {
53
53
  value: NO_DEFAULT_VALUE,
54
54
  disabled: NO_DEFAULT_VALUE,
@@ -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: 'i.value.length',
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, node, tail, list;
380
+ let event, tail, _eventName;
381
381
  if (!callback) {
382
382
  return this;
383
383
  }
384
- eventName = eventName.split(Events.eventSplitter);
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 = eventName.shift())) {
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, node, tail, cb, ctx;
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
- events = events ? events.split(Events.eventSplitter) : Object.keys(calls);
418
- while ((event = events.shift())) {
419
- node = calls[event];
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, tail;
445
+ trigger(events, ...args) {
446
+ let event, node, calls, _events;
437
447
  if (!(calls = this.callbacks)) {
438
448
  return this;
439
449
  }
440
- events = events.split(Events.eventSplitter);
441
- const rest = [].slice.call(arguments, 1);
442
- while ((event = events.shift())) {
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, rest);
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.dataKeymap('i:i');
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_${"container" /* Shortcuts.Container */}" data="{{${data}}}" />`;
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.dataKeymap('i:item');
779
+ ? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"nn" /* Shortcuts.NodeName */})`)}`
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="tmpl_0_container" data="{{${data}}}" />
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.dataKeymap('i:item');
911
+ ? `${this.dataKeymap(`i:item,c:1,l:xs.f('',item.${"nn" /* Shortcuts.NodeName */})`)}`
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="tmpl_0_${"container" /* Shortcuts.Container */}" data="{{${data}}}" />
923
+ <template is="{{${xs}}}" data="{{${data}}}" />
883
924
  </block>
884
925
  </template>
885
926
  `;
@@ -892,10 +933,10 @@ class BaseTemplate {
892
933
  if (value.indexOf('-') > -1) {
893
934
  value = `:${value}`;
894
935
  }
895
- return str + `bind${value}="eh" `;
936
+ return str + ` bind${value}="eh"`;
896
937
  }
897
938
  else if (attr.startsWith('bind')) {
898
- return str + `${attr}="eh" `;
939
+ return str + ` ${attr}="eh"`;
899
940
  }
900
941
  else if (attr.startsWith('on')) {
901
942
  // react, vue3
@@ -904,22 +945,22 @@ class BaseTemplate {
904
945
  // 兼容如 vant 某些组件的 bind:a-b 这类属性
905
946
  value = `:${value}`;
906
947
  }
907
- return str + `bind${value}="eh" `;
948
+ return str + ` bind${value}="eh"`;
908
949
  }
909
950
  else if (attr === 'class') {
910
- return str + `class="{{i.${"cl" /* Shortcuts.Class */}}}" `;
951
+ return str + ` class="{{i.${"cl" /* Shortcuts.Class */}}}"`;
911
952
  }
912
953
  else if (attr === 'style') {
913
- return str + `style="{{i.${"st" /* Shortcuts.Style */}}}" `;
954
+ return str + ` style="{{i.${"st" /* Shortcuts.Style */}}}"`;
914
955
  }
915
956
  const patchValue = patcher[attr];
916
957
  if (isBooleanStringLiteral(patchValue) || isNumber(patchValue) || isString(patchValue)) {
917
958
  const propValue = this.supportXS
918
959
  ? `xs.b(i.${toCamelCase(attr)},${patchValue})`
919
960
  : `i.${toCamelCase(attr)}===undefined?${patchValue}:i.${toCamelCase(attr)}`;
920
- return str + `${attr}="{{${propValue}}}" `;
961
+ return str + ` ${attr}="{{${propValue}}}"`;
921
962
  }
922
- return str + `${attr}="{{i.${toCamelCase(attr)}}}" `;
963
+ return str + ` ${attr}="{{i.${toCamelCase(attr)}}}"`;
923
964
  }, '');
924
965
  }
925
966
  buildComponentTemplate(comp, level) {
@@ -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, supportXS } = this;
1002
+ const { isSupportRecursive, Adapter } = this;
932
1003
  const nextLevel = isSupportRecursive ? 0 : level + 1;
933
- const data = !this.isSupportRecursive && supportXS
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')}${children ? ',cid:cid' : ''}}}" />
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,46 +1102,34 @@ class BaseTemplate {
1039
1102
  else {
1040
1103
  if (!isSupportRecursive && supportXS && nestElements.has(compName) && level + 1 > nestElements.get(compName))
1041
1104
  return;
1042
- let child = supportXS
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
  }
1048
- template += `
1049
- <template name="tmpl_${level}_${compName}">
1050
- <${compName} ${this.buildThirdPartyAttr(attrs, this.thirdPartyPatcher[compName] || {})} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
1109
+ const children = this.voidElements.has(compName)
1110
+ ? ''
1111
+ : `
1051
1112
  <block ${Adapter.for}="{{i.${"cn" /* Shortcuts.Childnodes */}}}" ${Adapter.key}="sid">
1052
1113
  ${child}
1053
1114
  </block>
1054
- </${compName}>
1115
+ `;
1116
+ template += `
1117
+ <template name="tmpl_${level}_${compName}">
1118
+ <${compName}${this.buildThirdPartyAttr(attrs, this.thirdPartyPatcher[compName] || {})} id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">${children}</${compName}>
1055
1119
  </template>
1056
1120
  `;
1057
1121
  }
1058
1122
  });
1059
1123
  return template;
1060
1124
  }
1061
- buildContainerTemplate(level, restart = false) {
1062
- let tmpl = '';
1063
- if (restart) {
1064
- tmpl = `<block ${this.Adapter.if}="{{i.nn === '#text'}}">
1065
- <template is="tmpl_0_#text" data="{{i:i}}" />
1125
+ // 最后一层的 comp 需要引用 container 进行重新的模版循环,其他情况不需要 container
1126
+ buildContainerTemplate(level) {
1127
+ const tmpl = `<block ${this.Adapter.if}="{{i.nn === '${this.componentsAlias['#text']._num}'}}">
1128
+ <template is="tmpl_0_${this.componentsAlias['#text']._num}" data="{{${this.dataKeymap('i:i')}}}" />
1066
1129
  </block>
1067
1130
  <block ${this.Adapter.else}>
1068
1131
  ${!this.isSupportRecursive && this.supportXS ? '<comp i="{{i}}" l="{{l}}" />' : '<comp i="{{i}}" />'}
1069
1132
  </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
1133
  return `
1083
1134
  <template name="tmpl_${level}_${"container" /* Shortcuts.Container */}">
1084
1135
  ${tmpl}
@@ -1138,7 +1189,6 @@ class RecursiveTemplate extends BaseTemplate {
1138
1189
  }, template);
1139
1190
  template += this.buildPlainTextTemplate(ZERO_FLOOR);
1140
1191
  template += this.buildThirdPartyTemplate(ZERO_FLOOR, componentConfig);
1141
- template += this.buildContainerTemplate(ZERO_FLOOR);
1142
1192
  return template;
1143
1193
  };
1144
1194
  }
@@ -1165,15 +1215,9 @@ class UnRecursiveTemplate extends BaseTemplate {
1165
1215
  return template;
1166
1216
  };
1167
1217
  }
1168
- set baseLevel(lv) {
1169
- this._baseLevel = lv;
1170
- }
1171
- get baseLevel() {
1172
- return this._baseLevel;
1173
- }
1174
1218
  buildFloor(level, components, restart = false) {
1175
1219
  if (restart)
1176
- return this.buildContainerTemplate(level, restart);
1220
+ return this.buildContainerTemplate(level);
1177
1221
  let template = components.reduce((current, nodeName) => {
1178
1222
  const attributes = this.miniComponents[nodeName];
1179
1223
  const nodeAlias = this.componentsAlias[nodeName]._num;
@@ -1181,12 +1225,11 @@ class UnRecursiveTemplate extends BaseTemplate {
1181
1225
  }, '');
1182
1226
  template += this.buildPlainTextTemplate(level);
1183
1227
  template += this.buildThirdPartyTemplate(level, this.componentConfig);
1184
- template += this.buildContainerTemplate(level, restart);
1185
1228
  return template;
1186
1229
  }
1187
1230
  buildOptimizeFloor(level, components, restart = false) {
1188
1231
  if (restart)
1189
- return this.buildContainerTemplate(level, restart);
1232
+ return this.buildContainerTemplate(level);
1190
1233
  let template = components.reduce((current, nodeName) => {
1191
1234
  if (level !== 0) {
1192
1235
  if (!this.nestElements.has(nodeName)) {
@@ -1208,7 +1251,6 @@ class UnRecursiveTemplate extends BaseTemplate {
1208
1251
  if (level === 0)
1209
1252
  template += this.buildPlainTextTemplate(level);
1210
1253
  template += this.buildThirdPartyTemplate(level, this.componentConfig);
1211
- template += this.buildContainerTemplate(level);
1212
1254
  return template;
1213
1255
  }
1214
1256
  buildXSTmplName() {
@@ -1229,6 +1271,7 @@ class UnRecursiveTemplate extends BaseTemplate {
1229
1271
  const componentsAlias = this.componentsAlias;
1230
1272
  const listA = Array.from(isLoopCompsSet).map(item => { var _a; return ((_a = componentsAlias[item]) === null || _a === void 0 ? void 0 : _a._num) || item; });
1231
1273
  const listB = hasMaxComps.map(item => { var _a; return ((_a = componentsAlias[item]) === null || _a === void 0 ? void 0 : _a._num) || item; });
1274
+ const containerLevel = this.baseLevel - 1;
1232
1275
  return `function (l, n, s) {
1233
1276
  var a = ${JSON.stringify(listA)}
1234
1277
  var b = ${JSON.stringify(listB)}
@@ -1243,6 +1286,9 @@ class UnRecursiveTemplate extends BaseTemplate {
1243
1286
  }
1244
1287
  l = depth
1245
1288
  }
1289
+ if (l === ${containerLevel}) {
1290
+ return 'tmpl_${containerLevel}_${"container" /* Shortcuts.Container */}'
1291
+ }
1246
1292
  return 'tmpl_' + l + '_' + n
1247
1293
  }`;
1248
1294
  }