zf-dbs 0.1.16 → 0.1.18

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
@@ -6,12 +6,16 @@ import { DefineComponent } from 'vue';
6
6
  import { defineRequest } from 'zf-utilz';
7
7
  import { DefineRequestOptions } from 'zf-utilz';
8
8
  import { EventListener as EventListener_2 } from 'zf-utilz';
9
+ import { NotificationHandle } from 'element-plus';
10
+ import { NotificationOptions as NotificationOptions_2 } from 'element-plus';
11
+ import { NotificationOptionsTyped } from 'element-plus';
9
12
  import { PropType as PropType_2 } from 'vue';
10
13
  import { PublicProps } from 'vue';
11
14
  import { Ref as Ref_2 } from 'vue';
12
15
  import { RequestError } from 'zf-utilz';
13
16
  import { RequestInstance } from 'zf-utilz';
14
17
  import { RequestResult } from 'zf-utilz';
18
+ import { ShallowRef } from 'vue';
15
19
  import { UnwrapNestedRefs } from 'vue';
16
20
 
17
21
  declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -74,7 +78,7 @@ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
74
78
  };
75
79
  };
76
80
 
77
- export declare interface Config {
81
+ export declare interface AppConfig {
78
82
  /** 项目名称 */
79
83
  appTitle: string;
80
84
  /** 项目高度,用于计算缩放比例(非必要不要修改,通过修改宽度来适配) */
@@ -94,7 +98,16 @@ export declare interface Config {
94
98
  /** 轮询间隔 */
95
99
  pollingInterval: number;
96
100
  /** 接口请求 */
97
- request: DefineRequestOptions;
101
+ request: DefineRequestOptions & {
102
+ /** API 请求错误显示消息 */
103
+ showErrorMessage?: boolean;
104
+ };
105
+ }
106
+
107
+ declare class AppInfo {
108
+ readonly appId: string;
109
+ get appElement(): HTMLElement | null;
110
+ get appViewElement(): HTMLElement | null;
98
111
  }
99
112
 
100
113
  declare const _default: {
@@ -102,7 +115,9 @@ declare const _default: {
102
115
  };
103
116
  export default _default;
104
117
 
105
- export declare function defineConfig(value: Partial<Config>): globalThis.Ref<Config>;
118
+ export declare function defineAppConfig(value: DefineAppConfigOptions): globalThis.Ref<AppConfig>;
119
+
120
+ declare type DefineAppConfigOptions = Partial<AppConfig>;
106
121
 
107
122
  export { defineRequest }
108
123
 
@@ -113,7 +128,7 @@ export declare const defineService: DefineService;
113
128
  /**
114
129
  * 使用配置
115
130
  */
116
- export declare function getConfig(): {
131
+ export declare function getAppConfig(): {
117
132
  appTitle: string;
118
133
  appHeight: number;
119
134
  appWidth: number;
@@ -132,11 +147,21 @@ export declare function getConfig(): {
132
147
  errorAuthCode?: string | number | (string | number)[] | undefined;
133
148
  errorAuthHandle?: ((error: RequestError) => void) | undefined;
134
149
  errorMessageTranslation?: Record<string, string> | undefined;
135
- handleErrorMessage?: ((code: string | number, message: string) => void) | undefined;
150
+ errorHandle?: ((code: string | number | undefined, message: string, error: RequestError) => void) | undefined;
136
151
  handleToken?: ((config: AxiosRequestConfig<any>, storageToken: any) => void) | undefined;
152
+ showErrorMessage?: boolean | undefined;
137
153
  };
138
154
  };
139
155
 
156
+ export declare function getAppInfo(): AppInfo;
157
+
158
+ export declare const notify: ((options: Partial<NotificationOptions_2>) => NotificationHandle) & {
159
+ success(options: Partial<NotificationOptionsTyped>): NotificationHandle;
160
+ info(options: Partial<NotificationOptionsTyped>): NotificationHandle;
161
+ warning(options: Partial<NotificationOptionsTyped>): NotificationHandle;
162
+ error(options: Partial<NotificationOptionsTyped>): NotificationHandle;
163
+ };
164
+
140
165
  declare class Polling<T = any> {
141
166
  private _value?;
142
167
  get value(): T | undefined;
@@ -188,7 +213,16 @@ declare type UnknownFunction = (...args: unknown[]) => unknown;
188
213
  /**
189
214
  * 使用配置
190
215
  */
191
- export declare function useConfig(): Ref_2<Config>;
216
+ export declare function useAppConfig(): Ref_2<AppConfig>;
217
+
218
+ /**
219
+ * 使用应用信息
220
+ */
221
+ export declare function useAppInfo(): ShallowRef< {
222
+ readonly appId: string;
223
+ readonly appElement: HTMLElement | null;
224
+ readonly appViewElement: HTMLElement | null;
225
+ }>;
192
226
 
193
227
  export declare function usePolling<T>(listener: () => Promise<T> | T): UnwrapNestedRefs<Polling<T>>;
194
228
 
@@ -210,7 +244,7 @@ width: number;
210
244
  /** 高度 */
211
245
  height: number;
212
246
  /** 裁剪、缩放的模式 */
213
- mode?: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center" | undefined;
247
+ mode?: "center" | "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | undefined;
214
248
  }>, {
215
249
  mode: string;
216
250
  }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
@@ -219,11 +253,11 @@ width: number;
219
253
  /** 高度 */
220
254
  height: number;
221
255
  /** 裁剪、缩放的模式 */
222
- mode?: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center" | undefined;
256
+ mode?: "center" | "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | undefined;
223
257
  }>, {
224
258
  mode: string;
225
259
  }>>>, {
226
- mode: "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix" | "center";
260
+ mode: "center" | "scaleToFill" | "aspectFit" | "aspectFill" | "widthFix" | "heightFix";
227
261
  }, {}>, {
228
262
  default?(_: {}): any;
229
263
  }>;