@next-core/brick-utils 2.41.2 → 2.42.1

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,28 @@
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.42.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.42.0...@next-core/brick-utils@2.42.1) (2022-09-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix router.if was null and return false ([cdef1d6](https://github.com/easyops-cn/next-core/commit/cdef1d61fd739b2de7666aae18591488b8cf4253))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.42.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.41.2...@next-core/brick-utils@2.42.0) (2022-09-26)
18
+
19
+
20
+ ### Features
21
+
22
+ * support router if condition ([4486130](https://github.com/easyops-cn/next-core/commit/44861303b0c236ec36f3bb55f469229e23116e5d))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [2.41.2](https://github.com/easyops-cn/next-core/compare/@next-core/brick-utils@2.41.1...@next-core/brick-utils@2.41.2) (2022-09-25)
7
29
 
8
30
  **Note:** Version bump only for package @next-core/brick-utils
@@ -21639,7 +21639,9 @@
21639
21639
  path: p,
21640
21640
  exact = false,
21641
21641
  strict = false,
21642
- sensitive = true
21642
+ sensitive = true,
21643
+ checkIf,
21644
+ getContext
21643
21645
  } = options;
21644
21646
  var paths = Array.isArray(p) ? p : [p];
21645
21647
  return paths.reduce((matched, path) => {
@@ -21669,7 +21671,7 @@
21669
21671
  }
21670
21672
 
21671
21673
  var initialParams = {};
21672
- return {
21674
+ var result = {
21673
21675
  path,
21674
21676
  // the path used to match
21675
21677
  url: path === "/" && url === "" ? "/" : url,
@@ -21681,6 +21683,12 @@
21681
21683
  return memo;
21682
21684
  }, initialParams)
21683
21685
  };
21686
+
21687
+ if (checkIf && !checkIf(getContext(result))) {
21688
+ return null;
21689
+ }
21690
+
21691
+ return result;
21684
21692
  }, null);
21685
21693
  }
21686
21694
  function toPath(path, pathParams) {
@@ -22821,7 +22829,7 @@
22821
22829
 
22822
22830
  var jsonFieldsInRoute = ["menu", "providers", "segues", "defineResolves", "redirect", "analyticsData"]; // Fields stored as yaml string will be parsed when build & push.
22823
22831
 
22824
- var yamlFieldsInRoute = ["permissionsPreCheck"];
22832
+ var yamlFieldsInRoute = ["permissionsPreCheck", "if"];
22825
22833
  var jsonFieldsInBrick = ["properties", "events", "lifeCycle", "params", "if", "transform"]; // Fields stored as yaml string will be parsed when build & push.
22826
22834
 
22827
22835
  var yamlFieldsInBrick = ["permissionsPreCheck", "transformFrom"]; // Fields started with `_` will be removed by default.