@ibiz-template/vue3-util 0.2.18-dev.2 → 0.3.0
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/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/es/panel-component/panel-field/panel-field.controller.d.ts +18 -0
- package/es/panel-component/panel-field/panel-field.controller.d.ts.map +1 -1
- package/es/panel-component/panel-field/panel-field.controller.mjs +41 -1
- package/es/panel-component/panel-field/panel-field.d.ts.map +1 -1
- package/es/panel-component/panel-field/panel-field.mjs +4 -1
- package/es/props/editor/common.d.ts +5 -3
- package/es/props/editor/common.d.ts.map +1 -1
- package/es/props/editor/common.mjs +4 -2
- package/es/util/store/app-store/app-store.d.ts +82 -3
- package/es/util/store/app-store/app-store.d.ts.map +1 -1
- package/es/util/store/app-store/app-store.mjs +8 -1
- package/es/util/store/async-action/async-action.d.ts +56 -0
- package/es/util/store/async-action/async-action.d.ts.map +1 -0
- package/es/util/store/async-action/async-action.mjs +62 -0
- package/package.json +7 -5
- package/src/panel-component/panel-field/panel-field.controller.ts +44 -0
- package/src/panel-component/panel-field/panel-field.tsx +3 -0
- package/src/props/editor/common.ts +5 -3
- package/src/util/store/app-store/app-store.ts +14 -3
- package/src/util/store/async-action/async-action.ts +97 -0
|
@@ -71,5 +71,23 @@ export declare class PanelFieldController extends PanelItemController<IPanelFiel
|
|
|
71
71
|
* @param {string} name 要设置的面板数据的属性名称
|
|
72
72
|
*/
|
|
73
73
|
setDataValue(value: unknown, name?: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* 聚焦事件
|
|
76
|
+
* @author lxm
|
|
77
|
+
* @date 2023-10-11 05:03:26
|
|
78
|
+
*/
|
|
79
|
+
onFocus(event: MouseEvent): void;
|
|
80
|
+
/**
|
|
81
|
+
* 失焦事件
|
|
82
|
+
* @author lxm
|
|
83
|
+
* @date 2023-10-11 05:03:26
|
|
84
|
+
*/
|
|
85
|
+
onBlur(event: MouseEvent): void;
|
|
86
|
+
/**
|
|
87
|
+
* 回车事件
|
|
88
|
+
* @author lxm
|
|
89
|
+
* @date 2023-10-11 05:03:26
|
|
90
|
+
*/
|
|
91
|
+
onEnter(event: MouseEvent): void;
|
|
74
92
|
}
|
|
75
93
|
//# sourceMappingURL=panel-field.controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel-field.controller.d.ts","sourceRoot":"","sources":["../../../src/panel-component/panel-field/panel-field.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,mBAAmB,
|
|
1
|
+
{"version":3,"file":"panel-field.controller.d.ts","sourceRoot":"","sources":["../../../src/panel-component/panel-field/panel-field.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAC1B,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;GAMG;AACH,qBAAa,oBACX,SAAQ,mBAAmB,CAAC,WAAW,CACvC,YAAW,0BAA0B;IAE7B,KAAK,EAAE,eAAe,CAAC;IAE/B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAa;IAEzC;;;;;;OAMG;IACH,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,QAAQ,IAAI,MAAM,GAAG,SAAS,CAEjC;IAED,IAAI,OAAO,IAAI,QAAQ,CAEtB;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;;;;;OAMG;IACH,IAAI,IAAI,IAAI,KAAK,CAEhB;IAED;;;;;OAKG;IACH,IAAI,KAAK,IAAI,MAAM,GAAG,MAAM,CAE3B;IAED;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,eAAe,CAAC;IAEjC,SAAS,CAAC,WAAW,IAAI,eAAe;IAIxC;;;;;;;OAOG;cACa,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBvC;;;;;;;OAOG;IACG,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAQhC;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAQ/B;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAOjC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PanelItemController, getEditorProvider } from '@ibiz-template/runtime';
|
|
1
|
+
import { PanelItemController, getEditorProvider, PanelItemEventName } from '@ibiz-template/runtime';
|
|
2
2
|
import { PanelFieldState } from './panel-field.state.mjs';
|
|
3
3
|
|
|
4
4
|
"use strict";
|
|
@@ -84,6 +84,46 @@ class PanelFieldController extends PanelItemController {
|
|
|
84
84
|
if (this.dataParent.setDataValue) {
|
|
85
85
|
await this.dataParent.setDataValue(name, value);
|
|
86
86
|
}
|
|
87
|
+
this.panel.evt.emit("onPanelItemEvent", {
|
|
88
|
+
panelItemName: this.model.id,
|
|
89
|
+
panelItemEventName: PanelItemEventName.CHANGE
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 聚焦事件
|
|
94
|
+
* @author lxm
|
|
95
|
+
* @date 2023-10-11 05:03:26
|
|
96
|
+
*/
|
|
97
|
+
onFocus(event) {
|
|
98
|
+
this.panel.evt.emit("onPanelItemEvent", {
|
|
99
|
+
panelItemName: this.model.id,
|
|
100
|
+
panelItemEventName: PanelItemEventName.FOCUS,
|
|
101
|
+
event
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 失焦事件
|
|
106
|
+
* @author lxm
|
|
107
|
+
* @date 2023-10-11 05:03:26
|
|
108
|
+
*/
|
|
109
|
+
onBlur(event) {
|
|
110
|
+
this.panel.evt.emit("onPanelItemEvent", {
|
|
111
|
+
panelItemName: this.model.id,
|
|
112
|
+
panelItemEventName: PanelItemEventName.BLUR,
|
|
113
|
+
event
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 回车事件
|
|
118
|
+
* @author lxm
|
|
119
|
+
* @date 2023-10-11 05:03:26
|
|
120
|
+
*/
|
|
121
|
+
onEnter(event) {
|
|
122
|
+
this.panel.evt.emit("onPanelItemEvent", {
|
|
123
|
+
panelItemName: this.model.id,
|
|
124
|
+
panelItemEventName: PanelItemEventName.ENTER,
|
|
125
|
+
event
|
|
126
|
+
});
|
|
87
127
|
}
|
|
88
128
|
}
|
|
89
129
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel-field.d.ts","sourceRoot":"","sources":["../../../src/panel-component/panel-field/panel-field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAA6B,QAAQ,EAAuB,MAAM,KAAK,CAAC;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,oBAAoB,CAAC;AAE5B,eAAO,MAAM,UAAU;;;;;;;;;;;;yBAuBS,OAAO,SAAS,MAAM,KAAG,IAAI;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"panel-field.d.ts","sourceRoot":"","sources":["../../../src/panel-component/panel-field/panel-field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAA6B,QAAQ,EAAuB,MAAM,KAAK,CAAC;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,oBAAoB,CAAC;AAE5B,eAAO,MAAM,UAAU;;;;;;;;;;;;yBAuBS,OAAO,SAAS,MAAM,KAAG,IAAI;;;;;;;;;;YAmD3D,CAAC"}
|
|
@@ -46,7 +46,10 @@ const PanelField = /* @__PURE__ */ defineComponent({
|
|
|
46
46
|
disabled: this.controller.state.disabled,
|
|
47
47
|
class: this.ns.b("content"),
|
|
48
48
|
readonly: this.controller.model.editor.readOnly,
|
|
49
|
-
onChange: this.onValueChange
|
|
49
|
+
onChange: this.onValueChange,
|
|
50
|
+
onFocus: (event) => this.controller.onFocus(event),
|
|
51
|
+
onBlur: (event) => this.controller.onBlur(event),
|
|
52
|
+
onEnter: (event) => this.controller.onEnter(event)
|
|
50
53
|
};
|
|
51
54
|
if (this.$slots.default) {
|
|
52
55
|
editor = this.$slots.default(editorProps);
|
|
@@ -29,7 +29,7 @@ export declare function getEditorProps<C>(): {
|
|
|
29
29
|
* 获取编辑器通用emits
|
|
30
30
|
*
|
|
31
31
|
* @author lxm
|
|
32
|
-
* @date 2022-11-
|
|
32
|
+
* @date 2022-11-03 19:11:04
|
|
33
33
|
* @export
|
|
34
34
|
* @template V
|
|
35
35
|
* @returns {*}
|
|
@@ -38,9 +38,11 @@ export declare function getEditorEmits<V>(): {
|
|
|
38
38
|
/** 值变更事件 */
|
|
39
39
|
change: (_value: V, _name?: string) => boolean;
|
|
40
40
|
/** 失焦事件 */
|
|
41
|
-
blur: () => boolean;
|
|
41
|
+
blur: (_event?: IData) => boolean;
|
|
42
42
|
/** 聚焦事件 */
|
|
43
|
-
focus: () => boolean;
|
|
43
|
+
focus: (_event?: IData) => boolean;
|
|
44
|
+
/** 回车事件 */
|
|
45
|
+
enter: (_event?: IData) => boolean;
|
|
44
46
|
};
|
|
45
47
|
/**
|
|
46
48
|
* 获取表格列编辑器通用emits
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/props/editor/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC;;;;;;;;;;;;;;;EAiB/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC;IAE5B,YAAY;qBACK,CAAC,UAAU,MAAM;IAClC,WAAW
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/props/editor/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC;;;;;;;;;;;;;;;EAiB/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC;IAE5B,YAAY;qBACK,CAAC,UAAU,MAAM;IAClC,WAAW;oBACK,KAAK;IACrB,WAAW;qBACM,KAAK;IACtB,WAAW;qBACM,KAAK;EAEzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,CAAC;IAEhC,YAAY;qBACK,CAAC,UAAU,MAAM;IAClC,eAAe;;EAGlB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB;;;;EAMvC"}
|
|
@@ -24,9 +24,11 @@ function getEditorEmits() {
|
|
|
24
24
|
/** 值变更事件 */
|
|
25
25
|
change: (_value, _name) => true,
|
|
26
26
|
/** 失焦事件 */
|
|
27
|
-
blur: () => true,
|
|
27
|
+
blur: (_event) => true,
|
|
28
28
|
/** 聚焦事件 */
|
|
29
|
-
focus: () => true
|
|
29
|
+
focus: (_event) => true,
|
|
30
|
+
/** 回车事件 */
|
|
31
|
+
enter: (_event) => true
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
function getGridEditorEmits() {
|
|
@@ -1,10 +1,89 @@
|
|
|
1
|
+
import { IPortalAsyncAction } from '@ibiz-template/core';
|
|
2
|
+
import { Ref } from 'vue';
|
|
1
3
|
export interface IAppStore {
|
|
4
|
+
allAsyncActions: Ref<IPortalAsyncAction[]>;
|
|
5
|
+
recentAsyncActions: IPortalAsyncAction[];
|
|
2
6
|
}
|
|
3
7
|
export declare const useAppStore: import("pinia").StoreDefinition<"appStore", import("pinia")._UnwrapAll<Pick<{
|
|
4
|
-
appStore:
|
|
8
|
+
appStore: {
|
|
9
|
+
allAsyncActions: IPortalAsyncAction[];
|
|
10
|
+
recentAsyncActions: {
|
|
11
|
+
asyncacitonid: string;
|
|
12
|
+
asyncacitonname: string;
|
|
13
|
+
fulltopictag: string;
|
|
14
|
+
srfdcid: string;
|
|
15
|
+
dcsystemid: string;
|
|
16
|
+
actiontype: string;
|
|
17
|
+
actionstate: 10 | 20 | 30 | 40;
|
|
18
|
+
actionresult?: unknown;
|
|
19
|
+
stepinfo?: string | undefined;
|
|
20
|
+
completionrate?: number | undefined;
|
|
21
|
+
asyncresultdownloadurl?: string | undefined;
|
|
22
|
+
actionparam?: unknown;
|
|
23
|
+
actionparam2?: unknown;
|
|
24
|
+
actionparam3?: unknown;
|
|
25
|
+
actionparam4?: unknown;
|
|
26
|
+
begintime: string;
|
|
27
|
+
endtime: string;
|
|
28
|
+
createman: string;
|
|
29
|
+
createdate: string;
|
|
30
|
+
updateman: string;
|
|
31
|
+
updatedate: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
5
34
|
}, "appStore">>, Pick<{
|
|
6
|
-
appStore:
|
|
35
|
+
appStore: {
|
|
36
|
+
allAsyncActions: IPortalAsyncAction[];
|
|
37
|
+
recentAsyncActions: {
|
|
38
|
+
asyncacitonid: string;
|
|
39
|
+
asyncacitonname: string;
|
|
40
|
+
fulltopictag: string;
|
|
41
|
+
srfdcid: string;
|
|
42
|
+
dcsystemid: string;
|
|
43
|
+
actiontype: string;
|
|
44
|
+
actionstate: 10 | 20 | 30 | 40;
|
|
45
|
+
actionresult?: unknown;
|
|
46
|
+
stepinfo?: string | undefined;
|
|
47
|
+
completionrate?: number | undefined;
|
|
48
|
+
asyncresultdownloadurl?: string | undefined;
|
|
49
|
+
actionparam?: unknown;
|
|
50
|
+
actionparam2?: unknown;
|
|
51
|
+
actionparam3?: unknown;
|
|
52
|
+
actionparam4?: unknown;
|
|
53
|
+
begintime: string;
|
|
54
|
+
endtime: string;
|
|
55
|
+
createman: string;
|
|
56
|
+
createdate: string;
|
|
57
|
+
updateman: string;
|
|
58
|
+
updatedate: string;
|
|
59
|
+
}[];
|
|
60
|
+
};
|
|
7
61
|
}, never>, Pick<{
|
|
8
|
-
appStore:
|
|
62
|
+
appStore: {
|
|
63
|
+
allAsyncActions: IPortalAsyncAction[];
|
|
64
|
+
recentAsyncActions: {
|
|
65
|
+
asyncacitonid: string;
|
|
66
|
+
asyncacitonname: string;
|
|
67
|
+
fulltopictag: string;
|
|
68
|
+
srfdcid: string;
|
|
69
|
+
dcsystemid: string;
|
|
70
|
+
actiontype: string;
|
|
71
|
+
actionstate: 10 | 20 | 30 | 40;
|
|
72
|
+
actionresult?: unknown;
|
|
73
|
+
stepinfo?: string | undefined;
|
|
74
|
+
completionrate?: number | undefined;
|
|
75
|
+
asyncresultdownloadurl?: string | undefined;
|
|
76
|
+
actionparam?: unknown;
|
|
77
|
+
actionparam2?: unknown;
|
|
78
|
+
actionparam3?: unknown;
|
|
79
|
+
actionparam4?: unknown;
|
|
80
|
+
begintime: string;
|
|
81
|
+
endtime: string;
|
|
82
|
+
createman: string;
|
|
83
|
+
createdate: string;
|
|
84
|
+
updateman: string;
|
|
85
|
+
updatedate: string;
|
|
86
|
+
}[];
|
|
87
|
+
};
|
|
9
88
|
}, never>>;
|
|
10
89
|
//# sourceMappingURL=app-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-store.d.ts","sourceRoot":"","sources":["../../../../src/util/store/app-store/app-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-store.d.ts","sourceRoot":"","sources":["../../../../src/util/store/app-store/app-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAY,GAAG,EAAE,MAAM,KAAK,CAAC;AAGpC,MAAM,WAAW,SAAS;IACxB,eAAe,EAAE,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC3C,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;CAC1C;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAUtB,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { reactive } from 'vue';
|
|
3
|
+
import { useAsyncAction } from '../async-action/async-action.mjs';
|
|
3
4
|
|
|
4
5
|
"use strict";
|
|
5
6
|
const useAppStore = defineStore("appStore", () => {
|
|
6
|
-
const
|
|
7
|
+
const { allAsyncActions, recentAsyncActions } = useAsyncAction();
|
|
8
|
+
const appStore = reactive({
|
|
9
|
+
allAsyncActions,
|
|
10
|
+
get recentAsyncActions() {
|
|
11
|
+
return recentAsyncActions.value;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
7
14
|
return { appStore };
|
|
8
15
|
});
|
|
9
16
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 使用异步操作消息
|
|
3
|
+
* @author lxm
|
|
4
|
+
* @date 2023-11-14 03:17:28
|
|
5
|
+
* @export
|
|
6
|
+
* @return {*}
|
|
7
|
+
*/
|
|
8
|
+
export declare function useAsyncAction(): {
|
|
9
|
+
allAsyncActions: import("vue").Ref<{
|
|
10
|
+
asyncacitonid: string;
|
|
11
|
+
asyncacitonname: string;
|
|
12
|
+
fulltopictag: string;
|
|
13
|
+
srfdcid: string;
|
|
14
|
+
dcsystemid: string;
|
|
15
|
+
actiontype: string;
|
|
16
|
+
actionstate: 10 | 20 | 30 | 40;
|
|
17
|
+
actionresult?: unknown;
|
|
18
|
+
stepinfo?: string | undefined;
|
|
19
|
+
completionrate?: number | undefined;
|
|
20
|
+
asyncresultdownloadurl?: string | undefined;
|
|
21
|
+
actionparam?: unknown;
|
|
22
|
+
actionparam2?: unknown;
|
|
23
|
+
actionparam3?: unknown;
|
|
24
|
+
actionparam4?: unknown;
|
|
25
|
+
begintime: string;
|
|
26
|
+
endtime: string;
|
|
27
|
+
createman: string;
|
|
28
|
+
createdate: string;
|
|
29
|
+
updateman: string;
|
|
30
|
+
updatedate: string;
|
|
31
|
+
}[]>;
|
|
32
|
+
recentAsyncActions: import("vue").ComputedRef<{
|
|
33
|
+
asyncacitonid: string;
|
|
34
|
+
asyncacitonname: string;
|
|
35
|
+
fulltopictag: string;
|
|
36
|
+
srfdcid: string;
|
|
37
|
+
dcsystemid: string;
|
|
38
|
+
actiontype: string;
|
|
39
|
+
actionstate: 10 | 20 | 30 | 40;
|
|
40
|
+
actionresult?: unknown;
|
|
41
|
+
stepinfo?: string | undefined;
|
|
42
|
+
completionrate?: number | undefined;
|
|
43
|
+
asyncresultdownloadurl?: string | undefined;
|
|
44
|
+
actionparam?: unknown;
|
|
45
|
+
actionparam2?: unknown;
|
|
46
|
+
actionparam3?: unknown;
|
|
47
|
+
actionparam4?: unknown;
|
|
48
|
+
begintime: string;
|
|
49
|
+
endtime: string;
|
|
50
|
+
createman: string;
|
|
51
|
+
createdate: string;
|
|
52
|
+
updateman: string;
|
|
53
|
+
updatedate: string;
|
|
54
|
+
}[]>;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=async-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-action.d.ts","sourceRoot":"","sources":["../../../../src/util/store/async-action/async-action.ts"],"names":[],"mappings":"AA8BA;;;;;;GAMG;AACH,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2D7B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { isNumber } from 'lodash-es';
|
|
3
|
+
import { ref, computed, onUnmounted } from 'vue';
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
function formatAsyncAction(data) {
|
|
7
|
+
const dateFields = [
|
|
8
|
+
"begintime",
|
|
9
|
+
"endtime",
|
|
10
|
+
"createdate",
|
|
11
|
+
"updatedate"
|
|
12
|
+
];
|
|
13
|
+
dateFields.forEach((key) => {
|
|
14
|
+
if (isNumber(data[key])) {
|
|
15
|
+
data[key] = dayjs(data[key]).format("YYYY-MM-DD HH:mm:ss");
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
function useAsyncAction() {
|
|
21
|
+
const allAsyncActions = ref([]);
|
|
22
|
+
const showLength = ref(0);
|
|
23
|
+
const recentAsyncActions = computed(() => {
|
|
24
|
+
return allAsyncActions.value.filter(
|
|
25
|
+
(_item, index) => index < showLength.value
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
const load = async () => {
|
|
29
|
+
const res = await ibiz.asyncAction.fetch();
|
|
30
|
+
allAsyncActions.value = res.data;
|
|
31
|
+
};
|
|
32
|
+
const asyncActionCallBack = (msg) => {
|
|
33
|
+
if (!msg.data || msg.subtype !== "ASYNCACTION") {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const asyncAction = formatAsyncAction(msg.data);
|
|
37
|
+
const findIndex = allAsyncActions.value.findIndex(
|
|
38
|
+
(item) => item.asyncacitonid === asyncAction.asyncacitonid
|
|
39
|
+
);
|
|
40
|
+
if (findIndex !== -1) {
|
|
41
|
+
allAsyncActions.value.unshift(asyncAction);
|
|
42
|
+
showLength.value += 1;
|
|
43
|
+
} else {
|
|
44
|
+
const isShow = findIndex >= showLength.value;
|
|
45
|
+
if (isShow) {
|
|
46
|
+
allAsyncActions.value.splice(findIndex, 1);
|
|
47
|
+
allAsyncActions.value.unshift(asyncAction);
|
|
48
|
+
showLength.value += 1;
|
|
49
|
+
} else {
|
|
50
|
+
allAsyncActions.value.splice(findIndex, 1, asyncAction);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
load();
|
|
55
|
+
ibiz.mc.command.asyncAction.on(asyncActionCallBack);
|
|
56
|
+
onUnmounted(() => {
|
|
57
|
+
ibiz.mc.command.asyncAction.off(asyncActionCallBack);
|
|
58
|
+
});
|
|
59
|
+
return { allAsyncActions, recentAsyncActions };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { useAsyncAction };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/vue3-util",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "vue3 工具包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@ibiz-template/cli": "0.3.2",
|
|
34
|
-
"@ibiz-template/core": "^0.
|
|
35
|
-
"@ibiz-template/runtime": "^0.
|
|
36
|
-
"@ibiz-template/theme": "^0.
|
|
34
|
+
"@ibiz-template/core": "^0.3.0",
|
|
35
|
+
"@ibiz-template/runtime": "^0.3.0",
|
|
36
|
+
"@ibiz-template/theme": "^0.3.0",
|
|
37
37
|
"@ibiz/model-core": "^0.0.20",
|
|
38
38
|
"@types/path-browserify": "^1.0.2",
|
|
39
39
|
"@types/qs": "^6.9.10",
|
|
40
40
|
"@types/systemjs": "^6.13.5",
|
|
41
|
+
"dayjs": "^1.11.10",
|
|
41
42
|
"path-browserify": "^1.0.1",
|
|
42
43
|
"pinia": "^2.1.7",
|
|
43
44
|
"qs": "^6.11.2",
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
"@ibiz-template/core": "^0.2.13",
|
|
52
53
|
"@ibiz-template/runtime": "^0.2.13",
|
|
53
54
|
"@ibiz/model-core": "^0.0.20",
|
|
55
|
+
"dayjs": "^1.11.10",
|
|
54
56
|
"path-browserify": "^1.0.1",
|
|
55
57
|
"pinia": "^2.1.7",
|
|
56
58
|
"qs": "^6.11.1",
|
|
@@ -59,5 +61,5 @@
|
|
|
59
61
|
"vue": "^3.3.4",
|
|
60
62
|
"vue-router": "^4.2.4"
|
|
61
63
|
},
|
|
62
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "048f2b8e3e692cbc26b79dcea56e8d867e3e9c9f"
|
|
63
65
|
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
IEditorController,
|
|
5
5
|
IEditorProvider,
|
|
6
6
|
PanelItemController,
|
|
7
|
+
PanelItemEventName,
|
|
7
8
|
} from '@ibiz-template/runtime';
|
|
8
9
|
import { IPanelField } from '@ibiz/model-core';
|
|
9
10
|
import { PanelFieldState } from './panel-field.state';
|
|
@@ -126,5 +127,48 @@ export class PanelFieldController
|
|
|
126
127
|
if (this.dataParent.setDataValue) {
|
|
127
128
|
await this.dataParent.setDataValue(name!, value);
|
|
128
129
|
}
|
|
130
|
+
this.panel.evt.emit('onPanelItemEvent', {
|
|
131
|
+
panelItemName: this.model.id!,
|
|
132
|
+
panelItemEventName: PanelItemEventName.CHANGE,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 聚焦事件
|
|
138
|
+
* @author lxm
|
|
139
|
+
* @date 2023-10-11 05:03:26
|
|
140
|
+
*/
|
|
141
|
+
onFocus(event: MouseEvent): void {
|
|
142
|
+
this.panel.evt.emit('onPanelItemEvent', {
|
|
143
|
+
panelItemName: this.model.id!,
|
|
144
|
+
panelItemEventName: PanelItemEventName.FOCUS,
|
|
145
|
+
event,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 失焦事件
|
|
151
|
+
* @author lxm
|
|
152
|
+
* @date 2023-10-11 05:03:26
|
|
153
|
+
*/
|
|
154
|
+
onBlur(event: MouseEvent): void {
|
|
155
|
+
this.panel.evt.emit('onPanelItemEvent', {
|
|
156
|
+
panelItemName: this.model.id!,
|
|
157
|
+
panelItemEventName: PanelItemEventName.BLUR,
|
|
158
|
+
event,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 回车事件
|
|
164
|
+
* @author lxm
|
|
165
|
+
* @date 2023-10-11 05:03:26
|
|
166
|
+
*/
|
|
167
|
+
onEnter(event: MouseEvent): void {
|
|
168
|
+
this.panel.evt.emit('onPanelItemEvent', {
|
|
169
|
+
panelItemName: this.model.id!,
|
|
170
|
+
panelItemEventName: PanelItemEventName.ENTER,
|
|
171
|
+
event,
|
|
172
|
+
});
|
|
129
173
|
}
|
|
130
174
|
}
|
|
@@ -49,6 +49,9 @@ export const PanelField = defineComponent({
|
|
|
49
49
|
class: this.ns.b('content'),
|
|
50
50
|
readonly: this.controller.model.editor!.readOnly,
|
|
51
51
|
onChange: this.onValueChange,
|
|
52
|
+
onFocus: (event: MouseEvent) => this.controller.onFocus(event),
|
|
53
|
+
onBlur: (event: MouseEvent) => this.controller.onBlur(event),
|
|
54
|
+
onEnter: (event: MouseEvent) => this.controller.onEnter(event),
|
|
52
55
|
};
|
|
53
56
|
if (this.$slots.default) {
|
|
54
57
|
editor = this.$slots.default(editorProps);
|
|
@@ -34,7 +34,7 @@ export function getEditorProps<C>() {
|
|
|
34
34
|
* 获取编辑器通用emits
|
|
35
35
|
*
|
|
36
36
|
* @author lxm
|
|
37
|
-
* @date 2022-11-
|
|
37
|
+
* @date 2022-11-03 19:11:04
|
|
38
38
|
* @export
|
|
39
39
|
* @template V
|
|
40
40
|
* @returns {*}
|
|
@@ -44,9 +44,11 @@ export function getEditorEmits<V>() {
|
|
|
44
44
|
/** 值变更事件 */
|
|
45
45
|
change: (_value: V, _name?: string) => true,
|
|
46
46
|
/** 失焦事件 */
|
|
47
|
-
blur: () => true,
|
|
47
|
+
blur: (_event?: IData) => true,
|
|
48
48
|
/** 聚焦事件 */
|
|
49
|
-
focus: () => true,
|
|
49
|
+
focus: (_event?: IData) => true,
|
|
50
|
+
/** 回车事件 */
|
|
51
|
+
enter: (_event?: IData) => true,
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
import { IPortalAsyncAction } from '@ibiz-template/core';
|
|
1
2
|
import { defineStore } from 'pinia';
|
|
2
|
-
import { reactive } from 'vue';
|
|
3
|
+
import { reactive, Ref } from 'vue';
|
|
4
|
+
import { useAsyncAction } from '../async-action/async-action';
|
|
3
5
|
|
|
4
|
-
export interface IAppStore {
|
|
6
|
+
export interface IAppStore {
|
|
7
|
+
allAsyncActions: Ref<IPortalAsyncAction[]>;
|
|
8
|
+
recentAsyncActions: IPortalAsyncAction[];
|
|
9
|
+
}
|
|
5
10
|
|
|
6
11
|
export const useAppStore = defineStore('appStore', () => {
|
|
7
|
-
const
|
|
12
|
+
const { allAsyncActions, recentAsyncActions } = useAsyncAction();
|
|
13
|
+
const appStore = reactive<IAppStore>({
|
|
14
|
+
allAsyncActions,
|
|
15
|
+
get recentAsyncActions() {
|
|
16
|
+
return recentAsyncActions.value;
|
|
17
|
+
},
|
|
18
|
+
});
|
|
8
19
|
|
|
9
20
|
return { appStore };
|
|
10
21
|
});
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
|
+
|
|
3
|
+
import { IPortalAsyncAction, IPortalMessage } from '@ibiz-template/core';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import { isNumber } from 'lodash-es';
|
|
6
|
+
import { computed, onUnmounted, ref } from 'vue';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 格式化数据
|
|
10
|
+
* @author lxm
|
|
11
|
+
* @date 2023-11-14 09:02:49
|
|
12
|
+
* @param {IPortalAsyncAction} data
|
|
13
|
+
* @return {*} {IPortalAsyncAction}
|
|
14
|
+
*/
|
|
15
|
+
function formatAsyncAction(data: IPortalAsyncAction): IPortalAsyncAction {
|
|
16
|
+
// 处理时间日期为毫秒值时,转换成字符串。
|
|
17
|
+
const dateFields = [
|
|
18
|
+
'begintime',
|
|
19
|
+
'endtime',
|
|
20
|
+
'createdate',
|
|
21
|
+
'updatedate',
|
|
22
|
+
] as const;
|
|
23
|
+
dateFields.forEach(key => {
|
|
24
|
+
if (isNumber(data[key])) {
|
|
25
|
+
data[key] = dayjs(data[key]).format('YYYY-MM-DD HH:mm:ss');
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 使用异步操作消息
|
|
33
|
+
* @author lxm
|
|
34
|
+
* @date 2023-11-14 03:17:28
|
|
35
|
+
* @export
|
|
36
|
+
* @return {*}
|
|
37
|
+
*/
|
|
38
|
+
export function useAsyncAction() {
|
|
39
|
+
/** 所有消息数据 */
|
|
40
|
+
const allAsyncActions = ref<IPortalAsyncAction[]>([]);
|
|
41
|
+
/** 显示的长度 */
|
|
42
|
+
const showLength = ref(0);
|
|
43
|
+
|
|
44
|
+
/** 显示的消息数据 */
|
|
45
|
+
const recentAsyncActions = computed(() => {
|
|
46
|
+
return allAsyncActions.value.filter(
|
|
47
|
+
(_item, index) => index < showLength.value,
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const load = async () => {
|
|
52
|
+
const res = await ibiz.asyncAction.fetch();
|
|
53
|
+
allAsyncActions.value = res.data;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 异步消息变更回调处理
|
|
58
|
+
* @author lxm
|
|
59
|
+
* @date 2023-11-14 03:53:08
|
|
60
|
+
*/
|
|
61
|
+
const asyncActionCallBack = (msg: IPortalMessage) => {
|
|
62
|
+
if (!msg.data || msg.subtype !== 'ASYNCACTION') {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const asyncAction = formatAsyncAction(msg.data as IPortalAsyncAction);
|
|
66
|
+
const findIndex = allAsyncActions.value.findIndex(
|
|
67
|
+
item => item.asyncacitonid === asyncAction.asyncacitonid,
|
|
68
|
+
);
|
|
69
|
+
if (findIndex !== -1) {
|
|
70
|
+
// 不存在的数据补充到最开始,并显示长度加一
|
|
71
|
+
allAsyncActions.value.unshift(asyncAction);
|
|
72
|
+
showLength.value += 1;
|
|
73
|
+
} else {
|
|
74
|
+
const isShow = findIndex >= showLength.value;
|
|
75
|
+
// 找的到但是不在显示列表里,移到开头,并增加长度
|
|
76
|
+
if (isShow) {
|
|
77
|
+
allAsyncActions.value.splice(findIndex, 1);
|
|
78
|
+
allAsyncActions.value.unshift(asyncAction);
|
|
79
|
+
showLength.value += 1;
|
|
80
|
+
} else {
|
|
81
|
+
allAsyncActions.value.splice(findIndex, 1, asyncAction);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// *初始化操作
|
|
87
|
+
load();
|
|
88
|
+
|
|
89
|
+
// 监听异步操作消息变更
|
|
90
|
+
ibiz.mc.command.asyncAction.on(asyncActionCallBack);
|
|
91
|
+
// 销毁时删除监听
|
|
92
|
+
onUnmounted(() => {
|
|
93
|
+
ibiz.mc.command.asyncAction.off(asyncActionCallBack);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return { allAsyncActions, recentAsyncActions };
|
|
97
|
+
}
|