@next-bricks/nav 1.19.1 → 1.20.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/dist/types.json CHANGED
@@ -2296,17 +2296,11 @@
2296
2296
  {
2297
2297
  "name": "variant",
2298
2298
  "annotation": {
2299
- "type": "union",
2300
- "types": [
2301
- {
2302
- "type": "jsLiteral",
2303
- "value": "launchpad-config"
2304
- },
2305
- {
2306
- "type": "jsLiteral",
2307
- "value": "menu-config"
2308
- }
2309
- ]
2299
+ "type": "reference",
2300
+ "typeName": {
2301
+ "type": "identifier",
2302
+ "name": "ConfigVariant"
2303
+ }
2310
2304
  }
2311
2305
  },
2312
2306
  {
@@ -2322,6 +2316,16 @@
2322
2316
  "type": "keyword",
2323
2317
  "value": "string"
2324
2318
  }
2319
+ },
2320
+ {
2321
+ "name": "blacklist",
2322
+ "annotation": {
2323
+ "type": "array",
2324
+ "elementType": {
2325
+ "type": "keyword",
2326
+ "value": "string"
2327
+ }
2328
+ }
2325
2329
  }
2326
2330
  ],
2327
2331
  "events": [
@@ -2344,6 +2348,19 @@
2344
2348
  "type": "interface",
2345
2349
  "name": "ConfigMenuGroup",
2346
2350
  "body": [
2351
+ {
2352
+ "type": "propertySignature",
2353
+ "key": {
2354
+ "type": "identifier",
2355
+ "name": "type"
2356
+ },
2357
+ "annotation": {
2358
+ "type": "jsLiteral",
2359
+ "value": "group"
2360
+ },
2361
+ "optional": true,
2362
+ "computed": false
2363
+ },
2347
2364
  {
2348
2365
  "type": "propertySignature",
2349
2366
  "key": {
@@ -2374,6 +2391,22 @@
2374
2391
  }
2375
2392
  },
2376
2393
  "computed": false
2394
+ },
2395
+ {
2396
+ "type": "propertySignature",
2397
+ "key": {
2398
+ "type": "identifier",
2399
+ "name": "blockableUrls"
2400
+ },
2401
+ "annotation": {
2402
+ "type": "array",
2403
+ "elementType": {
2404
+ "type": "keyword",
2405
+ "value": "string"
2406
+ }
2407
+ },
2408
+ "optional": true,
2409
+ "computed": false
2377
2410
  }
2378
2411
  ],
2379
2412
  "extends": [
@@ -2614,6 +2647,62 @@
2614
2647
  "value": "string"
2615
2648
  },
2616
2649
  "computed": false
2650
+ },
2651
+ {
2652
+ "type": "propertySignature",
2653
+ "key": {
2654
+ "type": "identifier",
2655
+ "name": "blockable"
2656
+ },
2657
+ "annotation": {
2658
+ "type": "keyword",
2659
+ "value": "boolean"
2660
+ },
2661
+ "optional": true,
2662
+ "computed": false,
2663
+ "description": "有可屏蔽的"
2664
+ },
2665
+ {
2666
+ "type": "propertySignature",
2667
+ "key": {
2668
+ "type": "identifier",
2669
+ "name": "hasBlocked"
2670
+ },
2671
+ "annotation": {
2672
+ "type": "keyword",
2673
+ "value": "boolean"
2674
+ },
2675
+ "optional": true,
2676
+ "computed": false,
2677
+ "description": "有可屏蔽且已屏蔽的"
2678
+ },
2679
+ {
2680
+ "type": "propertySignature",
2681
+ "key": {
2682
+ "type": "identifier",
2683
+ "name": "hasUnblocked"
2684
+ },
2685
+ "annotation": {
2686
+ "type": "keyword",
2687
+ "value": "boolean"
2688
+ },
2689
+ "optional": true,
2690
+ "computed": false,
2691
+ "description": "有可屏蔽且未屏蔽的"
2692
+ },
2693
+ {
2694
+ "type": "propertySignature",
2695
+ "key": {
2696
+ "type": "identifier",
2697
+ "name": "allBlocked"
2698
+ },
2699
+ "annotation": {
2700
+ "type": "keyword",
2701
+ "value": "boolean"
2702
+ },
2703
+ "optional": true,
2704
+ "computed": false,
2705
+ "description": "全部被屏蔽了"
2617
2706
  }
2618
2707
  ]
2619
2708
  },
