@kengic/vue 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. package/dist/kengic-vue.js +2744 -2693
  2. package/dist/src/components/KgAppSelect/index.hooks.d.ts +8 -2
  3. package/dist/src/components/KgButton/index.hooks.d.ts +20 -3
  4. package/dist/src/components/KgForm/index.d.ts +2 -0
  5. package/dist/src/components/KgForm/index.hooks.d.ts +21 -0
  6. package/dist/src/components/KgForm/index.store.d.ts +59 -0
  7. package/dist/src/components/KgForm.Item/KgForm.Item.d.ts +3 -9
  8. package/dist/src/components/KgForm.Item/addon/KgForm.Item.Addon.Lookup.Modal.d.ts +1 -9
  9. package/dist/src/components/KgForm.Item/addon/KgForm.Item.Addon.Lookup.d.ts +2 -8
  10. package/dist/src/components/KgForm.Item/components/KgForm.Item.Checkbox.d.ts +0 -4
  11. package/dist/src/components/KgForm.Item/components/KgForm.Item.CheckboxGroup.d.ts +2 -6
  12. package/dist/src/components/KgForm.Item/components/KgForm.Item.Date.d.ts +0 -4
  13. package/dist/src/components/KgForm.Item/components/KgForm.Item.DateRange.d.ts +0 -4
  14. package/dist/src/components/KgForm.Item/components/KgForm.Item.Input.d.ts +0 -4
  15. package/dist/src/components/KgForm.Item/components/KgForm.Item.InputNumber.d.ts +0 -4
  16. package/dist/src/components/KgForm.Item/components/KgForm.Item.RadioGroup.d.ts +0 -4
  17. package/dist/src/components/KgForm.Item/components/KgForm.Item.Select.d.ts +4 -8
  18. package/dist/src/components/KgForm.Item/components/KgForm.Item.Switch.d.ts +0 -4
  19. package/dist/src/components/KgForm.Item/components/KgForm.Item.TextArea.d.ts +0 -4
  20. package/dist/src/components/KgForm.Item/index.vm.d.ts +0 -10
  21. package/dist/src/components/KgSearch/index.hooks.d.ts +8 -8
  22. package/dist/src/components/KgSubmit/index.hooks.d.ts +3 -1
  23. package/dist/src/components/KgSubmit/index.store.d.ts +25 -12
  24. package/dist/src/components/KgVar/index.hooks.d.ts +13 -2
  25. package/dist/src/components/KgWarehouse/index.hooks.d.ts +4 -1
  26. package/dist/src/components/util.d.ts +15 -0
  27. package/dist/src/consts/index.vm.d.ts +1 -1
  28. package/package.json +1 -1
@@ -5,7 +5,6 @@ import { Dayjs } from 'dayjs';
5
5
  import { ComputedRef, ExtractPropTypes, InjectionKey, PropType } from 'vue';
6
6
  import { VarProfileDetail, VarSubmitField, VarVariableConfig } from '../../apis/WMS/models';
7
7
  import { KG_FORM_CONTEXT } from '../../consts';
8
- import { IKgTableRow } from '../KgTable';
9
8
  export declare type IKgFormItemValue = string | number | Array<string | number>;
