@kengic/vue 0.25.4-beta.0 → 0.25.4-beta.10

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -11,7 +11,7 @@ import windiCSS from 'vite-plugin-windicss';
11
11
  import { configCompressPlugin } from './compress';
12
12
  import { configHtmlPlugin } from './html';
13
13
  import { configImageminPlugin } from './imagemin';
14
- import { configMockPlugin } from './mock';
14
+ // import { configMockPlugin } from './mock';
15
15
  import { configPwaConfig } from './pwa';
16
16
  import { configStyleImportPlugin } from './styleImport';
17
17
  import { configSvgIconsPlugin } from './svgSprite';
@@ -47,7 +47,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
47
47
  vitePlugins.push(configSvgIconsPlugin(isBuild));
48
48
 
49
49
  // vite-plugin-mock
50
- VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild));
50
+ // VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild));
51
51
 
52
52
  // vite-plugin-purge-icons
53
53
  vitePlugins.push(purgeIcons());
@@ -1,3 +1,3 @@
1
+ export * from './setup/index';
1
2
  export * from './index.hooks';
2
3
  export * from './index.store';
3
- export * from './setup';
@@ -197,11 +197,16 @@ export interface PermissionState {
197
197
  allAuthList: AuthItem[];
198
198
  }
199
199
  export interface IUseKgStoreState {
200
+ /**
201
+ * 语言数据.
202
+ */
203
+ I18N: Record<string, any>;
200
204
  /**
201
205
  * <p>系统描述.</p>
202
206
  * <p>第一层 key 为 codeName, 第二层 key 为 codeValue.</p>
203
207
  */
204
208
  descriptionMap: Map<string, Map<string, Description>>;
209
+ i18n: any;
205
210
  /**
206
211
  * <p>某个系统描述是否正在查询.</p>
207
212
  * <p>其中的 key 表示 codeName.</p>
@@ -235,6 +240,8 @@ export interface IUseKgStoreGetters {
235
240
  getDescriptions(): (param: {
236
241
  codeName: string | null | undefined;
237
242
  }) => Array<Description>;
243
+ getI18N(): Record<string, any>;
244
+ getI18n(): any;
238
245
  /**
239
246
  * 配置参数.
240
247
  */
@@ -283,6 +290,8 @@ export interface IUseKgStoreActions {
283
290
  codeName: string | null | undefined;
284
291
  descriptions: Array<Description>;
285
292
  }): void;
293
+ setI18N(I18N: Record<string, any>): void;
294
+ setI18n(i18n: any): void;
286
295
  setOption(option: IKgOption): void;
287
296
  setP(fn: P): void;
288
297
  setRouter(router: Router): void;
