@next-core/brick-kit 2.118.3 → 2.118.4

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.
@@ -2539,13 +2539,224 @@
2539
2539
  }
2540
2540
  }
2541
2541
 
2542
+ function isBasicProperty(propRef) {
2543
+ return !!propRef.refProperty;
2544
+ }
2545
+ function isTransformableProperty(propRef) {
2546
+ return !!propRef.refTransform;
2547
+ }
2548
+ function isMergeableProperty(propRef) {
2549
+ return !!propRef.mergeProperty;
2550
+ }
2551
+ function isRefProperty(propRef) {
2552
+ return !!propRef.ref;
2553
+ }
2554
+ function isVariableProperty(propRef) {
2555
+ return !!propRef.asVariable;
2556
+ }
2557
+
2542
2558
  var customTemplateRegistry = new Map();
2543
2559
  var appRegistered = new Set();
2544
2560
  var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
2545
2561
  var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
2546
2562
  var symbolForTplContextId = Symbol.for("tpl.contextId");
2547
2563
 
2548
- function setupUseBrickInTemplate(props, tplContextId) {
2564
+ function propertyMerge(conf, value, object) {
2565
+ return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
2566
+ }
2567
+ function propertyMergeAll(mergeBase, object) {
2568
+ if (mergeBase.mergeType === "array") {
2569
+ return propertyMergeAllOfArray(mergeBase, object);
2570
+ }
2571
+
2572
+ if (mergeBase.mergeType === "object") {
2573
+ return propertyMergeAllOfObject(mergeBase, object);
2574
+ } // istanbul ignore next: should never reach
2575
+
2576
+
2577
+ throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
2578
+ }
2579
+
2580
+ function propertyMergeAllOfArray(_ref, object) {
2581
+ var _, _proxy$mergeArgs;
2582
+
2583
+ var {
2584
+ baseValue,
2585
+ context,
2586
+ proxies
2587
+ } = _ref;
2588
+ // Use an approach like template-literal's quasis:
2589
+ // `quasi0${0}quais1${1}quasi2...`
2590
+ // Every quasi can be merged with multiple items.
2591
+ var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
2592
+ $$lazyForUseBrick: true
2593
+ }) : [];
2594
+ var quasis = [];
2595
+ var size = computedBaseValue.length + 1;
2596
+
2597
+ for (var i = 0; i < size; i += 1) {
2598
+ quasis.push([]);
2599
+ }
2600
+
2601
+ for (var proxy of proxies) {
2602
+ var position = void 0;
2603
+
2604
+ switch (proxy.mergeMethod) {
2605
+ case "append":
2606
+ position = computedBaseValue.length;
2607
+ break;
2608
+
2609
+ case "prepend":
2610
+ position = 0;
2611
+ break;
2612
+
2613
+ case "insertAt":
2614
+ // Defaults to `-1`.
2615
+ position = (_ = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _ !== void 0 ? _ : -1;
2616
+
2617
+ if (position < 0) {
2618
+ // It's counted from the end if position is negative.
2619
+ position += quasis.length;
2620
+ }
2621
+
2622
+ position = lodash.clamp(position, 0, computedBaseValue.length);
2623
+ break;
2624
+ // istanbul ignore next: should never reach
2625
+
2626
+ default:
2627
+ throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
2628
+ }
2629
+
2630
+ var patchValue = object[proxy.$$reversedRef];
2631
+
2632
+ if (!Array.isArray(patchValue)) {
2633
+ patchValue = [];
2634
+ }
2635
+
2636
+ quasis[position].push(...patchValue);
2637
+ }
2638
+
2639
+ return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
2640
+ }
2641
+
2642
+ function propertyMergeAllOfObject(_ref2, object) {
2643
+ var {
2644
+ baseValue,
2645
+ proxies,
2646
+ context
2647
+ } = _ref2;
2648
+ var computedBaseValue = brickUtils.isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
2649
+ return proxies.reduce((acc, proxy) => {
2650
+ switch (proxy.mergeMethod) {
2651
+ case "extend":
2652
+ return _objectSpread__default["default"](_objectSpread__default["default"]({}, acc), object[proxy.$$reversedRef]);
2653
+ // istanbul ignore next: should never reach
2654
+
2655
+ default:
2656
+ throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
2657
+ }
2658
+ }, computedBaseValue);
2659
+ }
2660
+
2661
+ function setupTemplateProxy(proxyContext, ref, slots) {
2662
+ var computedPropsFromProxy = {};
2663
+ var refForProxy;
2664
+ var {
2665
+ reversedProxies,
2666
+ templateProperties,
2667
+ externalSlots,
2668
+ templateContextId,
2669
+ proxyBrick
2670
+ } = proxyContext;
2671
+
2672
+ if (ref && reversedProxies) {
2673
+ refForProxy = {};
2674
+ proxyBrick.proxyRefs.set(ref, refForProxy); // Reversed proxies are used for expand storyboard before rendering page.
2675
+
2676
+ if (reversedProxies.properties.has(ref)) {
2677
+ Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
2678
+ // `propValue` is computed.
2679
+ var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
2680
+
2681
+ if (isTransformableProperty(propRef)) {
2682
+ return Object.entries(preprocessTransformProperties({
2683
+ [propRef.$$reversedRef]: propValue
2684
+ }, propRef.refTransform));
2685
+ }
2686
+
2687
+ if (isBasicProperty(propRef)) {
2688
+ return [[propRef.refProperty, propValue]];
2689
+ } // Ignore Variable properties.
2690
+ // And mergeable properties are processed later.
2691
+
2692
+
2693
+ return [];
2694
+ }).filter(propRef => propRef[1] !== undefined))); // Brick properties can be merged multiple times.
2695
+
2696
+ if (reversedProxies.mergeBases.has(ref)) {
2697
+ Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
2698
+ var [mergeProperty, mergeBase] = _ref;
2699
+ return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
2700
+ }).filter(item => item[1] !== undefined)));
2701
+ }
2702
+ } // Use an approach like template-literal's quasis:
2703
+ // `quasi0${0}quais1${1}quasi2...`
2704
+ // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
2705
+
2706
+
2707
+ var quasisMap = new Map();
2708
+
2709
+ if (reversedProxies.slots.has(ref)) {
2710
+ for (var item of reversedProxies.slots.get(ref)) {
2711
+ var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
2712
+
2713
+ if (!quasisMap.has(item.refSlot)) {
2714
+ var quasis = []; // The size of quasis should be the existed slotted bricks' size plus one.
2715
+
2716
+ var size = brickUtils.hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
2717
+
2718
+ for (var i = 0; i < size; i += 1) {
2719
+ quasis.push([]);
2720
+ }
2721
+
2722
+ quasisMap.set(item.refSlot, quasis);
2723
+ }
2724
+
2725
+ var expandableSlot = quasisMap.get(item.refSlot);
2726
+ var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
2727
+ expandableSlot[lodash.clamp(refPosition < 0 ? expandableSlot.length + refPosition : refPosition, 0, expandableSlot.length - 1)].push(...((_externalSlots$item$$ = externalSlots === null || externalSlots === void 0 ? void 0 : (_externalSlots$item$$2 = externalSlots[item.$$reversedRef]) === null || _externalSlots$item$$2 === void 0 ? void 0 : _externalSlots$item$$2.bricks) !== null && _externalSlots$item$$ !== void 0 ? _externalSlots$item$$ : []));
2728
+ }
2729
+ }
2730
+
2731
+ var _loop = function (slotName, _quasis) {
2732
+ if (!brickUtils.hasOwnProperty(slots, slotName)) {
2733
+ slots[slotName] = {
2734
+ type: "bricks",
2735
+ bricks: []
2736
+ };
2737
+ }
2738
+
2739
+ var slotConf = slots[slotName];
2740
+ slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
2741
+
2742
+ if (slotConf.bricks.length === 0) {
2743
+ delete slots[slotName];
2744
+ }
2745
+ };
2746
+
2747
+ for (var [slotName, _quasis] of quasisMap.entries()) {
2748
+ _loop(slotName, _quasis);
2749
+ }
2750
+ }
2751
+
2752
+ return {
2753
+ [symbolForComputedPropsFromProxy]: computedPropsFromProxy,
2754
+ [symbolForRefForProxy]: refForProxy,
2755
+ [symbolForTplContextId]: templateContextId
2756
+ };
2757
+ }
2758
+
2759
+ function setupUseBrickInTemplate(props, proxyContext) {
2549
2760
  function walk(props) {
2550
2761
  if (!props) {
2551
2762
  return;
@@ -2567,16 +2778,22 @@
2567
2778
  }
2568
2779
 
2569
2780
  function setup(item) {
2570
- item[symbolForTplContextId] = tplContextId;
2781
+ var {
2782
+ ref,
2783
+ slots: slotsInTemplate
2784
+ } = item;
2785
+ item.slots = Object.fromEntries(Object.entries(slotsInTemplate !== null && slotsInTemplate !== void 0 ? slotsInTemplate : {}).map(_ref => {
2786
+ var _slotConf$bricks;
2787
+
2788
+ var [slotName, slotConf] = _ref;
2789
+ return [slotName, {
2790
+ type: "bricks",
2791
+ bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
2792
+ }];
2793
+ }));
2794
+ Object.assign(item, setupTemplateProxy(proxyContext, ref, item.slots));
2571
2795
  walk(item.properties);
2572
-
2573
- if (item.slots) {
2574
- Object.values(item.slots).forEach(slot => {
2575
- if (Array.isArray(slot.bricks)) {
2576
- slot.bricks.forEach(setup);
2577
- }
2578
- });
2579
- }
2796
+ return item;
2580
2797
  }
2581
2798
 
2582
2799
  walk(props);
@@ -2636,7 +2853,9 @@
2636
2853
  var realProps = computeRealProperties(properties, context, injectDeep);
2637
2854
 
2638
2855
  if (context.tplContextId) {
2639
- setupUseBrickInTemplate(realProps, context.tplContextId);
2856
+ setupUseBrickInTemplate(realProps, {
2857
+ templateContextId: context.tplContextId
2858
+ });
2640
2859
  }
2641
2860
 
2642
2861
  if (!Array.isArray(bricks)) {
@@ -10518,22 +10737,6 @@
10518
10737
 
10519
10738
  }
10520
10739
 
10521
- function isBasicProperty(propRef) {
10522
- return !!propRef.refProperty;
10523
- }
10524
- function isTransformableProperty(propRef) {
10525
- return !!propRef.refTransform;
10526
- }
10527
- function isMergeableProperty(propRef) {
10528
- return !!propRef.mergeProperty;
10529
- }
10530
- function isRefProperty(propRef) {
10531
- return !!propRef.ref;
10532
- }
10533
- function isVariableProperty(propRef) {
10534
- return !!propRef.asVariable;
10535
- }
10536
-
10537
10740
  function collectRefsInTemplate(template) {
10538
10741
  var refMap = new Map();
10539
10742
  collectRefsInBrickConfs(template.bricks, refMap);
@@ -10565,103 +10768,6 @@
10565
10768
  }
10566
10769
  }
10567
10770
 
10568
- function propertyMerge(conf, value, object) {
10569
- return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
10570
- }
10571
- function propertyMergeAll(mergeBase, object) {
10572
- if (mergeBase.mergeType === "array") {
10573
- return propertyMergeAllOfArray(mergeBase, object);
10574
- }
10575
-
10576
- if (mergeBase.mergeType === "object") {
10577
- return propertyMergeAllOfObject(mergeBase, object);
10578
- } // istanbul ignore next: should never reach
10579
-
10580
-
10581
- throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
10582
- }
10583
-
10584
- function propertyMergeAllOfArray(_ref, object) {
10585
- var _, _proxy$mergeArgs;
10586
-
10587
- var {
10588
- baseValue,
10589
- context,
10590
- proxies
10591
- } = _ref;
10592
- // Use an approach like template-literal's quasis:
10593
- // `quasi0${0}quais1${1}quasi2...`
10594
- // Every quasi can be merged with multiple items.
10595
- var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
10596
- $$lazyForUseBrick: true
10597
- }) : [];
10598
- var quasis = [];
10599
- var size = computedBaseValue.length + 1;
10600
-
10601
- for (var i = 0; i < size; i += 1) {
10602
- quasis.push([]);
10603
- }
10604
-
10605
- for (var proxy of proxies) {
10606
- var position = void 0;
10607
-
10608
- switch (proxy.mergeMethod) {
10609
- case "append":
10610
- position = computedBaseValue.length;
10611
- break;
10612
-
10613
- case "prepend":
10614
- position = 0;
10615
- break;
10616
-
10617
- case "insertAt":
10618
- // Defaults to `-1`.
10619
- position = (_ = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _ !== void 0 ? _ : -1;
10620
-
10621
- if (position < 0) {
10622
- // It's counted from the end if position is negative.
10623
- position += quasis.length;
10624
- }
10625
-
10626
- position = lodash.clamp(position, 0, computedBaseValue.length);
10627
- break;
10628
- // istanbul ignore next: should never reach
10629
-
10630
- default:
10631
- throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
10632
- }
10633
-
10634
- var patchValue = object[proxy.$$reversedRef];
10635
-
10636
- if (!Array.isArray(patchValue)) {
10637
- patchValue = [];
10638
- }
10639
-
10640
- quasis[position].push(...patchValue);
10641
- }
10642
-
10643
- return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
10644
- }
10645
-
10646
- function propertyMergeAllOfObject(_ref2, object) {
10647
- var {
10648
- baseValue,
10649
- proxies,
10650
- context
10651
- } = _ref2;
10652
- var computedBaseValue = brickUtils.isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
10653
- return proxies.reduce((acc, proxy) => {
10654
- switch (proxy.mergeMethod) {
10655
- case "extend":
10656
- return _objectSpread__default["default"](_objectSpread__default["default"]({}, acc), object[proxy.$$reversedRef]);
10657
- // istanbul ignore next: should never reach
10658
-
10659
- default:
10660
- throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
10661
- }
10662
- }, computedBaseValue);
10663
- }
10664
-
10665
10771
  function collectMergeBases(conf, mergeBases, contextInTemplate, refToBrickConf) {
10666
10772
  var mergeBaseMap;
10667
10773
 
@@ -10856,15 +10962,6 @@
10856
10962
  } = brickConfInTemplate,
