@kengic/vue 0.25.3 → 0.25.4-beta.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
- export * from './setup';
2
1
  export * from './index.hooks';
3
2
  export * from './index.store';
3
+ export * from './setup';
@@ -1,6 +1,7 @@
1
1
  import { Pinia } from 'pinia';
2
2
  import { ComputedRef } from 'vue';
3
3
  import { Description } from '../apis/WMS/models';
4
+ import { LocaleType } from '../project/types/config';
4
5
  import { IKgStore, P, T } from './index.store';
5
6
  export interface IUseKg {
6
7
  /**
@@ -14,7 +15,7 @@ export interface IUseKg {
14
15
  codeValue: string | null | undefined;
15
16
  }): Description | null;
16
17
  /** 当前语言. */
17
- locale: IKgStore['getLocale'];
18
+ locale: ComputedRef<LocaleType>;
18
19
  /**
19
20
  * 组件库的配置参数.
20
21
  */
@@ -3,37 +3,19 @@ import { ComputedRef } from 'vue';
3
3
  import { Router } from 'vue-router';
4
4
  import { Description, SysUserWarehouseDTO } from '../apis/WMS/models';
5
5
  import { KG_APP, Menu } from '../consts';
6
- import { LocaleType } from '../project';
6
+ import { LocaleType } from '../project/types/config';
7
7
  import { UserInfo } from '../project/types/store';
8
8
  export declare type IKgOption = {
9
- /** 模块首页地址. */
10
- appIndex?: {
11
- /** 默认为 '/wms/data-manager/index'. */
12
- [KG_APP.WMS_DATA_MANAGER]?: string;
13
- /** 默认为 '/wms/business-manager/index'. */
14
- [KG_APP.WMS_BUSINESS_MANAGER]?: string;
15
- /** 默认为 '/wcs/index'. */
16
- [KG_APP.WCS]?: string;
17
- /** 默认为 '/sys/index'. */
18
- [KG_APP.SYS]?: string;
19
- };
20
- /** 模块标题. */
21
- appTitle?: {
22
- /** 默认为 '数据管理'. */
23
- [KG_APP.WMS_DATA_MANAGER]?: string;
24
- /** 默认为 '仓库管理'. */
25
- [KG_APP.WMS_BUSINESS_MANAGER]?: string;
26
- /** 默认为 'WCS'. */
27
- [KG_APP.WCS]?: string;
28
- /** 默认为 '系统配置'. */
29
- [KG_APP.SYS]?: string;
30
- };
31
9
  /**
32
- * <p>后端接口地址前缀.</p>
33
- *
34
- * @default '/kengic-boot'
10
+ * 多标签页.
35
11
  */
36
- publicPath?: string;
12
+ KgLayoutTab?: {
13
+ /**
14
+ * <p>是否放到页面头部区域.</p>
15
+ * @default true
16
+ */
17
+ isTeleportToHeader?: boolean;
18
+ };
37
19
  KgModal?: {
38
20
  /** 拖拽改变位置. */
39
21
  drag?: {
@@ -139,16 +121,40 @@ export declare type IKgOption = {
139
121
  /** 默认的仓库编码, 只有在 {@link IKgOption.KgWarehouse.on} 为 false 时才生效. */
140
122
  defaultWarehouseID?: string;
141
123
  };
124
+ /** 模块首页地址. */
125
+ appIndex?: {
126
+ /** 默认为 '/wms/data-manager/index'. */
127
+ [KG_APP.WMS_DATA_MANAGER]?: string;
128
+ /** 默认为 '/wms/business-manager/index'. */
129
+ [KG_APP.WMS_BUSINESS_MANAGER]?: string;
130
+ /** 默认为 '/wcs/index'. */
131
+ [KG_APP.WCS]?: string;
132
+ /** 默认为 '/sys/index'. */
133
+ [KG_APP.SYS]?: string;
134
+ };
135
+ /** 模块标题. */
136
+ appTitle?: {
137
+ /** 默认为 '数据管理'. */
138
+ [KG_APP.WMS_DATA_MANAGER]?: string;
139
+ /** 默认为 '仓库管理'. */
140
+ [KG_APP.WMS_BUSINESS_MANAGER]?: string;
141
+ /** 默认为 'WCS'. */
142
+ [KG_APP.WCS]?: string;
143
+ /** 默认为 '系统配置'. */
144
+ [KG_APP.SYS]?: string;
145
+ };
142
146
  /**
143
- * 多标签页.
147
+ * <p>项目的版本号. 即 package.json 中的 version 值.</p>
148
+ *
149
+ * @default 0.0.0
144
150
  */
145
- KgLayoutTab?: {
146
- /**
147
- * <p>是否放到页面头部区域.</p>
148
- * @default true
149
- */
150
- isTeleportToHeader?: boolean;
151
- };
151
+ projectVersion?: string;
152
+ /**
153
+ * <p>后端接口地址前缀.</p>
154
+ *
155
+ * @default '/kengic-boot'
156
+ */
157
+ publicPath?: string;
152
158
  };
153
159
  /** 翻译的方法. */
154
160
  export declare type T = {
@@ -229,8 +235,6 @@ export interface IUseKgStoreGetters {
229
235
  getDescriptions(): (param: {
230
236
  codeName: string | null | undefined;
231
237
  }) => Array<Description>;
232
- /** 组件库的配置参数. */
233
- getLocale(): ComputedRef<LocaleType> | null;
234
238
  /**
235
239
  * 配置参数.
236
240
  */
@@ -279,7 +283,6 @@ export interface IUseKgStoreActions {
279
283
  codeName: string | null | undefined;
280
284
  descriptions: Array<Description>;
281
285
  }): void;
282
- setLocale(locale: ComputedRef<LocaleType> | null): void;
283
286
  setOption(option: IKgOption): void;
284
287
  setP(fn: P): void;
285
288
  setRouter(router: Router): void;
@@ -1,7 +1,6 @@
1
1
  import { Pinia, StoreDefinition } from 'pinia';
2
- import { App, ComputedRef } from 'vue';
2
+ import { App } from 'vue';
3
3
  import { Router } from 'vue-router';
4
- import { LocaleType } from '../project';
5
4
  import { IKgOption, P } from './index.store';
6
5
  /**
7
6
  * 配置 pinia 实例.
@@ -14,30 +13,24 @@ export declare function setPinia(pinia: Pinia): void;
14
13
  * @throws Error 如果 pinia 实例为空, 抛错.
15
14
  */
16
15
  export declare function getPinia(): Pinia | null;
16
+ /**
17
+ * 设置 pinia.
18
+ *
19
+ * @param pinia pinia.
20
+ */
21
+ export declare function setupKgStore(pinia: Pinia): void;
17
22
  export declare type IKgOptions = {
18
23
  app: App;
19
- /** 当前语言. */
20
- locale: ComputedRef<LocaleType>;
21
- /**
22
- * import { createI18n } from 'vue-i18n';
23
- * ReturnType<typeof createI18n>
24
- */
25
- i18n: any;
24
+ /** 配置参数. */
25
+ option?: IKgOption;
26
+ /** 权限方法, 用来判断是否具有某个(某些)权限. */
27
+ pFunction: P;
26
28
  router: Router;
27
- /** 状态数据: 用户. */
28
- useUserStore: StoreDefinition<any, any, any, any>;
29
29
  /** 状态数据: 权限. */
30
30
  usePermissionStore: StoreDefinition<any, any, any, any>;
31
- /** 权限方法, 用来判断是否具有某个(某些)权限. */
32
- pFunction: P;
33
- /** 配置参数. */
34
- option?: IKgOption;
31
+ /** 状态数据: 用户. */
32
+ useUserStore: StoreDefinition<any, any, any, any>;
35
33
  };
36
- /**
37
- * 初始化 pinia.
38
- * @param pinia pinia.
39
- */
40
- export declare function setupKgStore(pinia: Pinia): void;
41
34
  /**
42
35
  * 初始化组件库.
43
36
  * @param options 参数.
@@ -1,2 +1,2 @@
1
- import { LocaleType } from '../../project';
1
+ import { LocaleType } from '../../project/types/config';
2
2
  export declare const I18N: Partial<Record<LocaleType, any>>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Get the configuration file variable name
3
+ * @param env
4
+ */
5
+ export declare const getConfigFileName: (env: Record<string, any>) => string;
@@ -0,0 +1 @@
1
+ export * from './getConfigFileName';
@@ -1,2 +1,3 @@
1
+ export * from './build';
1
2
  export * from './src';
2
3
  export * from './types';
@@ -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,4 +1,13 @@
1
1
  export * from './api';
2
2
  export * from './components';
3
3
  export * from './enums';
4
+ export * from './hooks';
5
+ export * from './locales';
4
6
  export * from './settings';
7
+ export * from './store';
8
+ export * from './utils/cache/index';
9
+ export * from './utils/cache/memory';
10
+ export * from './utils/cache/persistent';
11
+ export * from './utils/cache/storageCache';
12
+ export * from './utils/cipher';
13
+ export * from './utils/env';
@@ -0,0 +1,5 @@
1
+ import { LocaleType } from '../../types';
2
+ export declare const loadLocalePool: LocaleType[];
3
+ export declare function setHtmlPageLang(locale: LocaleType): void;
4
+ export declare function setLoadLocalePool(cb: (loadLocalePool: LocaleType[]) => void): void;
5
+ export declare function genMessage(langs: Record<string, Record<string, any>>, prefix?: string): Recordable<any>;
@@ -0,0 +1,3 @@
1
+ export * from './helper';
2
+ export * from './setupI18n';
3
+ export * from './useLocale';
@@ -0,0 +1,3 @@
1
+ import type { App } from 'vue';
2
+ export declare let i18n: any;
3
+ export declare function setupI18n(app: App): Promise<void>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Multi-language related operations
3
+ */
4
+ import { LocaleType } from '../../types';
5
+ export declare function useLocale(): {
6
+ getLocale: import("vue").ComputedRef<LocaleType>;
7
+ getShowLocalePicker: import("vue").ComputedRef<boolean>;
8
+ changeLocale: (locale: LocaleType) => Promise<LocaleType | undefined>;
9
+ getAntdLocale: import("vue").ComputedRef<any>;
10
+ };
@@ -0,0 +1 @@
1
+ export * from './modules';
@@ -0,0 +1 @@
1
+ export * from './locale';
@@ -0,0 +1,54 @@
1
+ import { LocaleSetting, LocaleType } from '../../../types';
2
+ interface LocaleState {
3
+ localInfo: LocaleSetting;
4
+ pathTitleMap: object;
5
+ }
6
+ export declare const _useLocaleStore: import("pinia").StoreDefinition<"app-locale", LocaleState, {
7
+ getShowPicker(): boolean;
8
+ getLocale(): LocaleType;
9
+ getPathTitle: (state: {
10
+ localInfo: {
11
+ showPicker: boolean;
12
+ locale: LocaleType;
13
+ fallback: LocaleType;
14
+ availableLocales: LocaleType[];
15
+ };
16
+ pathTitleMap: object;
17
+ } & import("pinia").PiniaCustomStateProperties<LocaleState>) => (path: any) => any;
18
+ }, {
19
+ /**
20
+ * Set up multilingual information and cache
21
+ * @param info multilingual info
22
+ */
23
+ setLocaleInfo(info: Partial<LocaleSetting>): void;
24
+ /**
25
+ * Initialize multilingual information and load the existing configuration from the local cache
26
+ */
27
+ initLocale(): void;
28
+ setPathTitle(path: any, title: any): void;
29
+ }>;
30
+ export declare function useLocaleStore(): import("pinia").Store<"app-locale", LocaleState, {
31
+ getShowPicker(): boolean;
32
+ getLocale(): LocaleType;
33
+ getPathTitle: (state: {
34
+ localInfo: {
35
+ showPicker: boolean;
36
+ locale: LocaleType;
37
+ fallback: LocaleType;
38
+ availableLocales: LocaleType[];
39
+ };
40
+ pathTitleMap: object;
41
+ } & import("pinia").PiniaCustomStateProperties<LocaleState>) => (path: any) => any;
42
+ }, {
43
+ /**
44
+ * Set up multilingual information and cache
45
+ * @param info multilingual info
46
+ */
47
+ setLocaleInfo(info: Partial<LocaleSetting>): void;
48
+ /**
49
+ * Initialize multilingual information and load the existing configuration from the local cache
50
+ */
51
+ initLocale(): void;
52
+ setPathTitle(path: any, title: any): void;
53
+ }>;
54
+ export {};
@@ -0,0 +1,7 @@
1
+ import { CreateStorageParams } from './storageCache';
2
+ export declare type Options = Partial<CreateStorageParams>;
3
+ export declare const WebStorage: any;
4
+ export declare const createStorage: (storage?: Storage, options?: Options) => any;
5
+ export declare const createSessionStorage: (options?: Options) => any;
6
+ export declare const createLocalStorage: (options?: Options) => any;
7
+ export default WebStorage;
@@ -0,0 +1,20 @@
1
+ export interface Cache<V = any> {
2
+ value?: V;
3
+ timeoutId?: ReturnType<typeof setTimeout>;
4
+ time?: number;
5
+ alive?: number;
6
+ }
7
+ export declare class Memory<T = any, V = any> {
8
+ private cache;
9
+ private alive;
10
+ constructor(alive?: number);
11
+ get getCache(): { [key in keyof T]?: Cache<V> | undefined; };
12
+ setCache(cache: any): void;
13
+ get<K extends keyof T>(key: K): { [key in keyof T]?: Cache<V> | undefined; }[K];
14
+ set<K extends keyof T>(key: K, value: V, expires?: number): V;
15
+ remove<K extends keyof T>(key: K): V | undefined;
16
+ resetCache(cache: {
17
+ [K in keyof T]: Cache;
18
+ }): void;
19
+ clear(): void;
20
+ }
@@ -0,0 +1,33 @@
1
+ import type { RouteLocationNormalized } from 'vue-router';
2
+ import { SysUserWarehouseDTO } from '../../../../apis/WMS/models';
3
+ import { LoginInfo, ProjectConfig, UserInfo } from '../../../types';
4
+ import { DB_DICT_DATA_KEY, LOCK_INFO_KEY, LOGIN_INFO_KEY, MULTIPLE_TABS_KEY, PROJ_CFG_KEY, ROLES_KEY, TENANT_ID, TOKEN_KEY, USER_INFO_KEY, USER_WAREHOUSE_KEY } from '../../enums';
5
+ interface BasicStore {
6
+ [TOKEN_KEY]: string | number | null | undefined;
7
+ [USER_INFO_KEY]: UserInfo;
8
+ [ROLES_KEY]: string[];
9
+ [USER_WAREHOUSE_KEY]: SysUserWarehouseDTO[];
10
+ [LOCK_INFO_KEY]: LockInfo;
11
+ [PROJ_CFG_KEY]: ProjectConfig;
12
+ [MULTIPLE_TABS_KEY]: RouteLocationNormalized[];
13
+ [DB_DICT_DATA_KEY]: string;
14
+ [TENANT_ID]: string;
15
+ [LOGIN_INFO_KEY]: LoginInfo;
16
+ }
17
+ declare type LocalStore = BasicStore;
18
+ declare type SessionStore = BasicStore;
19
+ export declare type BasicKeys = keyof BasicStore;
20
+ declare type LocalKeys = keyof LocalStore;
21
+ declare type SessionKeys = keyof SessionStore;
22
+ export declare class Persistent {
23
+ static getLocal<T>(key: LocalKeys): Nullable<T>;
24
+ static setLocal(key: LocalKeys, value: LocalStore[LocalKeys], immediate?: boolean): void;
25
+ static removeLocal(key: LocalKeys, immediate?: boolean): void;
26
+ static clearLocal(immediate?: boolean): void;
27
+ static getSession<T>(key: SessionKeys): Nullable<T>;
28
+ static setSession(key: SessionKeys, value: SessionStore[SessionKeys], immediate?: boolean): void;
29
+ static removeSession(key: SessionKeys, immediate?: boolean): void;
30
+ static clearSession(immediate?: boolean): void;
31
+ static clearAll(immediate?: boolean): void;
32
+ }
33
+ export {};
@@ -0,0 +1,8 @@
1
+ import { EncryptionParams } from '../cipher';
2
+ export interface CreateStorageParams extends EncryptionParams {
3
+ prefixKey: string;
4
+ storage: Storage;
5
+ hasEncrypt: boolean;
6
+ timeout?: Nullable<number>;
7
+ }
8
+ export declare const create: any;
@@ -0,0 +1,19 @@
1
+ export interface EncryptionParams {
2
+ key: string;
3
+ iv: string;
4
+ }
5
+ export declare class AesEncryption {
6
+ private key;
7
+ private iv;
8
+ constructor(opt?: Partial<EncryptionParams>);
9
+ get getOptions(): {
10
+ mode: any;
11
+ padding: any;
12
+ iv: any;
13
+ };
14
+ encryptByAES(cipherText: string): string;
15
+ decryptByAES(cipherText: string): string;
16
+ }
17
+ export declare function encryptByBase64(cipherText: string): string;
18
+ export declare function decodeByBase64(cipherText: string): string;
19
+ export declare function encryptByMd5(password: string): string;
@@ -0,0 +1,34 @@
1
+ export declare function getCommonStoragePrefix(): string;
2
+ export declare function getStorageShortName(): string;
3
+ export declare function getAppEnvConfig(): {
4
+ VITE_GLOB_APP_TITLE: string;
5
+ VITE_GLOB_API_URL: string;
6
+ VITE_USE_MOCK: string;
7
+ VITE_GLOB_APP_SHORT_NAME: string;
8
+ VITE_GLOB_API_URL_PREFIX: string | undefined;
9
+ VITE_GLOB_APP_OPEN_SSO: string;
10
+ VITE_GLOB_APP_OPEN_QIANKUN: string;
11
+ VITE_GLOB_APP_CAS_BASE_URL: string;
12
+ VITE_GLOB_DOMAIN_URL: string;
13
+ VITE_GLOB_ONLINE_VIEW_URL: string | undefined;
14
+ };
15
+ /**
16
+ * @description: Development mode
17
+ */
18
+ export declare const devMode = "development";
19
+ /**
20
+ * @description: Production mode
21
+ */
22
+ export declare const prodMode = "production";
23
+ /**
24
+ * @description: Is it a development mode
25
+ * @returns:
26
+ * @example:
27
+ */
28
+ export declare function isDevMode(): boolean;
29
+ /**
30
+ * @description: Is it a production mode
31
+ * @returns:
32
+ * @example:
33
+ */
34
+ export declare function isProdMode(): boolean;
@@ -35,7 +35,7 @@ declare class KgLogger {
35
35
  * @param collapsed 是否折叠.
36
36
  * @param style 样式.
37
37
  */
38
- static log(level: "error" | "debug" | "info" | "warn" | "deprecated" | undefined, message: string, args?: Record<string, any>, collapsed?: boolean, style?: string | null): void;
38
+ static log(level: "error" | "warn" | "debug" | "info" | "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.3",
3
+ "version": "0.25.4-beta.1",
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",
@@ -47,6 +47,7 @@
47
47
  "@iconify/vue": "4.1.1",
48
48
  "@kengic/pont": "1.2.13",
49
49
  "@rys-fe/vite-plugin-theme": "0.8.6",
50
+ "@types/crypto-js": "4.1.1",
50
51
  "@types/fs-extra": "9.0.13",
51
52
  "@types/inquirer": "8.2.5",
52
53
  "@types/lodash-es": "4.17.9",
@@ -61,6 +62,7 @@
61
62
  "ant-design-vue": "3.2.14",
62
63
  "axios": "0.26.1",
63
64
  "chalk": "4.1.2",
65
+ "crypto-js": "4.1.1",
64
66
  "dayjs": "1.11.10",
65
67
  "dotenv": "16.0.3",
66
68
  "filesize": "10.1.0",
@@ -94,6 +96,7 @@
94
96
  "vite-plugin-vue-setup-extend": "0.4.0",
95
97
  "vite-plugin-windicss": "1.8.8",
96
98
  "vue": "3.2.43",
99
+ "vue-i18n": "9.2.2",
97
100
  "vue-router": "4.1.6",
98
101
  "vue-tsc": "1.8.27"
99
102
  },