10
9
  export declare const getProps: () => {
11
10
  /** 变量名称. */
@@ -66,11 +65,6 @@ export declare const getProps: () => {
66
65
  default: undefined;
67
66
  };
68
67
  kgRules: PropType<RuleObject[]>;
69
- /**
70
- * 查找弹窗确定之前的回调函数, 如果返回 false, 则查找弹窗不会触发 kgOk 事件.
71
- * 通常用于在弹窗确定之前, 对选择的数据进行校验, 如果校验失败, 则不允许确定, 需要重新选择数据.
72
- */
73
- onKgLookupBeforeOk: PropType<(value: any | Array<any>, record: IKgTableRow | Array<IKgTableRow>) => boolean>;
74
68
  value: PropType<IKgFormItemValue>;
75
69
  'onUpdate:value': PropType<(value: IKgFormItemValue | null) => void>;
76
70
  onKgSubmit: PropType<() => void>;
@@ -78,8 +72,6 @@ export declare const getProps: () => {
78
72
  onKgChange: PropType<(value: any | null) => void>;
79
73
  /** 下拉列表选中某个(可能多个)数据. */
80
74
  onKgSelectChange: PropType<(value: any | null) => void>;
81
- /** 查找弹窗选中某个(可能多个)数据. */
82
- onKgLookupChange: PropType<(value: any | null) => void>;
83
75
  /** 下拉列表数据发生变更. */
84
76
  onKgSelectDatasChange: PropType<(datas: Array<any>) => void>;
85
77
  /** 列表数据发生变更. */
@@ -95,7 +87,5 @@ export declare type IKgFormItemSlotControlParam = {
95
87
  varProfileDetail: VarProfileDetail;
96
88
  varSubmitField: VarSubmitField;
97
89
  };
98
- /** 依赖注入 onKgLookupBeforeOk 参数. */
99
- export declare const DI_ON_KG_LOOKUP_BEFORE_OK: InjectionKey<(value: any | Array<any>, record: IKgTableRow | Array<IKgTableRow>) => boolean>;
100
90
  /** 依赖注入 kgContext 参数. */
101
91
  export declare const DI_KG_CONTEXT: InjectionKey<string>;
@@ -5,6 +5,14 @@ export declare type IUseKgSearch = {
5
5
  formID: string;
6
6
  /** 状态数据. */
7
7
  store: IKgSearchStore;
8
+ /** 是否准备就绪. 即查询条件是否已经初始化完成了. */
9
+ isReady: ComputedRef<ReturnType<IKgSearchStore['getIsReady']>>;
10
+ /** 表单数据对象. */
11
+ model: ComputedRef<ReturnType<IKgSearchStore['getModel']>>;
12
+ /** 执行查询. */
13
+ search: ComputedRef<ReturnType<IKgSearchStore['getSearchFn']>>;
14
+ /** 执行重置. */
15
+ reset: ComputedRef<ReturnType<IKgSearchStore['getResetFn']>>;
8
16
  /**
9
17
  * 监听事件: search, 点击查询按钮, 并且表单验证通过.
10
18
  * @param cb 回调函数.
@@ -21,14 +29,6 @@ export declare type IUseKgSearch = {
21
29
  * @param once 是否只会触发一次.
22
30
  * */
23
31
  onReady(cb: IKgSearchReadyCb, once?: boolean): IRemoveEventListenerHandler;
24
- /** 是否准备就绪. 即查询条件是否已经初始化完成了. */
25
- isReady: ComputedRef<ReturnType<IKgSearchStore['getIsReady']>>;
26
- /** 表单数据对象. */
27
- model: ComputedRef<ReturnType<IKgSearchStore['getModel']>>;
28
- /** 执行查询. */
29
- search: ComputedRef<ReturnType<IKgSearchStore['getSearchFn']>>;
30
- /** 执行重置. */
31
- reset: ComputedRef<ReturnType<IKgSearchStore['getResetFn']>>;
32
32
  };
33
33
  /**
34
34
  * @param formID 界面标识.
@@ -2,7 +2,7 @@ import { RuleObject } from 'ant-design-vue/es/form';
2
2
  import { FormInstance } from 'ant-design-vue/lib/form/Form';
3
3
  import { Ref } from 'vue';
4
4
  import { IRemoveEventListenerHandler, KG_VAR_SUBMIT__DISPLAY_TYPE } from '../../consts';
5
- import { IKgSubmitAfterValidateCb, IKgSubmitBeforeOkCb, IKgSubmitBeforeRequestCb, IKgSubmitCloseCb, IKgSubmitErrorCb, IKgSubmitOkCb, IKgSubmitOpenCb, IKgSubmitStore } from './index.store';
5
+ import { IKgSubmitAfterValidateCb, IKgSubmitBeforeOkCb, IKgSubmitBeforeRequestCb, IKgSubmitCloseCb, IKgSubmitErrorCb, IKgSubmitLookupOkCb, IKgSubmitOkCb, IKgSubmitOpenCb, IKgSubmitStore } from './index.store';
6
6
  export declare type IUseKgSubmit = {
7
7
  formID: string;
8
8
  /** 状态数据. */
@@ -27,6 +27,8 @@ export declare type IUseKgSubmit = {
27
27
  onError(cb: IKgSubmitErrorCb): IRemoveEventListenerHandler;
28
28
  /** 监听事件: 关闭弹窗. 点击取消或者点击确定并且成功之后, 都会触发. */
29
29
  onClose(cb: IKgSubmitCloseCb): IRemoveEventListenerHandler;
30
+ /** 监听事件: 查找弹窗点击确定. */
31
+ onLookupOk(cb: IKgSubmitLookupOkCb): IRemoveEventListenerHandler;
30
32
  };
31
33
  /**
32
34
  * @param formID 界面标识.
@@ -5,15 +5,17 @@ import { Ref } from 'vue';
5
5
  import { IKgTableRow } from '../KgTable';
6
6
  /**
7
7
  * 事件类型.
8
- * 'open': 打开弹窗
9
- * 'beforeOk': 点击保存按钮之后, 执行默认逻辑之前
10
- * 'afterValidate': 表单验证成功
11
- * 'beforeRequest': 发起请求之前
12
- * 'ok': 请求成功, 即将关闭弹窗
13
- * 'error': 请求失败. 请求失败了, 或者请求返回了错误消息
14
- * 'close': 关闭弹窗
8
+ * 'open': 打开弹窗
9
+ * 'beforeOk': 点击保存按钮之后, 执行默认逻辑之前
10
+ * 'afterValidate': 表单验证成功
11
+ * 'beforeRequest': 发起请求之前
12
+ * 'ok': 请求成功, 即将关闭弹窗
13
+ * 'error': 请求失败. 请求失败了, 或者请求返回了错误消息
14
+ * 'close': 关闭弹窗
15
+ * 'lookupBeforeOk': 查找弹窗点击确定之前. 如果返回 true 则查找弹窗不会触发 kgOk 事件
16
+ * 'lookupOk': 查找弹窗点击确定
15
17
  */
16
- export declare type IKgSubmitEvent = 'open' | 'close' | 'beforeOk' | 'afterValidate' | 'beforeRequest' | 'ok' | 'error';
18
+ export declare type IKgSubmitEvent = 'open' | 'beforeOk' | 'afterValidate' | 'beforeRequest' | 'ok' | 'error' | 'close' | 'lookupBeforeOk' | 'lookupOk';
17
19
  /** 事件监听函数: open. */
18
20
  export declare type IKgSubmitOpenCbParam = {
19
21
  isCreating: boolean;
@@ -24,8 +26,6 @@ export declare type IKgSubmitOpenCbParam = {
24
26
  model: Ref<Record<string, any>>;
25
27
  };
26
28
  export declare type IKgSubmitOpenCb = (param: IKgSubmitOpenCbParam) => Promise<boolean>;
27
- /** 事件监听函数: close. */
28
- export declare type IKgSubmitCloseCb = (param?: any | null) => Promise<boolean>;
29
29
  /** 事件监听函数: beforeOk. */
30
30
  export declare type IKgSubmitBeforeOkCbParam = {
31
31
  isCreating: boolean;
@@ -65,15 +65,28 @@ export declare type IKgSubmitBeforeRequestCb = (param: IKgSubmitBeforeRequestCbP
65
65
  export declare type IKgSubmitOkCb = (param?: any | null) => Promise<boolean>;
66
66
  /** 事件监听函数: error. */
67
67
  export declare type IKgSubmitErrorCb = (param: any) => Promise<boolean>;
68
- export declare type IKgSubmitCb = IKgSubmitOpenCb | IKgSubmitCloseCb | IKgSubmitBeforeOkCb | IKgSubmitAfterValidateCb | IKgSubmitBeforeRequestCb | IKgSubmitOkCb | IKgSubmitErrorCb;
68
+ /** 事件监听函数: close. */
69
+ export declare type IKgSubmitCloseCb = (param?: any | null) => Promise<boolean>;
70
+ /** 事件监听函数: lookupOk. */
71
+ export declare type IKgSubmitLookupOkCbParam = {
72
+ /** 变量. */
73
+ var_nam: string;
74
+ /** 单选时, 勾选的那一行. */
75
+ row: IKgTableRow | null;
76
+ /** 多选时, 勾选的所有行. */
77
+ rows: Array<IKgTableRow> | null;
78
+ };
79
+ export declare type IKgSubmitLookupOkCb = (param: IKgSubmitLookupOkCbParam) => Promise<boolean>;
80
+ export declare type IKgSubmitCb = IKgSubmitOpenCb | IKgSubmitBeforeOkCb | IKgSubmitAfterValidateCb | IKgSubmitBeforeRequestCb | IKgSubmitOkCb | IKgSubmitErrorCb | IKgSubmitCloseCb | IKgSubmitLookupOkCb;
69
81
  export interface IKgSubmitState {
70
82
  openListenersMap: Map<string, Array<IKgSubmitOpenCb>>;
71
- closeListenersMap: Map<string, Array<IKgSubmitCloseCb>>;
72
83
  beforeOkListenersMap: Map<string, Array<IKgSubmitBeforeOkCb>>;
73
84
  afterValidateListenersMap: Map<string, Array<IKgSubmitAfterValidateCb>>;
74
85
  beforeRequestListenersMap: Map<string, Array<IKgSubmitBeforeRequestCb>>;
75
86
  okListenersMap: Map<string, Array<IKgSubmitOkCb>>;
76
87
  errorListenersMap: Map<string, Array<IKgSubmitErrorCb>>;
88
+ closeListenersMap: Map<string, Array<IKgSubmitCloseCb>>;
89
+ lookupOkListenersMap: Map<string, Array<IKgSubmitLookupOkCb>>;
77
90
  isLoadingMap: Map<string, boolean>;
78
91
  /** 表单数据对象. */
79
92
  modelMap: Map<string, Record<string, any>>;
@@ -55,10 +55,21 @@ export declare type IUseKgVar = {
55
55
  systemVarGridDetails: ComputedRef<ReturnType<IKgVarStore['getSystemVarGridDetails']>>;
56
56
  /** 当前的 VarGridDetail 列表. */
57
57
  currentVarGridDetails: ComputedRef<ReturnType<IKgVarStore['getCurrentVarGridDetails']>>;
58
+ /** 设置'正在创建'. */
59
+ setIsCreating(value: boolean): void;
60
+ /** 设置'正在更新'. */
61
+ setIsUpdating(value: boolean): void;
62
+ /** 设置'正在复制'. */
63
+ setIsCopying(value: boolean): void;
64
+ /** 设置'正在删除'. */
65
+ setIsDeleting(value: boolean): void;
66
+ /**
67
+ * 监听事件: retrieve, 变量配置查询完成.
68
+ * @param cb 回调函数.
69
+ */
70
+ onRetrieve(cb: IKgVarRetrieveCb): IRemoveEventListenerHandler;
58
71
  /** 翻译变量. */
59
72
  t: (var_nam?: string | null) => ComputedRef<string>;
60
- /** 监听事件: retrieve, 变量配置查询完成. */
61
- onRetrieve(cb: IKgVarRetrieveCb): IRemoveEventListenerHandler;
62
73
  };
63
74
  /**
64
75
  * 启用变量.
@@ -8,7 +8,10 @@ export declare type IUseKgWarehouse = {
8
8
  visible: ComputedRef<boolean>;
9
9
  /** 当前仓库. */
10
10
  warehouse: ComputedRef<WhDTO | null>;
11
- /** 监听事件: 组件加载完成. */
11
+ /**
12
+ * 监听事件: 组件加载完成.
13
+ * @param cb 回调函数.
14
+ */
12
15
  onMounted(cb: IKgWarehouseMountedCb): IRemoveEventListenerHandler;
13
16
  };
14
17
  /**
@@ -0,0 +1,15 @@
1
+ import { IRemoveEventListenerHandler } from '../consts';
2
+ /**
3
+ * 构造事件监听.
4
+ * @param frm_id 界面标识.
5
+ * @param store 状态管理.
6
+ * @param event 事件名称.
7
+ * @param once 是否只会触发一次.
8
+ */
9
+ export declare function onEventFactory<S extends {
10
+ addEventListener(frm_id: string, event: E, cb: C): void;
11
+ removeEventListener(frm_id: string, event: E, cb?: C): void;
12
+ } | {
13
+ addEventListener(event: E, cb: C): void;
14
+ removeEventListener(event: E, cb?: C): void;
15
+ } = any, E = any, C = any>(frm_id: string | null, store: S, event: E, once?: boolean): (cb: C) => IRemoveEventListenerHandler;
@@ -1,4 +1,4 @@
1
- /** 移除监听函数. */
1
+ /** 移除事件监听函数. */
2
2
  export declare type IRemoveEventListenerHandler = () => void;
3
3
  /** 菜单. */
4
4
  export interface Menu {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/vue",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build:dev": "rimraf dist && vue-tsc && vite build --mode development",