@@ -0,0 +1,3 @@
1
+ export * from './setup';
2
+ export * from './setupKgLocale';
3
+ export * from './setupKgStore';
@@ -0,0 +1,27 @@
1
+ import { StoreDefinition } from 'pinia';
2
+ import { App } from 'vue';
3
+ import { Router } from 'vue-router';
4
+ import { IKgOption, P } from '../index.store';
5
+ export declare type IKgOptions = {
6
+ /**
7
+ * 语言数据.
8
+ */
9
+ I18N: Record<string, any>;
10
+ app: App;
11
+ i18n: any;
12
+ /** 配置参数. */
13
+ option?: IKgOption;
14
+ /** 权限方法, 用来判断是否具有某个(某些)权限. */
15
+ pFunction: P;
16
+ router: Router;
17
+ /** 状态数据: 权限. */
18
+ usePermissionStore: StoreDefinition<any, any, any, any>;
19
+ /** 状态数据: 用户. */
20
+ useUserStore: StoreDefinition<any, any, any, any>;
21
+ };
22
+ /**
23
+ * 初始化组件库.
24
+ *
25
+ * @param options 参数.
26
+ */
27
+ export declare function setup(options: IKgOptions): Promise<void>;
@@ -0,0 +1,29 @@
1
+ import { DropMenu } from '../../project/src/components/Dropdown/src/typing';
2
+ import { LocaleSetting, LocaleType } from '../../project/types/config';
3
+ export declare const LOCALE: {
4
+ KO_KR: LocaleType;
5
+ EN: LocaleType;
6
+ VI_VN: LocaleType;
7
+ ZH_CN: LocaleType;
8
+ ES_ES: LocaleType;
9
+ FR_FR: LocaleType;
10
+ KM_KH: LocaleType;
11
+ };
12
+ export declare let localeList: DropMenu[];
13
+ export declare const localeSetting: LocaleSetting;
14
+ export declare type IKgLocaleOptions = {
15
+ /**
16
+ * <p>可选语言. 如果为空则为所有语言.</p>
17
+ */
18
+ availableLocales?: Array<LocaleType>;
19
+ /**
20
+ * 默认语言.
21
+ *
22
+ * @default 'zh_CN'.
23
+ */
24
+ defaultLocale?: LocaleType;
25
+ };
26
+ /**
27
+ * 配置语言.
28
+ */
29
+ export declare function setupKgLocale(options?: IKgLocaleOptions): void;
@@ -0,0 +1,18 @@
1
+ import { Pinia } from 'pinia';
2
+ /**
3
+ * 配置 pinia 实例.
4
+ * @param pinia pinia 实例.
5
+ */
6
+ export declare function setPinia(pinia: Pinia): void;
7
+ /**
8
+ * 获取 pinia 实例.
9
+ * @return {} pinia 实例.
10
+ * @throws Error 如果 pinia 实例为空, 抛错.
11
+ */
12
+ export declare function getPinia(): Pinia | null;
13
+ /**
14
+ * 设置 pinia.
15
+ *
16
+ * @param pinia pinia.
17
+ */
18
+ export declare function setupKgStore(pinia: Pinia): void;
@@ -2,7 +2,7 @@ export interface DropMenu {
2
2
  onClick?: Fn;
3
3
  to?: string;
4
4
  icon?: string;
5
- event: string | number;
5
+ event: any;
6
6
  text: string;
7
7
  disabled?: boolean;
8
8
  divider?: boolean;
@@ -1,5 +1,4 @@
1
1
  export declare const TOKEN_KEY = "TOKEN__";
2
- export declare const LOCALE_KEY = "LOCALE__";
3
2
  export declare const USER_INFO_KEY = "USER__INFO__";
4
3
  export declare const ROLES_KEY = "ROLES__KEY__";
5
4
  export declare const USER_WAREHOUSE_KEY = "USER_WAREHOUSE__KEY__";
@@ -0,0 +1 @@
1
+ export * from './web/useI18n';
@@ -0,0 +1,13 @@
1
+ declare type I18nGlobalTranslation = {
2
+ (key: string): string;
3
+ (key: string, locale: string): string;
4
+ (key: string, locale: string, list: unknown[]): string;
5
+ (key: string, locale: string, named: Record<string, unknown>): string;
6
+ (key: string, list: unknown[]): string;
7
+ (key: string, named: Record<string, unknown>): string;
8
+ };
9
+ export declare function useI18n(namespace?: string): {
10
+ t: I18nGlobalTranslation;
11
+ };
12
+ export declare const t: (key: string) => string;
13
+ export {};
@@ -1,6 +1,7 @@
1
1
  export * from './api';
2
2
  export * from './components';
3
3
  export * from './enums';
4
+ export * from './hooks';
4
5
  export * from './locales';
5
6
  export * from './settings';
6
7
  export * from './store';
@@ -1,3 +1,4 @@
1
1
  import type { App } from 'vue';
2
- export declare let i18n: any;
2
+ import { createI18n } from 'vue-i18n';
3
+ export declare let i18n: ReturnType<typeof createI18n>;
3
4
  export declare function setupI18n(app: App): Promise<void>;
@@ -1,4 +1,3 @@
1
1
  export * from './encryptionSetting';
2
2
  export * from './componentSetting';
3
- export * from './localeSetting';
4
3
  export * from './designSetting';
@@ -16,15 +16,7 @@ export declare const _useLocaleStore: import("pinia").StoreDefinition<"app-local
16
16
  pathTitleMap: object;
17
17
  } & import("pinia").PiniaCustomStateProperties<LocaleState>) => (path: any) => any;
18
18
  }, {
19
- /**
20
- * Set up multilingual information and cache
21
- * @param info multilingual info
22
- */
23
19
  setLocaleInfo(info: Partial<LocaleSetting>): void;
24
- /**
25
- * Initialize multilingual information and load the existing configuration from the local cache
26
- */
27
- initLocale(): void;
28
20
  setPathTitle(path: any, title: any): void;
29
21
  }>;
30
22
  export declare function useLocaleStore(): import("pinia").Store<"app-locale", LocaleState, {
@@ -40,15 +32,7 @@ export declare function useLocaleStore(): import("pinia").Store<"app-locale", Lo
40
32
  pathTitleMap: object;
41
33
  } & import("pinia").PiniaCustomStateProperties<LocaleState>) => (path: any) => any;
