zf-dbs 0.1.16 → 0.1.17

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.
@@ -1,4 +1,4 @@
1
- import { z as p, z as e } from "../chunks/D91KXUFh.mjs";
1
+ import { z as p, z as e } from "../chunks/DfHvYfab.mjs";
2
2
  export {
3
3
  p as ZfApp,
4
4
  e as default
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ import { Ref as Ref_2 } from 'vue';
12
12
  import { RequestError } from 'zf-utilz';
13
13
  import { RequestInstance } from 'zf-utilz';
14
14
  import { RequestResult } from 'zf-utilz';
15
+ import { ShallowRef } from 'vue';
15
16
  import { UnwrapNestedRefs } from 'vue';
16
17
 
17
18
  declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -74,7 +75,7 @@ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
74
75
  };
75
76
  };
76
77
 
77
- export declare interface Config {
78
+ export declare interface AppConfig {
78
79
  /** 项目名称 */
79
80
  appTitle: string;
80
81
  /** 项目高度,用于计算缩放比例(非必要不要修改,通过修改宽度来适配) */
@@ -94,7 +95,16 @@ export declare interface Config {
94
95
  /** 轮询间隔 */
95
96
  pollingInterval: number;
96
97
  /** 接口请求 */
97
- request: DefineRequestOptions;
98
+ request: DefineRequestOptions & {
99
+ /** API 请求错误显示消息 */
100
+ showErrorMessage?: boolean;
101
+ };
102
+ }
103
+
104
+ declare class AppInfo {
105
+ readonly appId: string;
106
+ get appElement(): HTMLElement | null;
107
+ get appViewElement(): HTMLElement | null;
98
108
  }
99
109
 
100
110
  declare const _default: {
@@ -102,7 +112,9 @@ declare const _default: {
102
112
  };
103
113
  export default _default;
104
114
 
105
- export declare function defineConfig(value: Partial<Config>): globalThis.Ref<Config>;
115
+ export declare function defineAppConfig(value: DefineAppConfigOptions): globalThis.Ref<AppConfig>;
116
+
117
+ declare type DefineAppConfigOptions = Partial<AppConfig>;
106
118
 
107
119
  export { defineRequest }
108
120
 
@@ -113,7 +125,7 @@ export declare const defineService: DefineService;
113
125
  /**
114
126
  * 使用配置
115
127
  */
116
- export declare function getConfig(): {
128
+ export declare function getAppConfig(): {
117
129
  appTitle: string;
118
130
  appHeight: number;
119
131
  appWidth: number;
@@ -132,11 +144,14 @@ export declare function getConfig(): {
132
144
  errorAuthCode?: string | number | (string | number)[] | undefined;
133
145
  errorAuthHandle?: ((error: RequestError) => void) | undefined;
134
146
  errorMessageTranslation?: Record<string, string> | undefined;
135
- handleErrorMessage?: ((code: string | number, message: string) => void) | undefined;
147
+ errorHandle?: ((code: string | number | undefined, message: string, error: RequestError) => void) | undefined;
136
148
  handleToken?: ((config: AxiosRequestConfig<any>, storageToken: any) => void) | undefined;
149
+ showErrorMessage?: boolean | undefined;
137
150
  };
138
151
  };
139
152
 
153
+ export declare function getAppInfo(): AppInfo;
154
+
140
155
  declare class Polling<T = any> {
141
156
  private _value?;
142
157
  get value(): T | undefined;
@@ -188,7 +203,16 @@ declare type UnknownFunction = (...args: unknown[]) => unknown;
188
203
  /**
189
204
  * 使用配置
190
205
  */
191
- export declare function useConfig(): Ref_2<Config>;
206
+ export declare function useAppConfig(): Ref_2<AppConfig>;
207
+
208
+ /**
209
+ * 使用应用信息
210
+ */
211
+ export declare function useAppInfo(): ShallowRef< {
212
+ readonly appId: string;
213
+ readonly appElement: HTMLElement | null;
214
+ readonly appViewElement: HTMLElement | null;
215
+ }>;
192
216
 
193
217
  export declare function usePolling<T>(listener: () => Promise<T> | T): UnwrapNestedRefs<Polling<T>>;
194
218
 
@@ -210,7 +234,7 @@ width: number;
210
234
  /** 高度 */
211
235
  height: number;
212
236
  /** 裁剪、缩放的模式 */
213
- mode?: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center" | undefined;
237
+ mode?: "center" | "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | undefined;
214
238
  }>, {
215
239
  mode: string;
216
240
  }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
@@ -219,11 +243,11 @@ width: number;
219
243
  /** 高度 */
220
244
  height: number;
221
245
  /** 裁剪、缩放的模式 */
222
- mode?: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center" | undefined;
246
+ mode?: "center" | "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | undefined;
223
247
  }>, {
224
248
  mode: string;
225
249
  }>>>, {
226
- mode: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center";
250
+ mode: "center" | "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix";
227
251
  }, {}>, {
228
252
  default?(_: {}): any;
229
253
  }>;