@gct-paas/design 0.1.6-dev.3 → 0.1.6-dev.30
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/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/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/create-app-vue.d.ts +1 -1
- package/es/create-app-vue.mjs +1 -1
- 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 +11 -5
- package/es/hooks/design-view/designer/useDesignSave.d.ts +2 -2
- package/es/hooks/design-view/designer/useDesignSave.mjs +131 -21
- package/es/hooks/design-view/layout/useToolkit.d.ts +1 -1
- package/es/hooks/design-view/layout/useToolkit.mjs +123 -82
- package/es/hooks/design-view/page/usePage.d.ts +12 -7
- package/es/hooks/design-view/page/usePage.mjs +131 -8
- package/es/hooks/design-view/useDesigner.d.ts +6 -2
- package/es/hooks/design-view/useDesigner.mjs +14 -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.d.ts +1 -0
- package/es/index.mjs +10 -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/props/design-plugin-props.d.ts +64 -0
- package/es/props/design-plugin-props.mjs +59 -0
- package/es/props/index.d.ts +1 -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/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/package.json +11 -11
- 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
|
@@ -22,11 +22,9 @@ import { getWidgetInfo } from "@gct-paas/schema";
|
|
|
22
22
|
var widgetInfo = computed(() => {
|
|
23
23
|
return getWidgetInfo(platform.value);
|
|
24
24
|
});
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/** 设计页面JSON */
|
|
29
|
-
var pageJson = reactive({
|
|
25
|
+
/** 当前设计页面基础信息 */
|
|
26
|
+
var pageInfo = ref({});
|
|
27
|
+
var defaultPageJson = {
|
|
30
28
|
id: "",
|
|
31
29
|
keepAlive: false,
|
|
32
30
|
pageEvents: {},
|
|
@@ -45,7 +43,9 @@ var pageJson = reactive({
|
|
|
45
43
|
hasFooter: void 0
|
|
46
44
|
},
|
|
47
45
|
pageLayoutMode: pageLayoutModeEnum.SHOW_ALL_DATA
|
|
48
|
-
}
|
|
46
|
+
};
|
|
47
|
+
/** 设计页面JSON */
|
|
48
|
+
var pageJson = reactive(cloneDeep(defaultPageJson));
|
|
49
49
|
/** 页面数据快照,用于脏检查对比 */
|
|
50
50
|
var pageJsonSnapshot = ref("");
|
|
51
51
|
/** 界面数据是否修改过,通过对比快照和当前数据判断 */
|
|
@@ -100,4 +100,4 @@ function transformPageJson(json, isClone = false) {
|
|
|
100
100
|
return _json;
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
|
-
export { isModified, loading, methodMap, modalDesignId, modalDesignState, modalInfo, noMore, pageDesignHistoryList, pageJson, pageJsonSnapshot, pageNo, pluginConfigs, regRoot, subTableModalId, subTableModalState, transformPageJson, wfNodesModalId, wfNodesModalState, widgetInfo, workflowModalId, workflowModalState };
|
|
103
|
+
export { defaultPageJson, isModified, loading, methodMap, modalDesignId, modalDesignState, modalInfo, noMore, pageDesignHistoryList, pageInfo, pageJson, pageJsonSnapshot, pageNo, pluginConfigs, regRoot, subTableModalId, subTableModalState, transformPageJson, wfNodesModalId, wfNodesModalState, widgetInfo, workflowModalId, workflowModalState };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { pageJson } from "../design-state.mjs";
|
|
2
|
+
import { useUserOccupy } from "../components/useUserOccupy.mjs";
|
|
2
3
|
import { useScope } from "../layout/useScope.mjs";
|
|
3
4
|
import { useCacheHistory } from "../../develop/useCacheHistory.mjs";
|
|
4
5
|
import { useSelectedWidget } from "../widget/useSelectedWidget.mjs";
|
|
5
6
|
import "../../index.mjs";
|
|
6
|
-
import { useUserOccupy } from "../../../components/user-occupy/useUserOccupy.mjs";
|
|
7
|
-
import "../../../components/index.mjs";
|
|
8
7
|
//#region src/hooks/design-view/designer/useDesignCache.ts
|
|
9
8
|
/**
|
|
10
9
|
* 缓存撤销重做 Hook
|
|
@@ -19,7 +18,7 @@ function useDesignCache() {
|
|
|
19
18
|
* 缓存步骤,组件拖入布局画板时更新历史记录
|
|
20
19
|
*/
|
|
21
20
|
function emitCache() {
|
|
22
|
-
const id = _gct.store.context.
|
|
21
|
+
const id = _gct.store.context.pid;
|
|
23
22
|
historyUtils.addHistory({
|
|
24
23
|
historyId: id,
|
|
25
24
|
past: JSON.stringify(pageJson)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { platform } from "../../../utils/design-view/index.mjs";
|
|
2
2
|
import "../design-state.mjs";
|
|
3
|
-
import { Platform, openWindow, stringifyMatrixParams } from "@gct-paas/core";
|
|
3
|
+
import { EnvironmentType, Platform, openWindow, stringifyMatrixParams } from "@gct-paas/core";
|
|
4
4
|
import { ref } from "vue";
|
|
5
5
|
import { useDebounceFn } from "@vueuse/core";
|
|
6
6
|
//#region src/hooks/design-view/designer/useDesignPreview.ts
|
|
@@ -28,12 +28,17 @@ function useDesignPreview() {
|
|
|
28
28
|
*
|
|
29
29
|
* @param {IObject} params 预览参数
|
|
30
30
|
*/
|
|
31
|
-
function basicPreview({ pid, webUrl, mobileUrl, padUrl }) {
|
|
31
|
+
function basicPreview({ pid, webUrl, mobileUrl, padUrl, env }) {
|
|
32
32
|
const matrixParams = {
|
|
33
33
|
aid: _gct.store.context.aid,
|
|
34
|
-
bid: _gct.store.context.bid
|
|
34
|
+
bid: _gct.store.context.bid,
|
|
35
|
+
env: env || _gct.env.getEnv()
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
+
let hasUrl = `/PagePreview/${pid}`;
|
|
38
|
+
if (_gct.store.context.scene === "txn") {
|
|
39
|
+
matrixParams.scene = "txn";
|
|
40
|
+
hasUrl = `/TxnPagePreview/${pid}`;
|
|
41
|
+
}
|
|
37
42
|
if (platform.value === Platform.MOBILE) openWindow(buildPreviewUrl(mobileUrl, hasUrl, matrixParams), {
|
|
38
43
|
noopener: false,
|
|
39
44
|
noreferrer: false,
|
|
@@ -78,7 +83,8 @@ function useDesignPreview() {
|
|
|
78
83
|
const _doPreviewSandbox = () => {
|
|
79
84
|
basicPreview({
|
|
80
85
|
pid: _gct.store.context.pid,
|
|
81
|
-
|
|
86
|
+
env: EnvironmentType.SANDBOX,
|
|
87
|
+
webUrl: "/web-render/",
|
|
82
88
|
mobileUrl: "/mobile-sandbox/",
|
|
83
89
|
padUrl: "/pad-sandbox/"
|
|
84
90
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PageJson, RuntimePageJson } from '@gct-paas/schema';
|
|
2
2
|
export declare function useDesignSave(): {
|
|
3
|
-
save: (flag?: boolean, showSuccess?: boolean) => Promise<boolean>;
|
|
3
|
+
save: (flag?: boolean, showSuccess?: boolean, isTxn?: boolean) => Promise<boolean>;
|
|
4
4
|
validateWidgets: (widgets: IData[], parents?: IData[]) => boolean;
|
|
5
5
|
savePageJsonSnapshot: (json?: PageJson) => void;
|
|
6
6
|
};
|
|
@@ -9,4 +9,4 @@ export declare function useDesignSave(): {
|
|
|
9
9
|
*
|
|
10
10
|
* @returns {Promise<RuntimePageJson>} 运行时页面JSON
|
|
11
11
|
*/
|
|
12
|
-
export declare function buildRuntimeJson(): Promise<RuntimePageJson>;
|
|
12
|
+
export declare function buildRuntimeJson(source?: PageJson): Promise<RuntimePageJson>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { platform } from "../../../utils/design-view/index.mjs";
|
|
2
2
|
import { buildRunJs } from "../../../utils/transform-js/transform-js.mjs";
|
|
3
3
|
import "../../../utils/index.mjs";
|
|
4
|
-
import { noMore, pageDesignHistoryList, pageJson, pageJsonSnapshot, pageNo, regRoot, transformPageJson, widgetInfo } from "../design-state.mjs";
|
|
5
|
-
import { useUserOccupy } from "
|
|
6
|
-
import "
|
|
7
|
-
import { isArray, isEmpty, isNil } from "lodash-es";
|
|
4
|
+
import { defaultPageJson, noMore, pageDesignHistoryList, pageInfo, pageJson, pageJsonSnapshot, pageNo, regRoot, transformPageJson, widgetInfo } from "../design-state.mjs";
|
|
5
|
+
import { useUserOccupy } from "../components/useUserOccupy.mjs";
|
|
6
|
+
import { cloneDeep, isArray, isEmpty, isNil } from "lodash-es";
|
|
8
7
|
import { Platform, SearchComponents, TreeHelper, t } from "@gct-paas/core";
|
|
9
8
|
import { message } from "ant-design-vue";
|
|
10
9
|
//#region src/hooks/design-view/designer/useDesignSave.ts
|
|
@@ -14,6 +13,30 @@ import { message } from "ant-design-vue";
|
|
|
14
13
|
* 管理设计器页面数据的保存、预处理和校验逻辑,
|
|
15
14
|
* 包括组件必填校验、数值范围校验、运行时 JSON 构建等。
|
|
16
15
|
*/
|
|
16
|
+
function deepFindPlugins(widgets) {
|
|
17
|
+
const items = [];
|
|
18
|
+
widgets.forEach((widget) => {
|
|
19
|
+
if (widget._plugin) items.push({
|
|
20
|
+
key: widget._plugin.key,
|
|
21
|
+
version: widget._plugin.version,
|
|
22
|
+
url: widget._plugin.url
|
|
23
|
+
});
|
|
24
|
+
if (widget.children && widget.children.length > 0) items.push(...deepFindPlugins(widget.children));
|
|
25
|
+
});
|
|
26
|
+
return items;
|
|
27
|
+
}
|
|
28
|
+
function getDefaultTxnDetailPageJson() {
|
|
29
|
+
return {
|
|
30
|
+
newDesigner: true,
|
|
31
|
+
style: {
|
|
32
|
+
paddingAll: "",
|
|
33
|
+
paddingTop: "",
|
|
34
|
+
paddingRight: "16",
|
|
35
|
+
paddingBottom: "16",
|
|
36
|
+
paddingLeft: "16"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
17
40
|
function useDesignSave() {
|
|
18
41
|
const { cancelOccupy } = useUserOccupy();
|
|
19
42
|
/**
|
|
@@ -90,13 +113,66 @@ function useDesignSave() {
|
|
|
90
113
|
return true;
|
|
91
114
|
}
|
|
92
115
|
/**
|
|
116
|
+
* 保存前预处理并校验单个 pageJson
|
|
117
|
+
*/
|
|
118
|
+
function preparePageJsonForSave(json) {
|
|
119
|
+
const _pageJson = transformPageJson(json, true);
|
|
120
|
+
if (validateWidgets(_pageJson.widgets) === false) return false;
|
|
121
|
+
if (_pageJson.widgets.some((n) => n.type === "data-list")) _pageJson.widgets.forEach((item) => {
|
|
122
|
+
if (item.type === "data-list" && !item.props.showFieldExp) item.props.showFieldExpVal = "";
|
|
123
|
+
});
|
|
124
|
+
if (validateWidgets(_pageJson.modals) === false) return false;
|
|
125
|
+
if (_pageJson.modals.length) _pageJson.modals.forEach((item) => {
|
|
126
|
+
if (!item.props.hasFooter) item.children = item.children.filter((n) => {
|
|
127
|
+
return n?.type !== "bottom-button-container";
|
|
128
|
+
});
|
|
129
|
+
if (item.props.hasFooter && item.children.some((n) => n?.type === "modalFooter")) item.children = item.children.filter((n) => {
|
|
130
|
+
return n?.type !== "modalFooter";
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
_pageJson.plugins = collectPlugins(_pageJson);
|
|
134
|
+
return _pageJson;
|
|
135
|
+
}
|
|
136
|
+
function collectPlugins(_pageJson) {
|
|
137
|
+
const plugins = [];
|
|
138
|
+
plugins.push(...deepFindPlugins(_pageJson.widgets));
|
|
139
|
+
if (_pageJson.modals) _pageJson.modals.forEach((modal) => {
|
|
140
|
+
if (modal.children) modal.children.forEach((item) => {
|
|
141
|
+
plugins.push(...deepFindPlugins(item.children));
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
return plugins;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 根据 txnPageMode 解析创建页 / 详情页两份 pageJson
|
|
148
|
+
*/
|
|
149
|
+
function resolveTxnPageJsonPair() {
|
|
150
|
+
if (pageInfo.value.txnPageMode === "create") return {
|
|
151
|
+
createPageJson: pageJson,
|
|
152
|
+
detailPageJson: pageInfo.value.detailDesignerJson ? JSON.parse(pageInfo.value.detailDesignerJson) : getDefaultTxnDetailPageJson()
|
|
153
|
+
};
|
|
154
|
+
return {
|
|
155
|
+
createPageJson: pageInfo.value._designerJson ? JSON.parse(pageInfo.value._designerJson) : cloneDeep(defaultPageJson),
|
|
156
|
+
detailPageJson: pageJson
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async function preparePagePayload(json) {
|
|
160
|
+
const prepared = preparePageJsonForSave(json);
|
|
161
|
+
if (!prepared) return false;
|
|
162
|
+
return {
|
|
163
|
+
designerJson: prepared,
|
|
164
|
+
runtimeJson: await buildRuntimeJson(prepared)
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
93
168
|
* 保存完成解除占用
|
|
94
169
|
*
|
|
95
170
|
* @param {boolean} flag 是否为保存操作(true为保存,false为恢复)
|
|
96
171
|
* @param {boolean} showSuccess 是否显示成功提示
|
|
97
172
|
* @returns {Promise<boolean>} 是否保存成功
|
|
98
173
|
*/
|
|
99
|
-
async function save(flag = true, showSuccess = true) {
|
|
174
|
+
async function save(flag = true, showSuccess = true, isTxn = false) {
|
|
175
|
+
if (isTxn) return saveTxn(flag, showSuccess);
|
|
100
176
|
const pageId = _gct.store.context.pid;
|
|
101
177
|
const _pageJson = transformPageJson(pageJson);
|
|
102
178
|
if (validateWidgets(_pageJson.widgets) === false) return false;
|
|
@@ -155,6 +231,42 @@ function useDesignSave() {
|
|
|
155
231
|
logId: (pageDesignHistoryList.value[0] ?? {}).id
|
|
156
232
|
});
|
|
157
233
|
savePageJsonSnapshot(_pageJson);
|
|
234
|
+
if (showSuccess) _gct.message.success(flag ? t("sys.saveSuccess") : t("sys.recoverSuccess"));
|
|
235
|
+
cancelOccupy();
|
|
236
|
+
noMore.value = false;
|
|
237
|
+
pageNo.value = 1;
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* 保存完成解除占用
|
|
242
|
+
*
|
|
243
|
+
* @param {boolean} flag 是否为保存操作(true为保存,false为恢复)
|
|
244
|
+
* @param {boolean} showSuccess 是否显示成功提示
|
|
245
|
+
* @returns {Promise<boolean>} 是否保存成功
|
|
246
|
+
*/
|
|
247
|
+
async function saveTxn(flag = true, showSuccess = true) {
|
|
248
|
+
const pageId = _gct.store.context.pid;
|
|
249
|
+
const { createPageJson, detailPageJson } = resolveTxnPageJsonPair();
|
|
250
|
+
const createPayload = await preparePagePayload(createPageJson);
|
|
251
|
+
if (!createPayload) return false;
|
|
252
|
+
const detailPayload = await preparePagePayload(detailPageJson);
|
|
253
|
+
if (!detailPayload) return false;
|
|
254
|
+
const { designerJson: _designerJson, runtimeJson } = createPayload;
|
|
255
|
+
const { designerJson: _detailDesignerJson, runtimeJson: detailRuntimeJson } = detailPayload;
|
|
256
|
+
pageInfo.value._designerJson = JSON.stringify(_designerJson);
|
|
257
|
+
pageInfo.value.detailDesignerJson = JSON.stringify(_detailDesignerJson);
|
|
258
|
+
await _api.apaas.transaction.putUpdateVersionByIdId({ id: pageId }, {
|
|
259
|
+
designerJson: JSON.stringify(_designerJson),
|
|
260
|
+
runtimeJson: JSON.stringify(runtimeJson),
|
|
261
|
+
detailDesignerJson: JSON.stringify(_detailDesignerJson),
|
|
262
|
+
detailRuntimeJson: JSON.stringify(detailRuntimeJson),
|
|
263
|
+
modelKey: pageInfo.value.modelKey,
|
|
264
|
+
name: pageInfo.value.name,
|
|
265
|
+
version: pageInfo.value.version,
|
|
266
|
+
default: pageInfo.value.default,
|
|
267
|
+
key: pageInfo.value.key
|
|
268
|
+
});
|
|
269
|
+
savePageJsonSnapshot(pageInfo.value.txnPageMode === "create" ? _designerJson : _detailDesignerJson);
|
|
158
270
|
if (showSuccess) _gct.message.success(flag ? "sys.saveSuccess" : "sys.recoverSuccess");
|
|
159
271
|
cancelOccupy();
|
|
160
272
|
noMore.value = false;
|
|
@@ -172,13 +284,11 @@ function useDesignSave() {
|
|
|
172
284
|
*
|
|
173
285
|
* @returns {Promise<RuntimePageJson>} 运行时页面JSON
|
|
174
286
|
*/
|
|
175
|
-
async function buildRuntimeJson() {
|
|
287
|
+
async function buildRuntimeJson(source = pageJson) {
|
|
176
288
|
try {
|
|
177
|
-
const runtimeWidgets = TreeHelper.traverseAndBuildTree(JSON.parse(JSON.stringify(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const funcStr = await buildRunJs(pageJson.js);
|
|
181
|
-
const modals = pageJson.modals.map(async (modal) => {
|
|
289
|
+
const runtimeWidgets = TreeHelper.traverseAndBuildTree(JSON.parse(JSON.stringify(source.widgets)), (node) => findWidgetCallback(node));
|
|
290
|
+
const funcStr = await buildRunJs(source.js);
|
|
291
|
+
const modals = source.modals.map(async (modal) => {
|
|
182
292
|
const modalFuncStr = await buildRunJs(modal.js);
|
|
183
293
|
const runtimeWidgets = TreeHelper.traverseAndBuildTree(JSON.parse(JSON.stringify(modal.children)), (node) => findWidgetCallback(node, modal));
|
|
184
294
|
return {
|
|
@@ -197,16 +307,16 @@ async function buildRuntimeJson() {
|
|
|
197
307
|
widgets: runtimeWidgets,
|
|
198
308
|
runJs: funcStr,
|
|
199
309
|
modals: await Promise.all(modals),
|
|
200
|
-
css:
|
|
201
|
-
keepAlive:
|
|
202
|
-
globalEvents:
|
|
203
|
-
pageEvents:
|
|
204
|
-
permissions:
|
|
205
|
-
pageStyle:
|
|
206
|
-
pageConfig:
|
|
207
|
-
pageVars:
|
|
208
|
-
plugins:
|
|
209
|
-
pageLayoutMode:
|
|
310
|
+
css: source.css,
|
|
311
|
+
keepAlive: source.keepAlive,
|
|
312
|
+
globalEvents: source.globalEvents,
|
|
313
|
+
pageEvents: source.pageEvents,
|
|
314
|
+
permissions: source.permissions,
|
|
315
|
+
pageStyle: source.style,
|
|
316
|
+
pageConfig: source.pageConfig,
|
|
317
|
+
pageVars: source.pageVars,
|
|
318
|
+
plugins: source.plugins,
|
|
319
|
+
pageLayoutMode: source.pageLayoutMode
|
|
210
320
|
};
|
|
211
321
|
} catch (error) {
|
|
212
322
|
message.warn(t("sys.pageDesigner.codeError"));
|
|
@@ -392,7 +392,7 @@ export declare function useToolkit(): {
|
|
|
392
392
|
}[];
|
|
393
393
|
}[]>;
|
|
394
394
|
initToolkitWidgets: () => void;
|
|
395
|
-
changeToolkitWidgets: ({ data, modalState }: IObject) => void;
|
|
395
|
+
changeToolkitWidgets: ({ data, modalState, isTxn }: IObject) => void;
|
|
396
396
|
fixedToolkit: () => void;
|
|
397
397
|
setFieldToolkit: ({ modelKey, formId, childParentModelKey, }: {
|
|
398
398
|
modelKey: string;
|
|
@@ -15,6 +15,108 @@ 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
|
+
/** 按分组上下文存储分类组件映射,仅保留现有两套逻辑 */
|
|
20
|
+
static _categoryCompsMap = {
|
|
21
|
+
default: {
|
|
22
|
+
[CategoryTypeEnum.FORM]: [
|
|
23
|
+
FormComponents.GenRadio,
|
|
24
|
+
FormComponents.GenCheckbox,
|
|
25
|
+
FormComponents.GenSwitch,
|
|
26
|
+
FormComponents.Text,
|
|
27
|
+
FormComponents.GenImage,
|
|
28
|
+
FormComponents.Form
|
|
29
|
+
],
|
|
30
|
+
[CategoryTypeEnum.LAYOUT]: [
|
|
31
|
+
FormComponents.Collapse,
|
|
32
|
+
FormComponents.SpaceOccupation,
|
|
33
|
+
FormComponents.Divider,
|
|
34
|
+
FormComponents.ButtonContainer,
|
|
35
|
+
FormComponents.LayoutContainer,
|
|
36
|
+
FormComponents.Grid,
|
|
37
|
+
FormComponents.LeftRightColumns,
|
|
38
|
+
FormComponents.Tabs
|
|
39
|
+
],
|
|
40
|
+
[CategoryTypeEnum.ADVANCED]: [
|
|
41
|
+
FormComponents.Search,
|
|
42
|
+
FormComponents.QuickSearch,
|
|
43
|
+
FormComponents.SelectSearch,
|
|
44
|
+
FormComponents.TableSelect,
|
|
45
|
+
FormComponents.Iframe,
|
|
46
|
+
FormComponents.CustomCode
|
|
47
|
+
],
|
|
48
|
+
[CategoryTypeEnum.PROCESS]: [
|
|
49
|
+
FormComponents.FormProcess,
|
|
50
|
+
FormComponents.ProcessButton,
|
|
51
|
+
FormComponents.ButtonProcessContainer,
|
|
52
|
+
FormComponents.ApprovalHistory,
|
|
53
|
+
FormComponents.FlowDiagram
|
|
54
|
+
],
|
|
55
|
+
[CategoryTypeEnum.BUTTON]: [
|
|
56
|
+
FormComponents.CustomButton,
|
|
57
|
+
FormComponents.SubmitButton,
|
|
58
|
+
FormComponents.RefreshButton,
|
|
59
|
+
FormComponents.ResetButton,
|
|
60
|
+
FormComponents.LabelPrintButton
|
|
61
|
+
],
|
|
62
|
+
[CategoryTypeEnum.DATA]: [
|
|
63
|
+
FormComponents.CardList,
|
|
64
|
+
FormComponents.DataTable,
|
|
65
|
+
FormComponents.DataVTable,
|
|
66
|
+
FormComponents.TreeTable,
|
|
67
|
+
FormComponents.RefDataTable,
|
|
68
|
+
FormComponents.Descriptions
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
SubTableGroup: {
|
|
72
|
+
[CategoryTypeEnum.FORM]: [
|
|
73
|
+
FormComponents.GenRadio,
|
|
74
|
+
FormComponents.GenCheckbox,
|
|
75
|
+
FormComponents.GenSwitch,
|
|
76
|
+
FormComponents.Text,
|
|
77
|
+
FormComponents.GenImage
|
|
78
|
+
],
|
|
79
|
+
[CategoryTypeEnum.LAYOUT]: [
|
|
80
|
+
FormComponents.Collapse,
|
|
81
|
+
FormComponents.SpaceOccupation,
|
|
82
|
+
FormComponents.Divider,
|
|
83
|
+
FormComponents.LayoutContainer,
|
|
84
|
+
FormComponents.Grid,
|
|
85
|
+
FormComponents.LeftRightColumns,
|
|
86
|
+
FormComponents.Tabs
|
|
87
|
+
],
|
|
88
|
+
[CategoryTypeEnum.ADVANCED]: [FormComponents.Iframe, FormComponents.CustomCode],
|
|
89
|
+
[CategoryTypeEnum.PROCESS]: [],
|
|
90
|
+
[CategoryTypeEnum.BUTTON]: [],
|
|
91
|
+
[CategoryTypeEnum.DATA]: []
|
|
92
|
+
},
|
|
93
|
+
TxnPageGroup: {
|
|
94
|
+
[CategoryTypeEnum.FORM]: [
|
|
95
|
+
FormComponents.GenRadio,
|
|
96
|
+
FormComponents.GenCheckbox,
|
|
97
|
+
FormComponents.GenSwitch,
|
|
98
|
+
FormComponents.Text,
|
|
99
|
+
FormComponents.GenImage,
|
|
100
|
+
FormComponents.Form
|
|
101
|
+
],
|
|
102
|
+
[CategoryTypeEnum.LAYOUT]: [
|
|
103
|
+
FormComponents.Collapse,
|
|
104
|
+
FormComponents.SpaceOccupation,
|
|
105
|
+
FormComponents.Divider,
|
|
106
|
+
FormComponents.LayoutContainer,
|
|
107
|
+
FormComponents.Grid,
|
|
108
|
+
FormComponents.LeftRightColumns,
|
|
109
|
+
FormComponents.Tabs
|
|
110
|
+
],
|
|
111
|
+
[CategoryTypeEnum.BUTTON]: [
|
|
112
|
+
FormComponents.CustomButton,
|
|
113
|
+
FormComponents.SubmitButton,
|
|
114
|
+
FormComponents.RefreshButton,
|
|
115
|
+
FormComponents.ResetButton
|
|
116
|
+
],
|
|
117
|
+
[CategoryTypeEnum.DATA]: [FormComponents.DataTable, FormComponents.Descriptions]
|
|
118
|
+
}
|
|
119
|
+
};
|
|
18
120
|
static _instance;
|
|
19
121
|
/** 当前所处的组件分组上下文 */
|
|
20
122
|
groupType = "";
|
|
@@ -30,6 +132,12 @@ var instance = class ComponentUtils {
|
|
|
30
132
|
CategoryTypeEnum.LAYOUT,
|
|
31
133
|
CategoryTypeEnum.ADVANCED
|
|
32
134
|
];
|
|
135
|
+
if (this.groupType === ComponentUtils.TxnPageGroup) return [
|
|
136
|
+
CategoryTypeEnum.FORM,
|
|
137
|
+
CategoryTypeEnum.LAYOUT,
|
|
138
|
+
CategoryTypeEnum.BUTTON,
|
|
139
|
+
CategoryTypeEnum.DATA
|
|
140
|
+
];
|
|
33
141
|
return [
|
|
34
142
|
CategoryTypeEnum.FORM,
|
|
35
143
|
CategoryTypeEnum.LAYOUT,
|
|
@@ -47,92 +155,17 @@ var instance = class ComponentUtils {
|
|
|
47
155
|
* @returns 当前上下文下允许使用的组件枚举值列表
|
|
48
156
|
*/
|
|
49
157
|
_getCompsForCategory(categoryType) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
case CategoryTypeEnum.FORM:
|
|
53
|
-
if (isSubTable) return [
|
|
54
|
-
FormComponents.GenRadio,
|
|
55
|
-
FormComponents.GenCheckbox,
|
|
56
|
-
FormComponents.GenSwitch,
|
|
57
|
-
FormComponents.Text,
|
|
58
|
-
FormComponents.GenImage
|
|
59
|
-
];
|
|
60
|
-
return [
|
|
61
|
-
FormComponents.GenRadio,
|
|
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 [];
|
|
127
|
-
}
|
|
158
|
+
const groupKey = this.groupType === ComponentUtils.SubTableGroup ? "SubTableGroup" : this.groupType === ComponentUtils.TxnPageGroup ? "TxnPageGroup" : "default";
|
|
159
|
+
return ComponentUtils._categoryCompsMap[groupKey][categoryType] ?? [];
|
|
128
160
|
}
|
|
129
161
|
/**
|
|
130
162
|
* 根据所处分组上下文更新 groupType
|
|
131
163
|
*
|
|
132
164
|
* @param data - 当前选中组件数据
|
|
133
165
|
* @param modalState - 是否处于子表单(弹框)状态
|
|
166
|
+
* @param isTxn - 是否处于事务页面状态
|
|
134
167
|
*/
|
|
135
|
-
changeGroupType({ data, modalState }) {
|
|
168
|
+
changeGroupType({ data, modalState, isTxn }) {
|
|
136
169
|
if (data.type === FormComponents.CardList) {
|
|
137
170
|
this._setGroupType(ComponentUtils.CardListGroup);
|
|
138
171
|
return;
|
|
@@ -141,6 +174,10 @@ var instance = class ComponentUtils {
|
|
|
141
174
|
this._setGroupType(ComponentUtils.SubTableGroup);
|
|
142
175
|
return;
|
|
143
176
|
}
|
|
177
|
+
if (isTxn) {
|
|
178
|
+
this._setGroupType(ComponentUtils.TxnPageGroup);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
144
181
|
this._setGroupType("");
|
|
145
182
|
}
|
|
146
183
|
/** 更新组件分组上下文 */
|
|
@@ -179,7 +216,10 @@ var instance = class ComponentUtils {
|
|
|
179
216
|
_buildKitCategory(platform, suiteKey) {
|
|
180
217
|
const design = this._getDesignerRegister(platform);
|
|
181
218
|
const list = !suiteKey ? [] : design.getProviders().filter((designer) => {
|
|
182
|
-
if (designer.kit && designer.kit.length > 0)
|
|
219
|
+
if (designer.kit && designer.kit.length > 0) {
|
|
220
|
+
if (designer.kit.includes("*")) return true;
|
|
221
|
+
return designer.kit.includes(suiteKey);
|
|
222
|
+
}
|
|
183
223
|
return false;
|
|
184
224
|
}).map((designer) => designer.schema);
|
|
185
225
|
return {
|
|
@@ -257,11 +297,12 @@ function useToolkit() {
|
|
|
257
297
|
});
|
|
258
298
|
}
|
|
259
299
|
/** 根据当前选中组件的上下文刷新组件列表 */
|
|
260
|
-
function changeToolkitWidgets({ data, modalState }) {
|
|
300
|
+
function changeToolkitWidgets({ data, modalState, isTxn }) {
|
|
261
301
|
const oldGroupType = instance.groupType;
|
|
262
302
|
instance.changeGroupType({
|
|
263
303
|
data,
|
|
264
|
-
modalState
|
|
304
|
+
modalState,
|
|
305
|
+
isTxn
|
|
265
306
|
});
|
|
266
307
|
if (oldGroupType !== instance.groupType) toolkitWidgets.value = instance.getWidgetsToolkit({
|
|
267
308
|
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,15 @@ 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
|
+
* @param mode 切换模式
|
|
47
|
+
*/
|
|
48
|
+
export declare function toggleTxnPageInfo(mode: 'create' | 'detail'): Promise<void>;
|
|
43
49
|
/**
|
|
44
50
|
* 初始化界面占用信息
|
|
45
51
|
*/
|
|
@@ -54,4 +60,3 @@ export declare function usePage(): {
|
|
|
54
60
|
togglePanel: typeof togglePanel;
|
|
55
61
|
initLockState: typeof initLockState;
|
|
56
62
|
};
|
|
57
|
-
export {};
|