42
34
  }, {
43
- /**
44
- * Set up multilingual information and cache
45
- * @param info multilingual info
46
- */
47
35
  setLocaleInfo(info: Partial<LocaleSetting>): void;
48
- /**
49
- * Initialize multilingual information and load the existing configuration from the local cache
50
- */
51
- initLocale(): void;
52
36
  setPathTitle(path: any, title: any): void;
53
37
  }>;
54
38
  export {};
@@ -35,7 +35,7 @@ declare class KgLogger {
35
35
  * @param collapsed 是否折叠.
36
36
  * @param style 样式.
37
37
  */
38
- static log(level: "error" | "warn" | "debug" | "info" | "deprecated" | undefined, message: string, args?: Record<string, any>, collapsed?: boolean, style?: string | null): void;
38
+ static log(level: "debug" | "info" | "warn" | "error" | "deprecated" | undefined, message: string, args?: Record<string, any>, collapsed?: boolean, style?: string | null): void;
39
39
  /**
40
40
  * 打印警告日志.
41
41
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/vue",
3
- "version": "0.25.4-beta.0",
3
+ "version": "0.25.4-beta.10",
4
4
  "scripts": {
5
5
  "build": "npm run switch-node-version && rimraf dist && vue-tsc && vite build",
6
6
  "build:dev": "npm run switch-node-version && rimraf dist && vue-tsc && vite build --mode development",
@@ -81,12 +81,11 @@
81
81
  "store": "2.0.12",
82
82
  "tsx": "3.12.3",
83
83
  "typescript": "~4.8.4",
84
- "vite": "3.2.5",
84
+ "vite": "3.2.3",
85
85
  "vite-plugin-compression": "0.5.1",
86
86
  "vite-plugin-html": "3.2.0",
87
87
  "vite-plugin-imagemin": "0.6.1",
88
88
  "vite-plugin-mkcert": "1.10.1",
89
- "vite-plugin-mock": "2.9.6",
90
89
  "vite-plugin-optimize-persist": "0.1.2",
91
90
  "vite-plugin-package-config": "0.1.1",
92
91
  "vite-plugin-purge-icons": "0.8.2",
@@ -1,19 +0,0 @@
1
- /**
2
- * Mock plugin for development and production.
3
- * https://github.com/anncwb/vite-plugin-mock
4
- */
5
- import { viteMockServe } from 'vite-plugin-mock';
6
-
7
- export function configMockPlugin(isBuild: boolean) {
8
- return viteMockServe({
9
- ignore: /^\_/,
10
- mockPath: 'mock',
11
- localEnabled: !isBuild,
12
- prodEnabled: isBuild,
13
- injectCode: `
14
- import { setupProdMockServer } from '../mock/_createProductionServer';
15
-
16
- setupProdMockServer();
17
- `,
18
- });
19
- }
@@ -1,38 +0,0 @@
1
- import { Pinia, StoreDefinition } from 'pinia';
2
- import { App } from 'vue';
3
- import { Router } from 'vue-router';
4
- import { IKgOption, P } from './index.store';
5
- /**
6
- * 配置 pinia 实例.
7
- * @param pinia pinia 实例.
8
- */
9
- export declare function setPinia(pinia: Pinia): void;
10
- /**
11
- * 获取 pinia 实例.
12
- * @return {} pinia 实例.
13
- * @throws Error 如果 pinia 实例为空, 抛错.
14
- */
15
- export declare function getPinia(): Pinia | null;
16
- /**
17
- * 设置 pinia.
18
- *
19
- * @param pinia pinia.
20
- */
21
- export declare function setupKgStore(pinia: Pinia): void;
22
- export declare type IKgOptions = {
23
- app: App;
24
- /** 配置参数. */
25
- option?: IKgOption;
26
- /** 权限方法, 用来判断是否具有某个(某些)权限. */
27
- pFunction: P;
28
- router: Router;
29
- /** 状态数据: 权限. */
30
- usePermissionStore: StoreDefinition<any, any, any, any>;
31
- /** 状态数据: 用户. */
32
- useUserStore: StoreDefinition<any, any, any, any>;
33
- };
34
- /**
35
- * 初始化组件库.
36
- * @param options 参数.
37
- */
38
- export declare function setup(options: IKgOptions): void;
@@ -1,7 +0,0 @@
1
- import { LocaleSetting, LocaleType } from '../../types/config';
2
- import { DropMenu } from '../components/Dropdown/src/typing';
3
- export declare const LOCALE: {
4
- [key: string]: LocaleType;
5
- };
6
- export declare const localeList: DropMenu[];
7
- export declare const localeSetting: LocaleSetting;