@gct-paas/design 0.1.6-dev.9 → 6.0.0-dev.2
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/README.md +157 -0
- package/dist/index.min.css +1 -1
- package/dist/loader.esm.min.js +2 -1
- package/es/components/field-transfer/components/field-transfer-modal.vue.mjs +2 -2
- package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_style_index_0_scoped_2f34388d_lang.css +8 -0
- package/es/components/index.d.ts +0 -4
- package/es/components/index.mjs +0 -5
- package/es/components/mobile-container/mobile-container.d.ts +2 -2
- package/es/components/multi-field/multi-field-display.vue.mjs +2 -2
- package/es/components/multi-field/multi-field-display.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/es/components/multi-field/{multi-field-display.vue_vue_type_style_index_0_scoped_802ade7b_lang.css → multi-field-display.vue_vue_type_style_index_0_scoped_83390705_lang.css} +1 -1
- package/es/components/user-occupy/index.d.ts +0 -1
- package/es/components/user-occupy/index.mjs +0 -1
- package/es/components/user-occupy/user-lock.vue.mjs +2 -2
- package/es/components/user-occupy/user-lock.vue_vue_type_script_setup_true_lang.mjs +2 -1
- package/es/components/user-occupy/user-lock.vue_vue_type_style_index_0_scoped_143659f6_lang.css +29 -0
- package/es/components/user-occupy/user-occupy.vue.mjs +2 -2
- package/es/components/user-occupy/user-occupy.vue_vue_type_script_setup_true_lang.mjs +2 -1
- package/es/components/user-occupy/{user-occupy.vue_vue_type_style_index_0_scoped_9b136922_lang.css → user-occupy.vue_vue_type_style_index_0_scoped_1234af11_lang.css} +6 -6
- package/es/constant/index.d.ts +5 -0
- package/es/constant/index.mjs +6 -1
- package/es/constant/page-designer.d.ts +9 -36
- package/es/constant/page-designer.mjs +2 -32
- package/es/{components/user-occupy → hooks/design-view/components}/useUserOccupy.d.ts +3 -3
- package/es/{components/user-occupy → hooks/design-view/components}/useUserOccupy.mjs +48 -27
- package/es/hooks/design-view/design-state.d.ts +91 -1
- package/es/hooks/design-view/design-state.mjs +7 -7
- package/es/hooks/design-view/designer/useDesignCache.mjs +2 -3
- package/es/hooks/design-view/designer/useDesignPreview.mjs +15 -5
- package/es/hooks/design-view/designer/useDesignSave.d.ts +2 -2
- package/es/hooks/design-view/designer/useDesignSave.mjs +160 -23
- package/es/hooks/design-view/layout/useToolkit.d.ts +1 -1
- package/es/hooks/design-view/layout/useToolkit.mjs +166 -82
- package/es/hooks/design-view/page/usePage.d.ts +17 -7
- package/es/hooks/design-view/page/usePage.mjs +205 -9
- package/es/hooks/design-view/useDesigner.d.ts +7 -2
- package/es/hooks/design-view/useDesigner.mjs +25 -3
- package/es/hooks/design-view/widget/useSelectedWidget.mjs +55 -28
- package/es/hooks/design-view/widget/useWidget.mjs +2 -1
- package/es/hooks/index.d.ts +1 -1
- package/es/hooks/index.mjs +1 -1
- package/es/index.mjs +9 -12
- package/es/interface/index.d.ts +0 -1
- package/es/locale/auto-register.d.ts +2 -0
- package/es/locale/auto-register.mjs +25 -0
- package/es/locale/sys/app.mjs +6 -0
- package/es/locale/sys/appDesigner.mjs +9 -0
- package/es/locale/sys/cardDesign.d.ts +4 -4
- package/es/locale/sys/cardDesign.mjs +17 -0
- package/es/locale/sys/component.mjs +21 -0
- package/es/locale/sys/model.mjs +10 -0
- package/es/locale/sys/pageDesigner.mjs +32 -0
- package/es/locale/sys/platform.mjs +11 -0
- package/es/locale/sys.d.ts +7 -5
- package/es/locale/sys.mjs +26 -0
- package/es/register/designer-register/designer-register.d.ts +6 -3
- package/es/register/designer-register/designer-register.mjs +20 -14
- package/es/register/index.d.ts +1 -0
- package/es/register/index.mjs +1 -0
- package/es/register/props-editor/props-editor.register.d.ts +24 -0
- package/es/register/props-editor/props-editor.register.mjs +30 -0
- package/es/schema/begin-drag/begin-drag.mjs +1 -1
- package/es/schema/common-config/common-field-editor-config.mjs +7 -3
- package/es/schema/common-config/display-editor-config.mjs +2 -2
- package/es/schema/field/index.mjs +17 -3
- package/es/setup-app.d.ts +2 -1
- package/es/setup-app.mjs +3 -1
- package/es/types/index.d.ts +2 -1
- package/es/utils/design-interceptors/design-interceptors.mjs +1 -1
- package/package.json +12 -12
- package/es/components/design-save-tip/design-save-tip.css +0 -107
- package/es/components/design-save-tip/design-save-tip.d.ts +0 -44
- package/es/components/design-save-tip/design-save-tip.mjs +0 -81
- package/es/components/design-step-check/design-step-check.css +0 -133
- package/es/components/design-step-check/design-step-check.d.ts +0 -30
- package/es/components/design-step-check/design-step-check.mjs +0 -96
- package/es/components/design-view-layout/design-view-layout.css +0 -157
- package/es/components/design-view-layout/design-view-layout.d.ts +0 -1
- package/es/components/design-view-layout/design-view-layout.mjs +0 -139
- package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_style_index_0_scoped_711e6992_lang.css +0 -8
- package/es/components/modal-name-editor/modal-name-editor.css +0 -117
- package/es/components/modal-name-editor/modal-name-editor.d.ts +0 -34
- package/es/components/modal-name-editor/modal-name-editor.mjs +0 -124
- package/es/components/user-occupy/occupy.const.d.ts +0 -4
- package/es/components/user-occupy/occupy.const.mjs +0 -7
- package/es/components/user-occupy/user-lock.vue_vue_type_style_index_0_scoped_b40d46ff_lang.css +0 -29
- package/es/hooks/develop/useKeyParser.d.ts +0 -16
- package/es/hooks/develop/useKeyParser.mjs +0 -79
- package/es/interface/i-view-step/i-view-step.d.ts +0 -32
|
@@ -2,7 +2,7 @@ import { useWidgetRegistry } from "../widget/useWidgetRegistry.mjs";
|
|
|
2
2
|
import { useModelField } from "../../use-model-field/use-model-field.mjs";
|
|
3
3
|
import "../../index.mjs";
|
|
4
4
|
import { clone, cloneDeep } from "lodash-es";
|
|
5
|
-
import { CategoryTypeEnum, FormComponents, Platform, ToolkitEnum } from "@gct-paas/core";
|
|
5
|
+
import { CategoryTypeEnum, ContextSceneEnum, FormComponents, Platform, ToolkitEnum } from "@gct-paas/core";
|
|
6
6
|
import { ref } from "vue";
|
|
7
7
|
import { getWidgetInfo } from "@gct-paas/schema";
|
|
8
8
|
//#region src/hooks/design-view/layout/useToolkit.ts
|
|
@@ -15,6 +15,129 @@ var toolkitPinned = ref(false);
|
|
|
15
15
|
var instance = class ComponentUtils {
|
|
16
16
|
static SubTableGroup = "SubTableGroup";
|
|
17
17
|
static CardListGroup = "CardListGroup";
|
|
18
|
+
static TxnPageGroup = "TxnPageGroup";
|
|
19
|
+
static DetailPageGroup = "DetailPageGroup";
|
|
20
|
+
/** 按分组上下文存储分类组件映射,仅保留现有两套逻辑 */
|
|
21
|
+
static _categoryCompsMap = {
|
|
22
|
+
default: {
|
|
23
|
+
[CategoryTypeEnum.FORM]: [
|
|
24
|
+
FormComponents.GenRadio,
|
|
25
|
+
FormComponents.GenCheckbox,
|
|
26
|
+
FormComponents.GenSwitch,
|
|
27
|
+
FormComponents.Text,
|
|
28
|
+
FormComponents.GenImage,
|
|
29
|
+
FormComponents.Form
|
|
30
|
+
],
|
|
31
|
+
[CategoryTypeEnum.LAYOUT]: [
|
|
32
|
+
FormComponents.Collapse,
|
|
33
|
+
FormComponents.SpaceOccupation,
|
|
34
|
+
FormComponents.Divider,
|
|
35
|
+
FormComponents.ButtonContainer,
|
|
36
|
+
FormComponents.LayoutContainer,
|
|
37
|
+
FormComponents.Grid,
|
|
38
|
+
FormComponents.LeftRightColumns,
|
|
39
|
+
FormComponents.Tabs
|
|
40
|
+
],
|
|
41
|
+
[CategoryTypeEnum.ADVANCED]: [
|
|
42
|
+
FormComponents.Search,
|
|
43
|
+
FormComponents.QuickSearch,
|
|
44
|
+
FormComponents.SelectSearch,
|
|
45
|
+
FormComponents.TableSelect,
|
|
46
|
+
FormComponents.Iframe,
|
|
47
|
+
FormComponents.CustomCode
|
|
48
|
+
],
|
|
49
|
+
[CategoryTypeEnum.PROCESS]: [
|
|
50
|
+
FormComponents.FormProcess,
|
|
51
|
+
FormComponents.ProcessButton,
|
|
52
|
+
FormComponents.ButtonProcessContainer,
|
|
53
|
+
FormComponents.ApprovalHistory,
|
|
54
|
+
FormComponents.FlowDiagram
|
|
55
|
+
],
|
|
56
|
+
[CategoryTypeEnum.BUTTON]: [
|
|
57
|
+
FormComponents.CustomButton,
|
|
58
|
+
FormComponents.SubmitButton,
|
|
59
|
+
FormComponents.RefreshButton,
|
|
60
|
+
FormComponents.ResetButton,
|
|
61
|
+
FormComponents.LabelPrintButton
|
|
62
|
+
],
|
|
63
|
+
[CategoryTypeEnum.DATA]: [
|
|
64
|
+
FormComponents.CardList,
|
|
65
|
+
FormComponents.DataTable,
|
|
66
|
+
FormComponents.DataVTable,
|
|
67
|
+
FormComponents.TreeTable,
|
|
68
|
+
FormComponents.RefDataTable,
|
|
69
|
+
FormComponents.Descriptions
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
SubTableGroup: {
|
|
73
|
+
[CategoryTypeEnum.FORM]: [
|
|
74
|
+
FormComponents.GenRadio,
|
|
75
|
+
FormComponents.GenCheckbox,
|
|
76
|
+
FormComponents.GenSwitch,
|
|
77
|
+
FormComponents.Text,
|
|
78
|
+
FormComponents.GenImage
|
|
79
|
+
],
|
|
80
|
+
[CategoryTypeEnum.LAYOUT]: [
|
|
81
|
+
FormComponents.Collapse,
|
|
82
|
+
FormComponents.SpaceOccupation,
|
|
83
|
+
FormComponents.Divider,
|
|
84
|
+
FormComponents.LayoutContainer,
|
|
85
|
+
FormComponents.Grid,
|
|
86
|
+
FormComponents.LeftRightColumns,
|
|
87
|
+
FormComponents.Tabs
|
|
88
|
+
],
|
|
89
|
+
[CategoryTypeEnum.ADVANCED]: [FormComponents.Iframe, FormComponents.CustomCode],
|
|
90
|
+
[CategoryTypeEnum.PROCESS]: [],
|
|
91
|
+
[CategoryTypeEnum.BUTTON]: [],
|
|
92
|
+
[CategoryTypeEnum.DATA]: []
|
|
93
|
+
},
|
|
94
|
+
TxnPageGroup: {
|
|
95
|
+
[CategoryTypeEnum.FORM]: [
|
|
96
|
+
FormComponents.GenRadio,
|
|
97
|
+
FormComponents.GenCheckbox,
|
|
98
|
+
FormComponents.GenSwitch,
|
|
99
|
+
FormComponents.Text,
|
|
100
|
+
FormComponents.GenImage,
|
|
101
|
+
FormComponents.Form
|
|
102
|
+
],
|
|
103
|
+
[CategoryTypeEnum.LAYOUT]: [
|
|
104
|
+
FormComponents.Collapse,
|
|
105
|
+
FormComponents.SpaceOccupation,
|
|
106
|
+
FormComponents.Divider,
|
|
107
|
+
FormComponents.LayoutContainer,
|
|
108
|
+
FormComponents.Grid,
|
|
109
|
+
FormComponents.LeftRightColumns,
|
|
110
|
+
FormComponents.Tabs
|
|
111
|
+
],
|
|
112
|
+
[CategoryTypeEnum.BUTTON]: [
|
|
113
|
+
FormComponents.CustomButton,
|
|
114
|
+
FormComponents.SubmitButton,
|
|
115
|
+
FormComponents.RefreshButton,
|
|
116
|
+
FormComponents.ResetButton
|
|
117
|
+
],
|
|
118
|
+
[CategoryTypeEnum.DATA]: [FormComponents.DataTable, FormComponents.Descriptions]
|
|
119
|
+
},
|
|
120
|
+
DetailPageGroup: {
|
|
121
|
+
[CategoryTypeEnum.FORM]: [
|
|
122
|
+
FormComponents.GenRadio,
|
|
123
|
+
FormComponents.GenCheckbox,
|
|
124
|
+
FormComponents.GenSwitch,
|
|
125
|
+
FormComponents.Text,
|
|
126
|
+
FormComponents.GenImage,
|
|
127
|
+
FormComponents.Form
|
|
128
|
+
],
|
|
129
|
+
[CategoryTypeEnum.LAYOUT]: [
|
|
130
|
+
FormComponents.Collapse,
|
|
131
|
+
FormComponents.SpaceOccupation,
|
|
132
|
+
FormComponents.Divider,
|
|
133
|
+
FormComponents.LayoutContainer,
|
|
134
|
+
FormComponents.Grid,
|
|
135
|
+
FormComponents.LeftRightColumns,
|
|
136
|
+
FormComponents.Tabs
|
|
137
|
+
],
|
|
138
|
+
[CategoryTypeEnum.DATA]: [FormComponents.DataTable, FormComponents.Descriptions]
|
|
139
|
+
}
|
|
140
|
+
};
|
|
18
141
|
static _instance;
|
|
19
142
|
/** 当前所处的组件分组上下文 */
|
|
20
143
|
groupType = "";
|
|
@@ -30,6 +153,18 @@ var instance = class ComponentUtils {
|
|
|
30
153
|
CategoryTypeEnum.LAYOUT,
|
|
31
154
|
CategoryTypeEnum.ADVANCED
|
|
32
155
|
];
|
|
156
|
+
if (this.groupType === ComponentUtils.TxnPageGroup) return [
|
|
157
|
+
CategoryTypeEnum.FORM,
|
|
158
|
+
CategoryTypeEnum.LAYOUT,
|
|
159
|
+
CategoryTypeEnum.BUTTON,
|
|
160
|
+
CategoryTypeEnum.DATA
|
|
161
|
+
];
|
|
162
|
+
if (this.groupType === ComponentUtils.DetailPageGroup) return [
|
|
163
|
+
CategoryTypeEnum.FORM,
|
|
164
|
+
CategoryTypeEnum.LAYOUT,
|
|
165
|
+
CategoryTypeEnum.DATA,
|
|
166
|
+
CategoryTypeEnum.KIT
|
|
167
|
+
];
|
|
33
168
|
return [
|
|
34
169
|
CategoryTypeEnum.FORM,
|
|
35
170
|
CategoryTypeEnum.LAYOUT,
|
|
@@ -47,92 +182,29 @@ var instance = class ComponentUtils {
|
|
|
47
182
|
* @returns 当前上下文下允许使用的组件枚举值列表
|
|
48
183
|
*/
|
|
49
184
|
_getCompsForCategory(categoryType) {
|
|
50
|
-
|
|
51
|
-
switch (
|
|
52
|
-
case
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
FormComponents.GenCheckbox,
|
|
63
|
-
FormComponents.GenSwitch,
|
|
64
|
-
FormComponents.Text,
|
|
65
|
-
FormComponents.GenImage,
|
|
66
|
-
FormComponents.Form
|
|
67
|
-
];
|
|
68
|
-
case CategoryTypeEnum.LAYOUT:
|
|
69
|
-
if (isSubTable) return [
|
|
70
|
-
FormComponents.Collapse,
|
|
71
|
-
FormComponents.SpaceOccupation,
|
|
72
|
-
FormComponents.Divider,
|
|
73
|
-
FormComponents.LayoutContainer,
|
|
74
|
-
FormComponents.Grid,
|
|
75
|
-
FormComponents.LeftRightColumns,
|
|
76
|
-
FormComponents.Tabs
|
|
77
|
-
];
|
|
78
|
-
return [
|
|
79
|
-
FormComponents.Collapse,
|
|
80
|
-
FormComponents.SpaceOccupation,
|
|
81
|
-
FormComponents.Divider,
|
|
82
|
-
FormComponents.ButtonContainer,
|
|
83
|
-
FormComponents.LayoutContainer,
|
|
84
|
-
FormComponents.Grid,
|
|
85
|
-
FormComponents.LeftRightColumns,
|
|
86
|
-
FormComponents.Tabs
|
|
87
|
-
];
|
|
88
|
-
case CategoryTypeEnum.ADVANCED:
|
|
89
|
-
if (isSubTable) return [FormComponents.Iframe, FormComponents.CustomCode];
|
|
90
|
-
return [
|
|
91
|
-
FormComponents.Search,
|
|
92
|
-
FormComponents.QuickSearch,
|
|
93
|
-
FormComponents.SelectSearch,
|
|
94
|
-
FormComponents.TableSelect,
|
|
95
|
-
FormComponents.Iframe,
|
|
96
|
-
FormComponents.CustomCode
|
|
97
|
-
];
|
|
98
|
-
case CategoryTypeEnum.PROCESS:
|
|
99
|
-
if (isSubTable) return [];
|
|
100
|
-
return [
|
|
101
|
-
FormComponents.FormProcess,
|
|
102
|
-
FormComponents.ProcessButton,
|
|
103
|
-
FormComponents.ButtonProcessContainer,
|
|
104
|
-
FormComponents.ApprovalHistory,
|
|
105
|
-
FormComponents.FlowDiagram
|
|
106
|
-
];
|
|
107
|
-
case CategoryTypeEnum.BUTTON:
|
|
108
|
-
if (isSubTable) return [];
|
|
109
|
-
return [
|
|
110
|
-
FormComponents.CustomButton,
|
|
111
|
-
FormComponents.SubmitButton,
|
|
112
|
-
FormComponents.RefreshButton,
|
|
113
|
-
FormComponents.ResetButton,
|
|
114
|
-
FormComponents.LabelPrintButton
|
|
115
|
-
];
|
|
116
|
-
case CategoryTypeEnum.DATA:
|
|
117
|
-
if (isSubTable) return [];
|
|
118
|
-
return [
|
|
119
|
-
FormComponents.CardList,
|
|
120
|
-
FormComponents.DataTable,
|
|
121
|
-
FormComponents.DataVTable,
|
|
122
|
-
FormComponents.TreeTable,
|
|
123
|
-
FormComponents.RefDataTable,
|
|
124
|
-
FormComponents.Descriptions
|
|
125
|
-
];
|
|
126
|
-
default: return [];
|
|
185
|
+
let groupKey;
|
|
186
|
+
switch (this.groupType) {
|
|
187
|
+
case ComponentUtils.SubTableGroup:
|
|
188
|
+
groupKey = "SubTableGroup";
|
|
189
|
+
break;
|
|
190
|
+
case ComponentUtils.TxnPageGroup:
|
|
191
|
+
groupKey = "TxnPageGroup";
|
|
192
|
+
break;
|
|
193
|
+
case ComponentUtils.DetailPageGroup:
|
|
194
|
+
groupKey = "DetailPageGroup";
|
|
195
|
+
break;
|
|
196
|
+
default: groupKey = "default";
|
|
127
197
|
}
|
|
198
|
+
return ComponentUtils._categoryCompsMap[groupKey][categoryType] ?? [];
|
|
128
199
|
}
|
|
129
200
|
/**
|
|
130
201
|
* 根据所处分组上下文更新 groupType
|
|
131
202
|
*
|
|
132
203
|
* @param data - 当前选中组件数据
|
|
133
204
|
* @param modalState - 是否处于子表单(弹框)状态
|
|
205
|
+
* @param scene - 修改成场景,目前存在事务和详情两个场景 // _gct.store.context.scene
|
|
134
206
|
*/
|
|
135
|
-
changeGroupType({ data, modalState }) {
|
|
207
|
+
changeGroupType({ data, modalState, scene }) {
|
|
136
208
|
if (data.type === FormComponents.CardList) {
|
|
137
209
|
this._setGroupType(ComponentUtils.CardListGroup);
|
|
138
210
|
return;
|
|
@@ -141,6 +213,14 @@ var instance = class ComponentUtils {
|
|
|
141
213
|
this._setGroupType(ComponentUtils.SubTableGroup);
|
|
142
214
|
return;
|
|
143
215
|
}
|
|
216
|
+
if (scene === ContextSceneEnum.TXN) {
|
|
217
|
+
this._setGroupType(ComponentUtils.TxnPageGroup);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (scene === ContextSceneEnum.DETAIL) {
|
|
221
|
+
this._setGroupType(ComponentUtils.DetailPageGroup);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
144
224
|
this._setGroupType("");
|
|
145
225
|
}
|
|
146
226
|
/** 更新组件分组上下文 */
|
|
@@ -179,7 +259,10 @@ var instance = class ComponentUtils {
|
|
|
179
259
|
_buildKitCategory(platform, suiteKey) {
|
|
180
260
|
const design = this._getDesignerRegister(platform);
|
|
181
261
|
const list = !suiteKey ? [] : design.getProviders().filter((designer) => {
|
|
182
|
-
if (designer.kit && designer.kit.length > 0)
|
|
262
|
+
if (designer.kit && designer.kit.length > 0) {
|
|
263
|
+
if (designer.kit.includes("*")) return true;
|
|
264
|
+
return designer.kit.includes(suiteKey);
|
|
265
|
+
}
|
|
183
266
|
return false;
|
|
184
267
|
}).map((designer) => designer.schema);
|
|
185
268
|
return {
|
|
@@ -257,11 +340,12 @@ function useToolkit() {
|
|
|
257
340
|
});
|
|
258
341
|
}
|
|
259
342
|
/** 根据当前选中组件的上下文刷新组件列表 */
|
|
260
|
-
function changeToolkitWidgets({ data, modalState }) {
|
|
343
|
+
function changeToolkitWidgets({ data, modalState, scene }) {
|
|
261
344
|
const oldGroupType = instance.groupType;
|
|
262
345
|
instance.changeGroupType({
|
|
263
346
|
data,
|
|
264
|
-
modalState
|
|
347
|
+
modalState,
|
|
348
|
+
scene
|
|
265
349
|
});
|
|
266
350
|
if (oldGroupType !== instance.groupType) toolkitWidgets.value = instance.getWidgetsToolkit({
|
|
267
351
|
platform: _gct.store.context.platform,
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Ref, App } from 'vue';
|
|
2
2
|
import { PanelEnum } from '@gct-paas/core';
|
|
3
|
-
import { PermissionResponse
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
categoryId?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const pageInfo: Ref<PageInfo>;
|
|
3
|
+
import { PermissionResponse } from '@gct-paas/api/apaas';
|
|
4
|
+
export type { PageInfo } from '../design-state';
|
|
5
|
+
export { pageInfo } from '../design-state';
|
|
9
6
|
export declare const pagePermissions: Ref<{
|
|
10
7
|
createTime?: string | undefined;
|
|
11
8
|
createUserId?: string | undefined;
|
|
@@ -40,6 +37,20 @@ export declare const currentPanel: Ref<PanelEnum>;
|
|
|
40
37
|
* @returns
|
|
41
38
|
*/
|
|
42
39
|
export declare function loadPageInfo(app: App): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* 加载页面信息
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export declare function loadTxnPageInfo(app: App): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* 加载详情页面信息
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadDetailPageInfo(app: App): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* @param mode 切换模式
|
|
52
|
+
*/
|
|
53
|
+
export declare function toggleTxnPageInfo(mode: 'create' | 'detail'): Promise<void>;
|
|
43
54
|
/**
|
|
44
55
|
* 初始化界面占用信息
|
|
45
56
|
*/
|
|
@@ -54,4 +65,3 @@ export declare function usePage(): {
|
|
|
54
65
|
togglePanel: typeof togglePanel;
|
|
55
66
|
initLockState: typeof initLockState;
|
|
56
67
|
};
|
|
57
|
-
export {};
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { PageTypeEnum } from "../../../constant/page-designer.mjs";
|
|
2
|
-
import "../../../constant/index.mjs";
|
|
2
|
+
import { newKeyTag } from "../../../constant/index.mjs";
|
|
3
3
|
import { platform } from "../../../utils/design-view/index.mjs";
|
|
4
4
|
import { DesignPluginPgkUtil } from "../../../utils/design-plugin-pkg-util/design-plugin-pkg-util.mjs";
|
|
5
5
|
import { createWidgetByType } from "../../../utils/schema/index.mjs";
|
|
6
6
|
import "../../../utils/index.mjs";
|
|
7
|
-
import "../design-state.mjs";
|
|
7
|
+
import { pageInfo } from "../design-state.mjs";
|
|
8
|
+
import { useUserOccupy } from "../components/useUserOccupy.mjs";
|
|
8
9
|
import { useCacheHistory } from "../../develop/useCacheHistory.mjs";
|
|
9
10
|
import { useToolkit } from "../layout/useToolkit.mjs";
|
|
10
11
|
import { useDesigner } from "../useDesigner.mjs";
|
|
11
|
-
import { useUserOccupy } from "../../../components/user-occupy/useUserOccupy.mjs";
|
|
12
|
-
import "../../../components/index.mjs";
|
|
13
12
|
import { isEmpty, isNil } from "lodash-es";
|
|
14
|
-
import { FormComponents, KitPkgUtil, PanelEnum, Platform, t } from "@gct-paas/core";
|
|
13
|
+
import { ButtonSize, ButtonStyle, ContextSceneEnum, FormComponents, KitPkgUtil, PanelEnum, Platform, t } from "@gct-paas/core";
|
|
15
14
|
import { computed, createVNode, ref } from "vue";
|
|
16
15
|
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
|
17
16
|
import { Modal } from "ant-design-vue";
|
|
18
17
|
//#region src/hooks/design-view/page/usePage.ts
|
|
19
|
-
var newKeyTag = "___new___";
|
|
20
|
-
var pageInfo = ref({});
|
|
21
18
|
var pagePermissions = ref([]);
|
|
22
|
-
var { setLockInfo, initOccupy, loadOccupyInfo } = useUserOccupy();
|
|
23
19
|
var unlockAvailable = computed(() => {
|
|
24
20
|
const { userId, username } = _gct.store.userInfo;
|
|
25
21
|
return pageInfo.value.lockUserId === userId || username === "admin";
|
|
@@ -113,12 +109,212 @@ async function loadPageInfo(app) {
|
|
|
113
109
|
loadPageDesignHistoryList();
|
|
114
110
|
pagePermissions.value = await _api.apaas.permission.getList({ relationId: _gct.store.context.pid }) || [];
|
|
115
111
|
if (!pid.startsWith("___new___")) initLockState();
|
|
112
|
+
pageJson.pageConfig.title = "新建页";
|
|
116
113
|
savePageJsonSnapshot();
|
|
117
114
|
}
|
|
118
115
|
/**
|
|
116
|
+
* 加载页面信息
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
async function loadTxnPageInfo(app) {
|
|
120
|
+
const { initToolkitWidgets } = useToolkit();
|
|
121
|
+
const { setPageJson, loadPageDesignHistoryList, emitCache, pageJson, setPluginConfigs, savePageJsonSnapshot } = useDesigner();
|
|
122
|
+
const { historyUtils } = useCacheHistory();
|
|
123
|
+
platform.value = _gct.store.context.platform || Platform.WEB;
|
|
124
|
+
const baseid = _gct.store.context.baseid || "";
|
|
125
|
+
const pid = _gct.store.context.pid || "";
|
|
126
|
+
if (baseid) {
|
|
127
|
+
const res = await _api.apaas.transaction.getGetVersionById({ id: baseid });
|
|
128
|
+
pageInfo.value = {
|
|
129
|
+
id: newKeyTag,
|
|
130
|
+
name: res.name,
|
|
131
|
+
key: res.key,
|
|
132
|
+
modelKey: res.modelKey,
|
|
133
|
+
designerJson: "",
|
|
134
|
+
_designerJson: "",
|
|
135
|
+
detailDesignerJson: "",
|
|
136
|
+
txnPageMode: "create",
|
|
137
|
+
baseId: baseid
|
|
138
|
+
};
|
|
139
|
+
} else if (pid.startsWith("___new___")) pageInfo.value = {
|
|
140
|
+
id: newKeyTag,
|
|
141
|
+
name: "",
|
|
142
|
+
key: pid.replace(`${newKeyTag}:`, ""),
|
|
143
|
+
designerJson: "",
|
|
144
|
+
_designerJson: "",
|
|
145
|
+
detailDesignerJson: "",
|
|
146
|
+
txnPageMode: "create"
|
|
147
|
+
};
|
|
148
|
+
else {
|
|
149
|
+
const pageInfoRes = await _api.apaas.transaction.getInfo({ id: _gct.store.context.pid });
|
|
150
|
+
pageInfo.value = pageInfoRes;
|
|
151
|
+
pageInfo.value._designerJson = pageInfoRes.designerJson;
|
|
152
|
+
pageInfo.value.txnPageMode = "create";
|
|
153
|
+
}
|
|
154
|
+
const all = [];
|
|
155
|
+
if (_gct.store.appInfo.suiteKey) all.push(KitPkgUtil.loadDesign(_gct.store.appInfo.suiteKey).then((module) => {
|
|
156
|
+
if (module) module.setupApp(app);
|
|
157
|
+
}));
|
|
158
|
+
const _configs = [];
|
|
159
|
+
all.push(DesignPluginPgkUtil.loadDesignPlugin(app, platform.value, _gct.store.appInfo.suiteKey ? [_gct.store.appInfo.suiteKey] : void 0).then(([configs]) => {
|
|
160
|
+
_configs.push(...configs);
|
|
161
|
+
setPluginConfigs(configs);
|
|
162
|
+
}));
|
|
163
|
+
await Promise.all(all);
|
|
164
|
+
if (!historyUtils.isHistoryInfoExist(_gct.store.context.pid)) historyUtils.init({ historyId: _gct.store.context.pid ?? "" });
|
|
165
|
+
if (pageInfo.value.designerJson && !isNil(pageInfo.value.designerJson) && !isEmpty(pageInfo.value.designerJson)) {
|
|
166
|
+
const _json = JSON.parse(pageInfo.value.designerJson);
|
|
167
|
+
if (_json && _json.plugins) {
|
|
168
|
+
const items = _json.plugins.filter((item) => {
|
|
169
|
+
return _configs.findIndex((config) => config.key === item.key) === -1;
|
|
170
|
+
});
|
|
171
|
+
await DesignPluginPgkUtil.loadDesignDeletedPlugins(platform.value, items);
|
|
172
|
+
}
|
|
173
|
+
if (!_json.pageConfig) _json.pageConfig = {
|
|
174
|
+
title: "",
|
|
175
|
+
i18n: {},
|
|
176
|
+
hasFooter: false
|
|
177
|
+
};
|
|
178
|
+
setPageJson({
|
|
179
|
+
..._json,
|
|
180
|
+
id: pageInfo.value.id
|
|
181
|
+
}, true);
|
|
182
|
+
} else {
|
|
183
|
+
emitCache();
|
|
184
|
+
setPageJson({
|
|
185
|
+
newDesigner: true,
|
|
186
|
+
style: {
|
|
187
|
+
paddingAll: "",
|
|
188
|
+
paddingTop: "",
|
|
189
|
+
paddingRight: "16",
|
|
190
|
+
paddingBottom: "16",
|
|
191
|
+
paddingLeft: "16"
|
|
192
|
+
}
|
|
193
|
+
}, true);
|
|
194
|
+
}
|
|
195
|
+
if (!pageJson.widgets.some((item) => item.type === FormComponents.BottomButtonContainer)) {
|
|
196
|
+
const bottomBtnWidget = createWidgetByType(FormComponents.BottomButtonContainer);
|
|
197
|
+
[FormComponents.TxnCancelButton, FormComponents.TxnConfirmButton].forEach((e) => {
|
|
198
|
+
const data = createWidgetByType(e);
|
|
199
|
+
data.props.parentWidgetId = bottomBtnWidget.id;
|
|
200
|
+
data.props.buttonStyle = ButtonStyle.ORDINARY;
|
|
201
|
+
data.props.size = ButtonSize.DEFAULT;
|
|
202
|
+
data.props.noDelete = true;
|
|
203
|
+
bottomBtnWidget.children?.push(data);
|
|
204
|
+
});
|
|
205
|
+
pageJson.widgets.push(bottomBtnWidget);
|
|
206
|
+
}
|
|
207
|
+
initToolkitWidgets();
|
|
208
|
+
loadPageDesignHistoryList();
|
|
209
|
+
pagePermissions.value = await _api.apaas.permission.getList({ relationId: _gct.store.context.pid }) || [];
|
|
210
|
+
if (!pid.startsWith("___new___")) initLockState();
|
|
211
|
+
pageJson.pageConfig.unitType = "%";
|
|
212
|
+
pageJson.pageConfig.pageWidth = 80;
|
|
213
|
+
savePageJsonSnapshot();
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 加载详情页面信息
|
|
217
|
+
* @returns
|
|
218
|
+
*/
|
|
219
|
+
async function loadDetailPageInfo(app) {
|
|
220
|
+
const { initToolkitWidgets } = useToolkit();
|
|
221
|
+
const { setPageJson, loadPageDesignHistoryList, emitCache, pageJson, setPluginConfigs, savePageJsonSnapshot } = useDesigner();
|
|
222
|
+
const { historyUtils } = useCacheHistory();
|
|
223
|
+
platform.value = _gct.store.context.platform || Platform.WEB;
|
|
224
|
+
const pid = _gct.store.context.pid || "";
|
|
225
|
+
if (pid.startsWith("___new___")) pageInfo.value = {
|
|
226
|
+
id: newKeyTag,
|
|
227
|
+
name: "",
|
|
228
|
+
key: pid.replace(`${newKeyTag}:`, ""),
|
|
229
|
+
designerJson: "",
|
|
230
|
+
_designerJson: "",
|
|
231
|
+
detailDesignerJson: ""
|
|
232
|
+
};
|
|
233
|
+
else {
|
|
234
|
+
const pageInfoRes = await _api.apaas.detailPage.getInfo({ id: _gct.store.context.pid });
|
|
235
|
+
pageInfo.value = pageInfoRes;
|
|
236
|
+
pageInfo.value._designerJson = pageInfoRes.designerJson;
|
|
237
|
+
}
|
|
238
|
+
const all = [];
|
|
239
|
+
if (_gct.store.appInfo.suiteKey) all.push(KitPkgUtil.loadDesign(_gct.store.appInfo.suiteKey).then((module) => {
|
|
240
|
+
if (module) module.setupApp(app);
|
|
241
|
+
}));
|
|
242
|
+
const _configs = [];
|
|
243
|
+
all.push(DesignPluginPgkUtil.loadDesignPlugin(app, platform.value, _gct.store.appInfo.suiteKey ? [_gct.store.appInfo.suiteKey] : void 0).then(([configs]) => {
|
|
244
|
+
_configs.push(...configs);
|
|
245
|
+
setPluginConfigs(configs);
|
|
246
|
+
}));
|
|
247
|
+
await Promise.all(all);
|
|
248
|
+
if (!historyUtils.isHistoryInfoExist(_gct.store.context.pid)) historyUtils.init({ historyId: _gct.store.context.pid ?? "" });
|
|
249
|
+
if (pageInfo.value.designerJson && !isNil(pageInfo.value.designerJson) && !isEmpty(pageInfo.value.designerJson)) {
|
|
250
|
+
const _json = JSON.parse(pageInfo.value.designerJson);
|
|
251
|
+
if (_json && _json.plugins) {
|
|
252
|
+
const items = _json.plugins.filter((item) => {
|
|
253
|
+
return _configs.findIndex((config) => config.key === item.key) === -1;
|
|
254
|
+
});
|
|
255
|
+
await DesignPluginPgkUtil.loadDesignDeletedPlugins(platform.value, items);
|
|
256
|
+
}
|
|
257
|
+
if (!_json.pageConfig) _json.pageConfig = {
|
|
258
|
+
title: "详情",
|
|
259
|
+
i18n: {},
|
|
260
|
+
hasFooter: false
|
|
261
|
+
};
|
|
262
|
+
setPageJson({
|
|
263
|
+
..._json,
|
|
264
|
+
id: pageInfo.value.id
|
|
265
|
+
}, true);
|
|
266
|
+
} else {
|
|
267
|
+
emitCache();
|
|
268
|
+
setPageJson({
|
|
269
|
+
newDesigner: true,
|
|
270
|
+
style: {
|
|
271
|
+
paddingAll: "",
|
|
272
|
+
paddingTop: "",
|
|
273
|
+
paddingRight: "16",
|
|
274
|
+
paddingBottom: "16",
|
|
275
|
+
paddingLeft: "16"
|
|
276
|
+
}
|
|
277
|
+
}, true);
|
|
278
|
+
}
|
|
279
|
+
initToolkitWidgets();
|
|
280
|
+
loadPageDesignHistoryList();
|
|
281
|
+
pagePermissions.value = await _api.apaas.permission.getList({ relationId: _gct.store.context.pid }) || [];
|
|
282
|
+
if (!pid.startsWith("___new___")) initLockState();
|
|
283
|
+
pageJson.pageConfig.title = pageJson.pageConfig.title || "详情";
|
|
284
|
+
pageJson.pageConfig.unitType = "%";
|
|
285
|
+
pageJson.pageConfig.pageWidth = 80;
|
|
286
|
+
savePageJsonSnapshot();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* @param mode 切换模式
|
|
290
|
+
*/
|
|
291
|
+
async function toggleTxnPageInfo(mode) {
|
|
292
|
+
const { setTxnPageJson, pageJson } = useDesigner();
|
|
293
|
+
if (mode === "create") {
|
|
294
|
+
pageInfo.value.detailDesignerJson = JSON.stringify(pageJson);
|
|
295
|
+
pageInfo.value.txnPageMode = mode;
|
|
296
|
+
setTxnPageJson({ ...JSON.parse(pageInfo.value._designerJson) });
|
|
297
|
+
} else {
|
|
298
|
+
pageInfo.value._designerJson = JSON.stringify(pageJson);
|
|
299
|
+
pageInfo.value.txnPageMode = mode;
|
|
300
|
+
setTxnPageJson({ ...pageInfo.value.detailDesignerJson ? JSON.parse(pageInfo.value.detailDesignerJson) : {
|
|
301
|
+
newDesigner: true,
|
|
302
|
+
style: {
|
|
303
|
+
paddingAll: "",
|
|
304
|
+
paddingTop: "",
|
|
305
|
+
paddingRight: "16",
|
|
306
|
+
paddingBottom: "16",
|
|
307
|
+
paddingLeft: "16"
|
|
308
|
+
}
|
|
309
|
+
} });
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
119
313
|
* 初始化界面占用信息
|
|
120
314
|
*/
|
|
121
315
|
function initLockState() {
|
|
316
|
+
if (_gct.store.context.scene === ContextSceneEnum.TXN || _gct.store.context.scene === ContextSceneEnum.DETAIL) return;
|
|
317
|
+
const { setLockInfo, initOccupy, loadOccupyInfo } = useUserOccupy();
|
|
122
318
|
initOccupy({
|
|
123
319
|
id: _gct.store.context.pid || "",
|
|
124
320
|
type: (platform.value === Platform.WEB ? PageTypeEnum.WEB : platform.value === Platform.PAD ? PageTypeEnum.PAD : PageTypeEnum.MOBILE).toString()
|
|
@@ -166,4 +362,4 @@ function usePage() {
|
|
|
166
362
|
};
|
|
167
363
|
}
|
|
168
364
|
//#endregion
|
|
169
|
-
export { currentPanel,
|
|
365
|
+
export { currentPanel, loadDetailPageInfo, loadPageInfo, loadTxnPageInfo, lockPage, pagePermissions, togglePanel, toggleTxnPageInfo, unlockAvailable, usePage };
|
|
@@ -1069,6 +1069,9 @@ export declare function useDesigner(): {
|
|
|
1069
1069
|
title?: string | undefined;
|
|
1070
1070
|
} | undefined;
|
|
1071
1071
|
hasFooter?: boolean | undefined;
|
|
1072
|
+
unitType?: "px" | "%" | undefined;
|
|
1073
|
+
pageWidth?: number | undefined;
|
|
1074
|
+
independentDetailPage?: boolean | undefined;
|
|
1072
1075
|
};
|
|
1073
1076
|
pageVars: {
|
|
1074
1077
|
id: string;
|
|
@@ -1091,8 +1094,10 @@ export declare function useDesigner(): {
|
|
|
1091
1094
|
methodMap: import('vue').Ref<import('@gct-paas/schema').ExportMethod, import('@gct-paas/schema').ExportMethod>;
|
|
1092
1095
|
checkWidgetMove: () => boolean;
|
|
1093
1096
|
handleAddDrag: (newIndex: number, childrenList: LowCodeWidget.BasicSchema[], scope: SCOPE, formID?: string) => void;
|
|
1094
|
-
setPageJson: (json: PageJson) => Promise<void>;
|
|
1095
|
-
|
|
1097
|
+
setPageJson: (json: PageJson, hasFooter?: boolean) => Promise<void>;
|
|
1098
|
+
setTxnPageJson: (json: PageJson, hasFooter?: boolean) => Promise<void>;
|
|
1099
|
+
setDetailPageJson: (json: PageJson, hasFooter?: boolean) => Promise<void>;
|
|
1100
|
+
save: (flag?: boolean, showSuccess?: boolean, scene?: string) => Promise<boolean>;
|
|
1096
1101
|
savePageJsonSnapshot: (json?: PageJson) => void;
|
|
1097
1102
|
emitCache: () => void;
|
|
1098
1103
|
undoOrRestore: (content: string) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { platform } from "../../utils/design-view/index.mjs";
|
|
2
2
|
import { initMethodMap } from "../../utils/transform-js/transform-js.mjs";
|
|
3
3
|
import "../../utils/index.mjs";
|
|
4
|
-
import { methodMap, pageJson } from "./design-state.mjs";
|
|
4
|
+
import { defaultPageJson, methodMap, pageJson } from "./design-state.mjs";
|
|
5
5
|
import { useDesignModal } from "./designer/useDesignModal.mjs";
|
|
6
6
|
import { useDesignPreview } from "./designer/useDesignPreview.mjs";
|
|
7
7
|
import { useWidgetRegistry } from "./widget/useWidgetRegistry.mjs";
|
|
@@ -38,14 +38,34 @@ function useDesigner() {
|
|
|
38
38
|
/**
|
|
39
39
|
* 设置设计器的 pageJSON
|
|
40
40
|
*/
|
|
41
|
-
async function setPageJson(json) {
|
|
42
|
-
pageJson.pageConfig.hasFooter = platform.value === Platform.MOBILE || platform.value === Platform.PAD;
|
|
41
|
+
async function setPageJson(json, hasFooter = false) {
|
|
42
|
+
pageJson.pageConfig.hasFooter = hasFooter || platform.value === Platform.MOBILE || platform.value === Platform.PAD;
|
|
43
43
|
Object.assign(pageJson, json);
|
|
44
44
|
initMethodMap(pageJson.js).then((map) => {
|
|
45
45
|
methodMap.value = map;
|
|
46
46
|
});
|
|
47
47
|
cache.emitCache();
|
|
48
48
|
}
|
|
49
|
+
async function setTxnPageJson(json, hasFooter = false) {
|
|
50
|
+
pageJson.pageConfig.hasFooter = hasFooter || platform.value === Platform.MOBILE || platform.value === Platform.PAD;
|
|
51
|
+
Object.assign(pageJson, defaultPageJson, json);
|
|
52
|
+
initMethodMap(pageJson.js).then((map) => {
|
|
53
|
+
methodMap.value = map;
|
|
54
|
+
});
|
|
55
|
+
if (!pageJson.pageConfig.unitType) pageJson.pageConfig.unitType = "%";
|
|
56
|
+
if (!pageJson.pageConfig.pageWidth) pageJson.pageConfig.pageWidth = 80;
|
|
57
|
+
cache.emitCache();
|
|
58
|
+
}
|
|
59
|
+
async function setDetailPageJson(json, hasFooter = false) {
|
|
60
|
+
pageJson.pageConfig.hasFooter = hasFooter || platform.value === Platform.MOBILE || platform.value === Platform.PAD;
|
|
61
|
+
Object.assign(pageJson, defaultPageJson, json);
|
|
62
|
+
initMethodMap(pageJson.js).then((map) => {
|
|
63
|
+
methodMap.value = map;
|
|
64
|
+
});
|
|
65
|
+
if (!pageJson.pageConfig.unitType) pageJson.pageConfig.unitType = "%";
|
|
66
|
+
if (!pageJson.pageConfig.pageWidth) pageJson.pageConfig.pageWidth = 80;
|
|
67
|
+
cache.emitCache();
|
|
68
|
+
}
|
|
49
69
|
/** 检查是否可以拖拽进入的方法,比如某些组件不能拖到某些组件内 */
|
|
50
70
|
function checkWidgetMove() {
|
|
51
71
|
return true;
|
|
@@ -66,6 +86,8 @@ function useDesigner() {
|
|
|
66
86
|
checkWidgetMove,
|
|
67
87
|
handleAddDrag,
|
|
68
88
|
setPageJson,
|
|
89
|
+
setTxnPageJson,
|
|
90
|
+
setDetailPageJson,
|
|
69
91
|
save: saveHook.save,
|
|
70
92
|
savePageJsonSnapshot: saveHook.savePageJsonSnapshot,
|
|
71
93
|
emitCache: cache.emitCache,
|