@next-core/brick-kit 2.104.2 → 2.104.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.104.3](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.104.2...@next-core/brick-kit@2.104.3) (2022-02-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix missing tpl context when setting properties by callback ([c681dd4](https://github.com/easyops-cn/next-core/commit/c681dd41baec10a9f5eb13ac6bccfa5ae559044c))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.104.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.104.1...@next-core/brick-kit@2.104.2) (2022-02-15)
7
18
 
8
19
 
@@ -2434,6 +2434,49 @@
2434
2434
  }
2435
2435
  }
2436
2436
 
2437
+ var customTemplateRegistry = new Map();
2438
+ var appRegistered = new Set();
2439
+ var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
2440
+ var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
2441
+ var symbolForTplContextId = Symbol.for("tpl.contextId");
2442
+
2443
+ function setupUseBrickInTemplate(props, tplContextId) {
2444
+ function walk(props) {
2445
+ if (!props) {
2446
+ return;
2447
+ }
2448
+
2449
+ for (var [key, value] of Object.entries(props)) {
2450
+ if (brickUtils.isObject(value)) {
2451
+ if (key === "useBrick") {
2452
+ if (Array.isArray(value)) {
2453
+ value.forEach(setup);
2454
+ } else {
2455
+ setup(value);
2456
+ }
2457
+ } else {
2458
+ walk(value);
2459
+ }
2460
+ }
2461
+ }
2462
+ }
2463
+
2464
+ function setup(item) {
2465
+ item[symbolForTplContextId] = tplContextId;
2466
+ walk(item.properties);
2467
+
2468
+ if (item.slots) {
2469
+ Object.values(item.slots).forEach(slot => {
2470
+ if (Array.isArray(slot.bricks)) {
2471
+ slot.bricks.forEach(setup);
2472
+ }
2473
+ });
2474
+ }
2475
+ }
2476
+
2477
+ walk(props);
2478
+ }
2479
+
2437
2480
  var computeRealValue = (value, context, injectDeep, internalOptions) => {
2438
2481
  var preEvaluated = isPreEvaluated(value);
2439
2482
 
@@ -2487,6 +2530,10 @@
2487
2530
  function setProperties(bricks, properties, context, injectDeep) {
2488
2531
  var realProps = computeRealProperties(properties, context, injectDeep);
2489
2532
 
2533
+ if (context.tplContextId) {
2534
+ setupUseBrickInTemplate(realProps, context.tplContextId);
2535
+ }
2536
+
2490
2537
  if (!Array.isArray(bricks)) {
2491
2538
  bricks = [bricks];
2492
2539
  }
@@ -10001,12 +10048,6 @@
10001
10048
 
10002
10049
  }
10003
10050
 
10004
- var customTemplateRegistry = new Map();
10005
- var appRegistered = new Set();
10006
- var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
10007
- var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
10008
- var symbolForTplContextId = Symbol.for("tpl.contextId");
10009
-
10010
10051
  function isBasicProperty(propRef) {
10011
10052
  return !!propRef.refProperty;
10012
10053
  }
@@ -10181,43 +10222,6 @@
10181
10222
  }
10182
10223
  }
10183
10224
 
10184
- function setupUseBrickInTemplate(props, tplContextId) {
10185
- function walk(props) {
10186
- if (!props) {
10187
- return;
10188
- }
10189
-
10190
- for (var [key, value] of Object.entries(props)) {
10191
- if (brickUtils.isObject(value)) {
10192
- if (key === "useBrick") {
10193
- if (Array.isArray(value)) {
10194
- value.forEach(setup);
10195
- } else {
10196
- setup(value);
10197
- }
10198
- } else {
10199
- walk(value);
10200
- }
10201
- }
10202
- }
10203
- }
10204
-
10205
- function setup(item) {
10206
- item[symbolForTplContextId] = tplContextId;
10207
- walk(item.properties);
10208
-
10209
- if (item.slots) {
10210
- Object.values(item.slots).forEach(slot => {
10211
- if (Array.isArray(slot.bricks)) {
10212
- slot.bricks.forEach(setup);
10213
- }
10214
- });
10215
- }
10216
- }
10217
-
10218
- walk(props);
10219
- }
10220
-
10221
10225
  var _excluded$1 = ["properties", "slots"],
10222
10226
  _excluded2 = ["ref", "slots"];
10223
10227
  function expandCustomTemplate(brickConf, proxyBrick, context) {