@next-core/brick-kit 2.136.2 → 2.137.0

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.137.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.136.2...@next-core/brick-kit@2.137.0) (2022-09-06)
7
+
8
+
9
+ ### Features
10
+
11
+ * support to use contract in widgets ([25b3337](https://github.com/easyops-cn/next-core/commit/25b333724f9c45131b209845a7caef3e8597888d))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.136.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.136.1...@next-core/brick-kit@2.136.2) (2022-09-06)
7
18
 
8
19
  **Note:** Version bump only for package @next-core/brick-kit
@@ -6054,13 +6054,25 @@
6054
6054
  }();
6055
6055
 
6056
6056
  var contractsMap = new Map();
6057
- function collectContract(contracts) {
6057
+ var widgetContractMap = new Map();
6058
+
6059
+ var addContract = (contracts, map) => {
6058
6060
  contracts === null || contracts === void 0 ? void 0 : contracts.forEach(contract => {
6059
- contractsMap.set("".concat(contract.namespaceId, ".").concat(contract.name), contract);
6061
+ map.set("".concat(contract.namespaceId, ".").concat(contract.name), contract);
6060
6062
  });
6063
+ };
6064
+
6065
+ function collectContract(contracts) {
6066
+ addContract(contracts, contractsMap);
6067
+ }
6068
+ function collectWidgetContract(contracts) {
6069
+ addContract(contracts, widgetContractMap);
6070
+ }
6071
+ function clearCollectWidgetContract() {
6072
+ widgetContractMap.clear();
6061
6073
  }
6062
6074
  function getContract(name) {
6063
- return contractsMap.get(name);
6075
+ return contractsMap.get(name) || widgetContractMap.get(name);
6064
6076
  }
6065
6077
 
6066
6078
  var flowApiDefinitionPromiseMap = new Map(); // Legacy Custom API: `${namespace}@${name}`
@@ -8405,7 +8417,8 @@
8405
8417
  var {
8406
8418
  bricks,
8407
8419
  proxy,
8408
- state
8420
+ state,
8421
+ contracts
8409
8422
  } = template;
8410
8423
 
8411
8424
  var {
@@ -8421,6 +8434,11 @@
8421
8434
  proxyBrick.proxy = proxyCopy;
8422
8435
  proxyBrick.proxyRefs = new Map();
8423
8436
  proxyBrick.stateNames = state === null || state === void 0 ? void 0 : state.map(item => item.name);
8437
+
8438
+ if (contracts) {
8439
+ collectWidgetContract(contracts);
8440
+ }
8441
+
8424
8442
  var refToBrickConf = collectRefsInTemplate(template); // Reversed proxies are used for expand storyboard before rendering page.
8425
8443
 
8426
8444
  var reversedProxies = {
@@ -11925,6 +11943,7 @@
11925
11943
  _this3.renderId = _.uniqueId("render-id-");
11926
11944
  resetAllInjected();
11927
11945
  clearPollTimeout();
11946
+ clearCollectWidgetContract();
11928
11947
 
11929
11948
  if (_this3.locationContext) {
11930
11949
  _this3.locationContext.resolver.resetRefreshQueue();