10857
10963
  restBrickConfInTemplate = _objectWithoutProperties__default["default"](brickConfInTemplate, _excluded2);
10858
10964
 
10859
- var {
10860
- reversedProxies,
10861
- templateProperties,
10862
- externalSlots,
10863
- templateContextId,
10864
- proxyBrick
10865
- } = proxyContext;
10866
- var computedPropsFromProxy = {};
10867
- var refForProxy;
10868
10965
  var slots = Object.fromEntries(Object.entries(slotsInTemplate !== null && slotsInTemplate !== void 0 ? slotsInTemplate : {}).map(_ref => {
10869
10966
  var _slotConf$bricks;
10870
10967
 
@@ -10874,95 +10971,10 @@
10874
10971
  bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(item => expandBrickInTemplate(item, proxyContext))
10875
10972
  }];
10876
10973
  }));
10877
- setupUseBrickInTemplate(brickConfInTemplate.properties, templateContextId);
10878
-
10879
- if (ref) {
10880
- refForProxy = {};
10881
- proxyBrick.proxyRefs.set(ref, refForProxy); // Reversed proxies are used for expand storyboard before rendering page.
10882
-
10883
- if (reversedProxies.properties.has(ref)) {
10884
- Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(item => {
10885
- // `propValue` is computed.
10886
- var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[item.$$reversedRef];
10887
-
10888
- if (isTransformableProperty(item)) {
10889
- return Object.entries(preprocessTransformProperties({
10890
- [item.$$reversedRef]: propValue
10891
- }, item.refTransform));
10892
- }
10893
-
10894
- if (isBasicProperty(item)) {
10895
- return [[item.refProperty, propValue]];
10896
- } // Ignore Variable properties.
10897
- // And mergeable properties are processed later.
10898
-
10899
-
10900
- return [];
10901
- }).filter(item => item[1] !== undefined)));
10902
- } // Brick properties can be merged multiple times.
10903
-
10904
-
10905
- if (reversedProxies.mergeBases.has(ref)) {
10906
- Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref2 => {
10907
- var [mergeProperty, mergeBase] = _ref2;
10908
- return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
10909
- }).filter(item => item[1] !== undefined)));
10910
- } // Use an approach like template-literal's quasis:
10911
- // `quasi0${0}quais1${1}quasi2...`
10912
- // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
10913
-
10914
-
10915
- var quasisMap = new Map();
10916
-
10917
- if (reversedProxies.slots.has(ref)) {
10918
- for (var item of reversedProxies.slots.get(ref)) {
10919
- var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
10920
-
10921
- if (!quasisMap.has(item.refSlot)) {
10922
- var quasis = []; // The size of quasis should be the existed slotted bricks' size plus one.
10923
-
10924
- var size = brickUtils.hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
10925
-
10926
- for (var i = 0; i < size; i += 1) {
10927
- quasis.push([]);
10928
- }
10929
-
10930
- quasisMap.set(item.refSlot, quasis);
10931
- }
10932
-
10933
- var expandableSlot = quasisMap.get(item.refSlot);
10934
- var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
10935
- expandableSlot[lodash.clamp(refPosition < 0 ? expandableSlot.length + refPosition : refPosition, 0, expandableSlot.length - 1)].push(...((_externalSlots$item$$ = externalSlots === null || externalSlots === void 0 ? void 0 : (_externalSlots$item$$2 = externalSlots[item.$$reversedRef]) === null || _externalSlots$item$$2 === void 0 ? void 0 : _externalSlots$item$$2.bricks) !== null && _externalSlots$item$$ !== void 0 ? _externalSlots$item$$ : []));
10936
- }
10937
- }
10938
-
10939
- var _loop = function (slotName, _quasis) {
10940
- if (!brickUtils.hasOwnProperty(slots, slotName)) {
10941
- slots[slotName] = {
10942
- type: "bricks",
10943
- bricks: []
10944
- };
10945
- }
10946
-
10947
- var slotConf = slots[slotName];
10948
- slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
10949
-
10950
- if (slotConf.bricks.length === 0) {
10951
- delete slots[slotName];
10952
- }
10953
- };
10954
-
10955
- for (var [slotName, _quasis] of quasisMap.entries()) {
10956
- _loop(slotName, _quasis);
10957
- }
10958
- }
10959
-
10974
+ setupUseBrickInTemplate(brickConfInTemplate.properties, proxyContext);
10960
10975
  return _objectSpread__default["default"](_objectSpread__default["default"]({}, restBrickConfInTemplate), {}, {
10961
- slots,
10962
- [symbolForComputedPropsFromProxy]: computedPropsFromProxy,
10963
- [symbolForRefForProxy]: refForProxy,
10964
- [symbolForTplContextId]: templateContextId
10965
- });
10976
+ slots
10977
+ }, setupTemplateProxy(proxyContext, ref, slots));
10966
10978
  }
