@nocobase/client 1.7.1 → 1.8.0-alpha.2

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.
@@ -54,6 +54,30 @@ export interface ApplicationOptions {
54
54
  dataSourceManager?: DataSourceManagerOptions;
55
55
  disableAcl?: boolean;
56
56
  }
57
+ /**
58
+ * Reference: https://ant.design/components/cascader-cn#option
59
+ */
60
+ interface VariableOption {
61
+ /** Unique identifier of the variable */
62
+ value: string | number;
63
+ /** Variable name displayed in UI */
64
+ label?: React.ReactNode;
65
+ disabled?: boolean;
66
+ children?: VariableOption[];
67
+ }
68
+ interface Variable {
69
+ /** Unique identifier of the variable */
70
+ name: string;
71
+ /** Variable configuration options */
72
+ useOption: () => ({
73
+ option: VariableOption;
74
+ visible?: boolean;
75
+ });
76
+ /** Variable context */
77
+ useCtx: () => (any | ((param: {
78
+ variableName: string;
79
+ }) => Promise<any>));
80
+ }
57
81
  export declare class Application {
58
82
  protected options: ApplicationOptions;
59
83
  eventBus: EventTarget;
@@ -83,6 +107,7 @@ export declare class Application {
83
107
  error: any;
84
108
  hasLoadError: boolean;
85
109
  private wsAuthorized;
110
+ private variables;
86
111
  get pm(): PluginManager;
87
112
  get disableAcl(): boolean;
88
113
  get isWsAuthorized(): boolean;
@@ -149,5 +174,18 @@ export declare class Application {
149
174
  addUserCenterSettingsItem(item: SchemaSettingsItemType & {
150
175
  aclSnippet?: string;
151
176
  }): void;
177
+ /**
178
+ * Register a variable for use in the frontend
179
+ *
180
+ * Note: It is not recommended to register variables in components as it may cause rendering errors
181
+ * @param variable
182
+ * @returns
183
+ */
184
+ registerVariable(variable: Variable): void;
185
+ /**
186
+ * Get all registered variables
187
+ * @returns
188
+ */
189
+ getVariables(): Variable[];
152
190
  }
153
191
  export {};
@@ -35,6 +35,10 @@ export interface FlagProviderProps {
35
35
  isVariableParsedInOtherContext?: boolean;
36
36
  collectionField?: any;
37
37
  children?: any;
38
+ /**
39
+ * 是否存在于变量选择器中
40
+ */
41
+ isInXButton?: boolean;
38
42
  }
39
43
  export declare const FlagContext: React.Context<Omit<FlagProviderProps, "children">>;
40
44
  export declare const FlagProvider: FC<FlagProviderProps>;
@@ -0,0 +1 @@
1
+ export declare const useEvaluatedExpression: (expression: string) => string | number;