@@ -2644,6 +2733,19 @@
2644
2733
  "value": "string"
2645
2734
  },
2646
2735
  "computed": false
2736
+ },
2737
+ {
2738
+ "type": "propertySignature",
2739
+ "key": {
2740
+ "type": "identifier",
2741
+ "name": "blockableUrl"
2742
+ },
2743
+ "annotation": {
2744
+ "type": "keyword",
2745
+ "value": "string"
2746
+ },
2747
+ "optional": true,
2748
+ "computed": false
2647
2749
  }
2648
2750
  ],
2649
2751
  "extends": [
@@ -2689,6 +2791,22 @@
2689
2791
  }
2690
2792
  },
2691
2793
  "computed": false
2794
+ },
2795
+ {
2796
+ "type": "propertySignature",
2797
+ "key": {
2798
+ "type": "identifier",
2799
+ "name": "blockableUrls"
2800
+ },
2801
+ "annotation": {
2802
+ "type": "array",
2803
+ "elementType": {
2804
+ "type": "keyword",
2805
+ "value": "string"
2806
+ }
2807
+ },
2808
+ "optional": true,
2809
+ "computed": false
2692
2810
  }
2693
2811
  ],
2694
2812
  "extends": [
@@ -2705,112 +2823,56 @@
2705
2823
  "type": "typeAlias",
2706
2824
  "name": "MenuAction",
2707
2825
  "annotation": {
2708
- "type": "union",
2826
+ "type": "intersection",
2709
2827
  "types": [
2710
2828
  {
2711
2829
  "type": "reference",
2712
2830
  "typeName": {
2713
2831
  "type": "identifier",
2714
- "name": "MenuSimpleAction"
2832
+ "name": "Action"
2715
2833
  }
2716
2834
  },
2717
2835
  {
2718
- "type": "reference",
2719
- "typeName": {
2720
- "type": "identifier",
2721
- "name": "MenuActionDivider"
2722
- }
2836
+ "type": "typeLiteral",
2837
+ "members": [
2838
+ {
2839
+ "type": "propertySignature",
2840
+ "key": {
2841
+ "type": "identifier",
2842
+ "name": "if"
2843
+ },
2844
+ "annotation": {
2845
+ "type": "keyword",
2846
+ "value": "unknown"
2847
+ },
2848
+ "optional": true,
2849
+ "computed": false
2850
+ }
2851
+ ]
2723
2852
  }
2724
2853
  ]
2725
2854
  }
2726
2855
  },