10967
10979
 
10968
10980
  // Otherwise, return false.
@@ -11569,19 +11581,7 @@
11569
11581
  return location;
11570
11582
  }
11571
11583
 
11572
- var setProxyRefForSlots = slots => {
11573
- slotsToChildren(slots).forEach(item => {
11574
- if (item[symbolForRefForProxy] !== undefined) {
11575
- item[symbolForRefForProxy].brick = item;
11576
- }
11577
-
11578
- if (!lodash.isEmpty(item.slots)) {
11579
- setProxyRefForSlots(item.slots);
11580
- }
11581
- });
11582
- };
11583
-
11584
- var setProxyRef = (useBrick, tplTagName, brick) => {
11584
+ var expandTemplateInUseBrick = (useBrick, tplTagName, brick) => {
11585
11585
  var template;
11586
11586
 
11587
11587
  if (tplTagName) {
@@ -11595,10 +11595,8 @@
11595
11595
  slots: useBrick.slots
11596
11596
  };
11597
11597
  template = expandCustomTemplate(tplConf, brick, _internalApiGetCurrentContext());
11598
- setProxyRefForSlots(template.slots);
11599
11598
  } else if (useBrick[symbolForRefForProxy]) {
11600
11599
  useBrick[symbolForRefForProxy].brick = brick;
11601
- setProxyRefForSlots(useBrick.slots);
11602
11600
  }
11603
11601
 
11604
11602
  return template;
@@ -11647,7 +11645,8 @@
11647
11645
  * @param props - 属性。
11648
11646
  */
11649
11647
 
11650
- var SingleBrickAsComponent = /*#__PURE__*/React__default["default"].memo(function SingleBrickAsComponent(_ref2) {
11648
+
11649
+ var SingleBrickAsComponent = /*#__PURE__*/React__default["default"].memo(function SingleBrickAsComponent(_ref) {
11651
11650
  var _internalApiGetCurren, _templateRef$current$, _templateRef$current, _templateRef$current2;
11652
11651
 
11653
11652
  var {
@@ -11655,7 +11654,7 @@
11655
11654
  data,
11656
11655
  refCallback,
11657
11656
  immediatelyRefCallback
11658
- } = _ref2;
11657
+ } = _ref;
11659
11658
  var templateRef = React.useRef();
11660
11659
  var tplTagName = getTagNameOfCustomTemplate(useBrick.brick, (_internalApiGetCurren = _internalApiGetCurrentContext().app) === null || _internalApiGetCurren === void 0 ? void 0 : _internalApiGetCurren.id);
11661
11660
  var isBrickAvailable = React__default["default"].useMemo(() => {
@@ -11685,15 +11684,15 @@
11685
11684
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
11686
11685
 
11687
11686
  var brick = getCurrentRunTimeBrick(useBrick, tplTagName, data);
11688
- templateRef.current = setProxyRef(useBrick, tplTagName, brick); // Let `transform` works still.
11687
+ templateRef.current = expandTemplateInUseBrick(useBrick, tplTagName, brick); // Let `transform` works still.
11689
11688
 
11690
11689
  transformProperties(brick.properties, data, useBrick.transform, useBrick.transformFrom, undefined, {
11691
11690
  allowInject: true
11692
11691
  }); // 设置 properties refProperty值
11693
11692
 
11694
11693
  if (useBrick[symbolForComputedPropsFromProxy]) {
11695
- Object.entries(useBrick[symbolForComputedPropsFromProxy]).forEach(_ref4 => {
11696
- var [propName, propValue] = _ref4;
11694
+ Object.entries(useBrick[symbolForComputedPropsFromProxy]).forEach(_ref3 => {
11695
+ var [propName, propValue] = _ref3;
11697
11696
  lodash.set(brick.properties, propName, propValue);
11698
11697
  });
11699
11698
  }
@@ -11712,7 +11711,7 @@
11712
11711
  return brick;
11713
11712
  }), [useBrick, data, isBrickAvailable]);
11714
11713
  var innerRefCallback = React__default["default"].useCallback( /*#__PURE__*/function () {
11715
- var _ref5 = _asyncToGenerator__default["default"](function* (element) {
11714
+ var _ref4 = _asyncToGenerator__default["default"](function* (element) {
11716
11715
  immediatelyRefCallback === null || immediatelyRefCallback === void 0 ? void 0 : immediatelyRefCallback(element);
11717
11716
 
11718
11717
  if (element) {
@@ -11748,7 +11747,7 @@
11748
11747
  } // 设置proxyEvent
11749
11748
 
11750
11749
 
11751
- handleProxyOfCustomTemplate(brick); // handleProxyOfParentTemplate(brick, tplContextId);
11750
+ handleProxyOfCustomTemplate(brick);
11752
11751
 
11753
11752
  if (element.$$typeof !== "custom-template") {
11754
11753
  if (!useBrick.brick.includes("-")) {
@@ -11763,7 +11762,7 @@
11763
11762
  });
11764
11763
 
11765
11764
  return function (_x) {
11766
- return _ref5.apply(this, arguments);
11765
+ return _ref4.apply(this, arguments);
11767
11766
  };
11768
11767
  }(), [runtimeBrick, useBrick, data, refCallback, immediatelyRefCallback]);
11769
11768
 
@@ -11798,11 +11797,11 @@
11798
11797
  * @param props - 属性。
11799
11798
  */
11800
11799
 
11801
- function BrickAsComponent(_ref6) {
11800
+ function BrickAsComponent(_ref5) {
11802
11801
  var {
11803
11802
  useBrick,
11804
11803
  data
11805
- } = _ref6;
11804
+ } = _ref5;
11806
11805
 
11807
11806
  if (Array.isArray(useBrick)) {
11808
11807
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, useBrick.map((item, index) => /*#__PURE__*/React__default["default"].createElement(SingleBrickAsComponent, {
@@ -11823,8 +11822,8 @@
11823
11822
  return [];
11824
11823
  }
11825
11824
 
11826
- return Object.entries(slots).flatMap(_ref7 => {
11827
- var [slot, slotConf] = _ref7;
11825
+ return Object.entries(slots).flatMap(_ref6 => {
11826
+ var [slot, slotConf] = _ref6;
11828
11827
  return Array.isArray(slotConf.bricks) ? slotConf.bricks.map(child => _objectSpread__default["default"](_objectSpread__default["default"]({}, child), {}, {
11829
11828
  properties: _objectSpread__default["default"](_objectSpread__default["default"]({}, child.properties), {}, {
11830
11829
  slot
@@ -11844,14 +11843,14 @@
11844
11843
  // eslint-disable-next-line react/display-name
11845
11844
 
11846
11845
 
11847
- var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React__default["default"].memo( /*#__PURE__*/React.forwardRef(function LegacySingleBrickAsComponent(_ref8, ref) {
11846
+ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React__default["default"].memo( /*#__PURE__*/React.forwardRef(function LegacySingleBrickAsComponent(_ref7, ref) {
11848
11847
  var _internalApiGetCurren2, _templateRef$current$2, _templateRef$current3, _templateRef$current4;
11849
11848
 
11850
11849
  var {
11851
11850
  useBrick,
11852
11851
  data,
11853
11852
  refCallback
11854
- } = _ref8;
11853
+ } = _ref7;
11855
11854
  var brickRef = React.useRef();
11856
11855
  var templateRef = React.useRef();
11857
11856
  var tplTagName = getTagNameOfCustomTemplate(useBrick.brick, (_internalApiGetCurren2 = _internalApiGetCurrentContext().app) === null || _internalApiGetCurren2 === void 0 ? void 0 : _internalApiGetCurren2.id);
@@ -11887,15 +11886,15 @@
11887
11886
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
11888
11887
 
11889
11888
  var brick = getCurrentRunTimeBrick(useBrick, tplTagName, data);
11890
- templateRef.current = setProxyRef(useBrick, tplTagName, brick); // Let `transform` works still.
11889
+ templateRef.current = expandTemplateInUseBrick(useBrick, tplTagName, brick); // Let `transform` works still.
11891
11890
 
11892
11891
  transformProperties(brick.properties, data, useBrick.transform, useBrick.transformFrom, undefined, {
11893
11892
  allowInject: true
11894
11893
  }); // 设置 properties refProperty值
11895
11894
 
11896
11895
  if (useBrick[symbolForComputedPropsFromProxy]) {
11897
- Object.entries(useBrick[symbolForComputedPropsFromProxy]).forEach(_ref10 => {
11898
- var [propName, propValue] = _ref10;
11896
+ Object.entries(useBrick[symbolForComputedPropsFromProxy]).forEach(_ref9 => {
11897
+ var [propName, propValue] = _ref9;
11899
11898
  lodash.set(brick.properties, propName, propValue);
11900
11899
  });
11901
11900
  }
@@ -11914,7 +11913,7 @@
11914
11913
  return brick;
11915
11914
  }), [useBrick, data, isBrickAvailable]);
11916
11915
  var innerRefCallback = React__default["default"].useCallback( /*#__PURE__*/function () {
11917
- var _ref11 = _asyncToGenerator__default["default"](function* (element) {
11916
+ var _ref10 = _asyncToGenerator__default["default"](function* (element) {
11918
11917
  brickRef.current = element;
11919
11918
 
11920
11919
  if (element) {
@@ -11950,7 +11949,7 @@
11950
11949
  } // 设置proxyEvent
11951
11950
 
11952
11951
 
11953
- handleProxyOfCustomTemplate(brick); // handleProxyOfParentTemplate(brick, tplContextId);
11952
+ handleProxyOfCustomTemplate(brick);
11954
11953
 
11955
11954
  if (element.$$typeof !== "custom-template") {
11956
11955
  if (!useBrick.brick.includes("-")) {
@@ -11965,7 +11964,7 @@
11965
11964
  });
11966
11965
 
11967
11966
  return function (_x2) {
11968
- return _ref11.apply(this, arguments);
11967
+ return _ref10.apply(this, arguments);
11969
11968
  };
11970
11969
  }(), [runtimeBrick, useBrick, data, refCallback]);
11971
11970