@kengic/core.react 0.0.2-beta.21 → 0.0.2-beta.22
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.
- package/index.css +1 -1
- package/kengic-core.react.js +9452 -9335
- package/package.json +1 -1
- package/src/component/Kg/index.store.d.ts +11 -1
- package/src/component/KgSqlClient/KgSqlClient.d.ts +6 -0
- package/src/component/KgSqlClient/index.d.ts +3 -0
- package/src/component/KgSqlClient/index.event.d.ts +24 -0
- package/src/component/KgSqlClient/index.hooks.d.ts +42 -0
- package/src/component/KgSqlClient/index.store.d.ts +50 -0
- package/src/component/KgSqlClient/index.vm.d.ts +2 -0
- package/src/component/KgSqlClient/index.wc.d.ts +4 -0
- package/src/component/KgWorkStation/index.event.d.ts +0 -2
- package/src/component/KgWorkStation/index.store.d.ts +7 -4
- package/src/index.d.ts +2 -1
- package/src/index.store.d.ts +4 -0
package/package.json
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { PayloadAction, Slice, SliceSelectors } from '@reduxjs/toolkit';
|
|
2
2
|
import { type IState } from '../../index.store.ts';
|
|
3
3
|
export interface IKgOption {
|
|
4
|
+
/** SQL 客户端. */
|
|
5
|
+
KgSqlClient?: {
|
|
6
|
+
/**
|
|
7
|
+
* 是否启用功能.
|
|
8
|
+
*
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
isOn?: boolean;
|
|
12
|
+
};
|
|
4
13
|
/** 选择工作站. */
|
|
5
14
|
KgWorkStation?: {
|
|
6
15
|
/**
|
|
7
16
|
* 是否启用功能.
|
|
17
|
+
*
|
|
8
18
|
* @default true
|
|
9
19
|
*/
|
|
10
20
|
isOn?: boolean;
|
|
@@ -20,4 +30,4 @@ export declare const KgSlice: Slice<IKgState, {
|
|
|
20
30
|
optionReducer(state: IKgState, action: PayloadAction<IKgOption | null | undefined>): void;
|
|
21
31
|
}, string, string, SliceSelectors<IKgState>>;
|
|
22
32
|
export declare const optionReducer: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<IKgOption | null | undefined, `${string}/optionReducer`>;
|
|
23
|
-
export declare function
|
|
33
|
+
export declare function kgOptionSelector(state: IState): IKgOption;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IKgEventListener } from '@kengic/core.core';
|
|
2
|
+
/**
|
|
3
|
+
* 事件类型.
|
|
4
|
+
*/
|
|
5
|
+
export type IKgSqlClientEvent = 'onMount';
|
|
6
|
+
export type IKgSqlClientOnMountEventListenerParameter = {};
|
|
7
|
+
export type IKgSqlClientOnMountEventListener = ((param: IKgSqlClientOnMountEventListenerParameter) => Promise<boolean>) & IKgEventListener;
|
|
8
|
+
export type IKgSqlClientEventListenerParameter = IKgSqlClientOnMountEventListenerParameter;
|
|
9
|
+
export type IKgSqlClientEventListener = IKgSqlClientOnMountEventListener;
|
|
10
|
+
export declare const eventListeners: Record<string, {
|
|
11
|
+
onMount: Array<IKgSqlClientOnMountEventListener>;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* 触发事件.
|
|
15
|
+
*
|
|
16
|
+
* @param param.event 事件名称.
|
|
17
|
+
* @param param.id 唯一标识.
|
|
18
|
+
* @param param.parameter 事件参数.
|
|
19
|
+
*/
|
|
20
|
+
export declare function emit<P = IKgSqlClientEventListenerParameter>(param: {
|
|
21
|
+
event: IKgSqlClientEvent;
|
|
22
|
+
id?: string | undefined;
|
|
23
|
+
parameter?: P;
|
|
24
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IRemoveEventListener } from '@kengic/core.core';
|
|
2
|
+
import { store } from '../../index.store.ts';
|
|
3
|
+
import { IKgSqlClientOnMountEventListener } from './index.event';
|
|
4
|
+
import { IKgSqlClientState } from './index.store';
|
|
5
|
+
export interface IDoKgSqlClient {
|
|
6
|
+
/**
|
|
7
|
+
* <p>获取某个状态数据. 在 vue 项目中使用.</p>
|
|
8
|
+
*
|
|
9
|
+
* @param fn 获取函数, 该函数由框架调用并传入状态数据作为参数, 调用者从参数中获取想要的数据.
|
|
10
|
+
* @return 返回一个数组, 包含两个元素, 第一个元素是要获取的数据, 是一个 ref 数据, 第二个元素是一个退订函数, 由调用者负责在合适的时候调用, 用于移除对该数据的变更监听.
|
|
11
|
+
*/
|
|
12
|
+
get<T extends {
|
|
13
|
+
value: any;
|
|
14
|
+
}>(fn: (state: IKgSqlClientState[string]) => any): [T, () => void];
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* 监听事件: 挂载.
|
|
18
|
+
*
|
|
19
|
+
* @param listener 事件监听函数.
|
|
20
|
+
* @param isOnce 是否只会触发一次. 默认为 undefined.
|
|
21
|
+
*/
|
|
22
|
+
onMount(listener: IKgSqlClientOnMountEventListener, isOnce?: boolean): IRemoveEventListener;
|
|
23
|
+
/**
|
|
24
|
+
* 设置数据.
|
|
25
|
+
*
|
|
26
|
+
* @param fn 设置函数.
|
|
27
|
+
*/
|
|
28
|
+
set(fn: (state: IKgSqlClientState[string]) => void): void;
|
|
29
|
+
store: typeof store;
|
|
30
|
+
/**
|
|
31
|
+
* 订阅数据变更.
|
|
32
|
+
*
|
|
33
|
+
* @param fn 回调函数, 可以通过参数 state 获取到最新的数据.
|
|
34
|
+
*/
|
|
35
|
+
subscribe(fn: (state: IKgSqlClientState[string]) => void): () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 在 react 中如果函数以 use 为前缀, 会被当成 hook 函数, 因此这个函数使用了 do 作为前缀.
|
|
39
|
+
*
|
|
40
|
+
* @param id 唯一标识.
|
|
41
|
+
*/
|
|
42
|
+
export declare function doKgSqlClient(id?: string): IDoKgSqlClient;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { KgSqlClientProps } from './index.vm';
|
|
3
|
+
export type IKgSqlClientState = Record<string, {
|
|
4
|
+
/**
|
|
5
|
+
* 是否已经完成挂载.
|
|
6
|
+
*/
|
|
7
|
+
isMount: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 组件参数.
|
|
10
|
+
*/
|
|
11
|
+
props?: KgSqlClientProps;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const KgSqlClientSlice: import("@reduxjs/toolkit").Slice<IKgSqlClientState, {
|
|
14
|
+
/**
|
|
15
|
+
* 挂载. 组件做初始化.
|
|
16
|
+
*
|
|
17
|
+
* @param state
|
|
18
|
+
* @param action
|
|
19
|
+
*/
|
|
20
|
+
mountReducer(state: IKgSqlClientState, action: PayloadAction<{
|
|
21
|
+
id: string | null | undefined;
|
|
22
|
+
}>): void;
|
|
23
|
+
/**
|
|
24
|
+
* 设置数据.
|
|
25
|
+
*
|
|
26
|
+
* @param state
|
|
27
|
+
* @param action
|
|
28
|
+
*/
|
|
29
|
+
setReducer(state: IKgSqlClientState, action: PayloadAction<{
|
|
30
|
+
id: string | null | undefined;
|
|
31
|
+
fn: (state: IKgSqlClientState[string]) => void;
|
|
32
|
+
}>): void;
|
|
33
|
+
/**
|
|
34
|
+
* 卸载. 释放组件资源.
|
|
35
|
+
*
|
|
36
|
+
* @param state
|
|
37
|
+
* @param action
|
|
38
|
+
*/
|
|
39
|
+
unmountReducer(state: IKgSqlClientState, action: PayloadAction<{
|
|
40
|
+
id: string | null | undefined;
|
|
41
|
+
}>): void;
|
|
42
|
+
}, "KgSqlClient", "KgSqlClient", import("@reduxjs/toolkit").SliceSelectors<IKgSqlClientState>>;
|
|
43
|
+
export declare const setReducer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
44
|
+
id: string | null | undefined;
|
|
45
|
+
fn: (state: IKgSqlClientState[string]) => void;
|
|
46
|
+
}, "KgSqlClient/setReducer">, mountReducer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
47
|
+
id: string | null | undefined;
|
|
48
|
+
}, "KgSqlClient/mountReducer">, unmountReducer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
49
|
+
id: string | null | undefined;
|
|
50
|
+
}, "KgSqlClient/unmountReducer">;
|
|
@@ -7,6 +7,9 @@ export type IKgWorkStationState = Record<string, {
|
|
|
7
7
|
* 是否已经完成挂载.
|
|
8
8
|
*/
|
|
9
9
|
isMount: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 组件参数.
|
|
12
|
+
*/
|
|
10
13
|
props?: KgWorkStationProps;
|
|
11
14
|
/**
|
|
12
15
|
* 当前选择的工作站.
|
|
@@ -90,7 +93,9 @@ export declare const setReducer: import("@reduxjs/toolkit").ActionCreatorWithPay
|
|
|
90
93
|
fn: (state: IKgWorkStationState[string]) => void;
|
|
91
94
|
}, "KgWorkStation/setReducer">, mountReducer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
92
95
|
id: string | null | undefined;
|
|
93
|
-
}, "KgWorkStation/mountReducer">,
|
|
96
|
+
}, "KgWorkStation/mountReducer">, unmountReducer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
97
|
+
id: string | null | undefined;
|
|
98
|
+
}, "KgWorkStation/unmountReducer">, openModalReducer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
94
99
|
id: string | null | undefined;
|
|
95
100
|
}, "KgWorkStation/openModalReducer">, closeModalReducer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
96
101
|
id: string | null | undefined;
|
|
@@ -100,9 +105,7 @@ export declare const setReducer: import("@reduxjs/toolkit").ActionCreatorWithPay
|
|
|
100
105
|
}, "KgWorkStation/setWorkStationReducer">, setWorkStationAreaReducer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
101
106
|
id?: string | null | undefined;
|
|
102
107
|
workStationArea: WorkstationAreaDTO | null;
|
|
103
|
-
}, "KgWorkStation/setWorkStationAreaReducer"
|
|
104
|
-
id: string | null | undefined;
|
|
105
|
-
}, "KgWorkStation/unmountReducer">;
|
|
108
|
+
}, "KgWorkStation/setWorkStationAreaReducer">;
|
|
106
109
|
export declare function isVisibleSelector(id: string): (state: IState) => boolean;
|
|
107
110
|
export declare function isOpenSelector(id: string): (state: IState) => boolean;
|
|
108
111
|
export declare function workStationSelector(id?: string): (state: IState) => WorkstationDTO | null;
|
package/src/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import './asset/index.css';
|
|
2
2
|
import './iconify.init';
|
|
3
3
|
import { IKgOption } from './component/Kg';
|
|
4
|
-
export { doKgWorkStation, type IDoKgWorkStation } from './component/KgWorkStation';
|
|
5
4
|
export { setHttpClient } from './service';
|
|
5
|
+
export { doKgWorkStation, type IDoKgWorkStation } from './component/KgWorkStation';
|
|
6
|
+
export { doKgSqlClient, type IDoKgSqlClient } from './component/KgSqlClient';
|
|
6
7
|
export interface IKgCoreReactOptions {
|
|
7
8
|
/**
|
|
8
9
|
* 选项.
|
package/src/index.store.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { IKgState } from './component/Kg';
|
|
2
|
+
import { IKgSqlClientState } from './component/KgSqlClient';
|
|
2
3
|
import { IKgWorkStationState } from './component/KgWorkStation';
|
|
3
4
|
export type IState = {
|
|
4
5
|
Kg: IKgState;
|
|
5
6
|
KgWorkStation: IKgWorkStationState;
|
|
7
|
+
KgSqlClient: IKgSqlClientState;
|
|
6
8
|
};
|
|
7
9
|
export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
8
10
|
Kg: IKgState;
|
|
9
11
|
KgWorkStation: IKgWorkStationState;
|
|
12
|
+
KgSqlClient: IKgSqlClientState;
|
|
10
13
|
}, import("@reduxjs/toolkit").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("@reduxjs/toolkit").StoreEnhancer<{
|
|
11
14
|
dispatch: import("@reduxjs/toolkit").ThunkDispatch<{
|
|
12
15
|
Kg: IKgState;
|
|
13
16
|
KgWorkStation: IKgWorkStationState;
|
|
17
|
+
KgSqlClient: IKgSqlClientState;
|
|
14
18
|
}, undefined, import("@reduxjs/toolkit").UnknownAction>;
|
|
15
19
|
}>, import("@reduxjs/toolkit").StoreEnhancer]>>;
|