2727
2856
  {
2728
- "type": "interface",
2729
- "name": "MenuSimpleAction",
2730
- "body": [
2731
- {
2732
- "type": "propertySignature",
2733
- "key": {
2734
- "type": "identifier",
2735
- "name": "text"
2736
- },
2737
- "annotation": {
2738
- "type": "keyword",
2739
- "value": "string"
2740
- },
2741
- "computed": false
2742
- },
2743
- {
2744
- "type": "propertySignature",
2745
- "key": {
2746
- "type": "identifier",
2747
- "name": "event"
2748
- },
2749
- "annotation": {
2750
- "type": "keyword",
2751
- "value": "string"
2752
- },
2753
- "optional": true,
2754
- "computed": false
2755
- },
2756
- {
2757
- "type": "propertySignature",
2758
- "key": {
2759
- "type": "identifier",
2760
- "name": "if"
2761
- },
2762
- "annotation": {
2763
- "type": "keyword",
2764
- "value": "unknown"
2765
- },
2766
- "optional": true,
2767
- "computed": false
2768
- },
2769
- {
2770
- "type": "propertySignature",
2771
- "key": {
2772
- "type": "identifier",
2773
- "name": "danger"
2774
- },
2775
- "annotation": {
2776
- "type": "keyword",
2777
- "value": "boolean"
2778
- },
2779
- "optional": true,
2780
- "computed": false
2781
- }
2782
- ]
2783
- },
2784
- {
2785
- "type": "interface",
2786
- "name": "MenuActionDivider",
2787
- "body": [
2788
- {
2789
- "type": "propertySignature",
2790
- "key": {
2791
- "type": "identifier",
2792
- "name": "if"
2793
- },
2794
- "annotation": {
2795
- "type": "keyword",
2796
- "value": "unknown"
2797
- },
2798
- "optional": true,
2799
- "computed": false
2800
- },
2801
- {
2802
- "type": "propertySignature",
2803
- "key": {
2804
- "type": "identifier",
2805
- "name": "type"
2857
+ "type": "typeAlias",
2858
+ "name": "ConfigVariant",
2859
+ "annotation": {
2860
+ "type": "union",
2861
+ "types": [
2862
+ {
2863
+ "type": "jsLiteral",
2864
+ "value": "launchpad-config"
2806
2865
  },
2807
- "annotation": {
2866
+ {
2808
2867
  "type": "jsLiteral",
2809
- "value": "divider"
2868
+ "value": "menu-config"
2810
2869
  },
2811
- "computed": false
2812
- }
2813
- ]
2870
+ {
2871
+ "type": "jsLiteral",
2872
+ "value": "blacklist-config"
2873
+ }
2874
+ ]
2875
+ }
2814
2876
  },
2815
2877
  {
2816
2878
  "type": "interface",
@@ -2853,7 +2915,7 @@
2853
2915
  "type": "reference",
2854
2916
  "typeName": {
2855
2917
  "type": "identifier",
2856
- "name": "MenuSimpleAction"
2918
+ "name": "MenuAction"
2857
2919
  }
2858
2920
  },
2859
2921
  "computed": false
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import type { ConfigMenuGroup, ConfigMenuItemDir, ConfigMenuItemNormal, MenuAction, MenuActionEventDetail } from "./interfaces";
2
+ import type { ConfigMenuGroup, ConfigMenuItemDir, ConfigMenuItemNormal, ConfigVariant, MenuAction, MenuActionEventDetail } from "./interfaces";
3
3
  export interface MenuGroupProps {
4
4
  data: ConfigMenuGroup;
5
5
  actions?: MenuAction[];
6
- variant?: "launchpad-config" | "menu-config";
6
+ variant?: ConfigVariant;
7
7
  urlTemplate?: string;
8
8
  customUrlTemplate?: string;
9
9
  onActionClick?: (detail: MenuActionEventDetail) => void;
@@ -12,7 +12,7 @@ export declare function MenuGroup({ data, actions, variant, urlTemplate, customU
12
12
  export interface MenuItemProps {
13
13
  data: ConfigMenuItemNormal;
14
14
  actions?: MenuAction[];
15
- variant?: "launchpad-config" | "menu-config";
15
+ variant?: ConfigVariant;
16
16
  urlTemplate?: string;
17
17
  customUrlTemplate?: string;
18
18
  onActionClick?: (detail: MenuActionEventDetail) => void;
@@ -21,7 +21,7 @@ export declare function MenuItem({ data, actions, variant, urlTemplate, customUr
21
21
  export interface MenuItemFolderProps {
22
22
  data: ConfigMenuItemDir;
23
23
  actions?: MenuAction[];
24
- variant?: "launchpad-config" | "menu-config";
24
+ variant?: ConfigVariant;
25
25
  urlTemplate?: string;
26
26
  customUrlTemplate?: string;
27
27
  onActionClick?: (detail: MenuActionEventDetail) => void;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { ReactNextElement } from "@next-core/react-element";
3
3
  import "@next-core/theme";
4
- import type { ConfigMenuGroup, MenuAction, MenuActionEventDetail } from "./interfaces";
4
+ import type { ConfigMenuGroup, ConfigVariant, MenuAction, MenuActionEventDetail } from "./interfaces";
5
5
  /**
6
6
  * 进行 Launchpad 配置。
7
7
  *
@@ -16,7 +16,7 @@ export declare class LaunchpadConfig extends ReactNextElement implements Launchp
16
16
  /**
17
17
  * @default "launchpad-config"
18
18
  */
19
- accessor variant: "launchpad-config" | "menu-config" | undefined;
19
+ accessor variant: ConfigVariant | undefined;
20
20
  /**
21
21
  * 菜单项 APP 类型的链接模板,例如可配置为 `/app/{{ id }}`。
22
22
  *
@@ -31,14 +31,21 @@ export declare class LaunchpadConfig extends ReactNextElement implements Launchp
31
31
  * `__pathname` 是运行时变量,表示 url 解析后的 pathname。
32
32
  */
33
33
  accessor customUrlTemplate: string | undefined;
34
+ /**
35
+ * 屏蔽的 URL 列表,例如可配置为 `["/app/1", "/app/2"]`。
36
+ *
37
+ * 注:仅用于 variant: "blacklist-config"。
38
+ */
39
+ accessor blacklist: string[] | undefined;
34
40
  render(): React.JSX.Element;
35
41
  }
36
42
  export interface LaunchpadConfigProps {
37
43
  menuGroups?: ConfigMenuGroup[];
38
44
  actions?: MenuAction[];
39
- variant?: "launchpad-config" | "menu-config";
45
+ variant?: ConfigVariant;
40
46
  urlTemplate?: string;
41
47
  customUrlTemplate?: string;
48
+ blacklist?: string[];
42
49
  onActionClick?: (detail: MenuActionEventDetail) => void;
43
50
  }
44
- export declare function LaunchpadConfigComponent({ menuGroups, actions, variant, urlTemplate, customUrlTemplate, onActionClick, }: LaunchpadConfigProps): React.JSX.Element;
51
+ export declare function LaunchpadConfigComponent({ menuGroups, actions, variant, urlTemplate, customUrlTemplate, blacklist, onActionClick, }: LaunchpadConfigProps): React.JSX.Element;
@@ -1,8 +1,11 @@
1
1
  import { AppLocales } from "@next-core/types";
2
2
  import type { LegacyAntdIcon, MenuIcon } from "@next-shared/general/types";
3
+ import type { Action } from "@next-bricks/basic/actions";
3
4
  export interface ConfigMenuGroup extends ConfigMenuBase {
5
+ type?: "group";
4
6
  order?: number;
5
7
  items: ConfigMenuItem[];
8
+ blockableUrls?: string[];
6
9
  }
7
10
  export type ConfigMenuItem = ConfigMenuItemNormal | ConfigMenuItemDir;
8
11
  export type ConfigMenuItemNormal = ConfigMenuItemApp | ConfigMenuItemCustom;
@@ -14,10 +17,12 @@ export interface ConfigMenuItemApp extends ConfigMenuItemBase {
14
17
  export interface ConfigMenuItemCustom extends ConfigMenuItemBase {
15
18
  type: "custom";
16
19
  url: string;
20
+ blockableUrl?: string;
17
21
  }
18
22
  export interface ConfigMenuItemDir extends ConfigMenuItemBase {
19
23
  type: "dir";
20
24
  items: ConfigMenuItemNormal[];
25
+ blockableUrls?: string[];
21
26
  }
22
27
  interface ConfigMenuItemBase extends ConfigMenuBase {
23
28
  type: "app" | "custom" | "dir";
@@ -28,20 +33,21 @@ interface ConfigMenuBase {
28
33
  id: string;
29
34
  name: string;
30
35
  instanceId: string;
31
- }
32
- export type MenuAction = MenuSimpleAction | MenuActionDivider;
33
- export interface MenuSimpleAction {
34
- text: string;
35
- event?: string;
36
- if?: unknown;
37
- danger?: boolean;
38
- }
39
- export interface MenuActionDivider {
36
+ /** 有可屏蔽的 */
37
+ blockable?: boolean;
38
+ /** 有可屏蔽且已屏蔽的 */
39
+ hasBlocked?: boolean;
40
+ /** 有可屏蔽且未屏蔽的 */
41
+ hasUnblocked?: boolean;
42
+ /** 全部被屏蔽了 */
43
+ allBlocked?: boolean;
44
+ }
45
+ export type MenuAction = Action & {
40
46
  if?: unknown;
41
- type: "divider";
42
- }
47
+ };
43
48
  export interface MenuActionEventDetail {
44
49
  data: ConfigMenuGroup | ConfigMenuItem;
45
- action: MenuSimpleAction;
50
+ action: MenuAction;
46
51
  }
52
+ export type ConfigVariant = "launchpad-config" | "menu-config" | "blacklist-config";
47
53
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/nav",
3
- "version": "1.19.1",
3
+ "version": "1.20.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/nav",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "postpublish": "mv package.json.bak package.json"
36
36
  },
37
37
  "devDependencies": {
38
- "@next-core/build-next-bricks": "^1.23.9",
38
+ "@next-core/build-next-bricks": "^1.23.10",
39
39
  "@next-core/test-next": "^1.1.8"
40
40
  },
41
41
  "peerDependencies": {
@@ -43,5 +43,5 @@
43
43
  "@next-bricks/form": "*",
44
44
  "@next-bricks/icons": "*"
45
45
  },
46
- "gitHead": "bd20e7cd3c0d30cd3048f4bde97e7f67090ab8bd"
46
+ "gitHead": "a191ee3271d26c550f769f492f0934cb862b1682"
47
47
  }