@gct-paas/design 6.0.0-dev.1 → 6.0.0-dev.11
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/loader.esm.min.js +2 -2
- package/es/hooks/design-view/components/useUserOccupy.mjs +2 -1
- package/es/hooks/design-view/designer/useDesignHistory.mjs +2 -1
- package/es/hooks/design-view/designer/useDesignPreview.mjs +7 -3
- package/es/hooks/design-view/designer/useDesignSave.d.ts +1 -1
- package/es/hooks/design-view/designer/useDesignSave.mjs +33 -4
- package/es/hooks/design-view/global/useGlobal.d.ts +3 -3
- package/es/hooks/design-view/global/useGlobal.mjs +24 -9
- package/es/hooks/design-view/layout/useToolkit.d.ts +1 -1
- package/es/hooks/design-view/layout/useToolkit.mjs +49 -7
- package/es/hooks/design-view/page/usePage.d.ts +6 -1
- package/es/hooks/design-view/page/usePage.mjs +83 -8
- package/es/hooks/design-view/useDesigner.d.ts +1 -1
- package/es/index.mjs +2 -2
- package/es/schema/common-config/common-field-editor-config.mjs +7 -3
- package/es/schema/common-config/display-editor-config.mjs +1 -1
- package/es/schema/modal/modal.mjs +3 -4
- package/package.json +11 -11
|
@@ -138,8 +138,9 @@ function _useUserOccupy() {
|
|
|
138
138
|
async function lock() {
|
|
139
139
|
if (occupyInfo.value.occupyId) return;
|
|
140
140
|
if (lockInfo.value.id) return;
|
|
141
|
+
const sthText = i18nKeyMap[params.type] || "sys.page";
|
|
141
142
|
Modal.confirm({
|
|
142
|
-
title: t("sys.sureToLockSth", { sth: t(
|
|
143
|
+
title: t("sys.sureToLockSth", { sth: t(sthText) }),
|
|
143
144
|
icon: createVNode(ExclamationCircleOutlined),
|
|
144
145
|
okText: t("sys.ok"),
|
|
145
146
|
cancelText: t("sys.cancel"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { platform } from "../../../utils/design-view/index.mjs";
|
|
2
2
|
import "../design-state.mjs";
|
|
3
|
-
import { EnvironmentType, Platform, openWindow, stringifyMatrixParams } from "@gct-paas/core";
|
|
3
|
+
import { ContextSceneEnum, 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
|
|
@@ -35,9 +35,13 @@ function useDesignPreview() {
|
|
|
35
35
|
env: env || _gct.env.getEnv()
|
|
36
36
|
};
|
|
37
37
|
let hasUrl = `/PagePreview/${pid}`;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const scene = _gct.store.context.scene;
|
|
39
|
+
if (scene === ContextSceneEnum.TXN) {
|
|
40
|
+
matrixParams.scene = ContextSceneEnum.TXN;
|
|
40
41
|
hasUrl = `/TxnPagePreview/${pid}`;
|
|
42
|
+
} else if (scene === ContextSceneEnum.DETAIL) {
|
|
43
|
+
matrixParams.scene = ContextSceneEnum.DETAIL;
|
|
44
|
+
hasUrl = `/DetailPagePreview/${pid}`;
|
|
41
45
|
}
|
|
42
46
|
if (platform.value === Platform.MOBILE) openWindow(buildPreviewUrl(mobileUrl, hasUrl, matrixParams), {
|
|
43
47
|
noopener: false,
|
|
@@ -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,
|
|
3
|
+
save: (flag?: boolean, showSuccess?: boolean, scene?: string) => Promise<boolean>;
|
|
4
4
|
validateWidgets: (widgets: IData[], parents?: IData[]) => boolean;
|
|
5
5
|
savePageJsonSnapshot: (json?: PageJson) => void;
|
|
6
6
|
};
|
|
@@ -4,7 +4,7 @@ import "../../../utils/index.mjs";
|
|
|
4
4
|
import { defaultPageJson, noMore, pageDesignHistoryList, pageInfo, pageJson, pageJsonSnapshot, pageNo, regRoot, transformPageJson, widgetInfo } from "../design-state.mjs";
|
|
5
5
|
import { useUserOccupy } from "../components/useUserOccupy.mjs";
|
|
6
6
|
import { cloneDeep, isArray, isEmpty, isNil } from "lodash-es";
|
|
7
|
-
import { Platform, SearchComponents, TreeHelper, t } from "@gct-paas/core";
|
|
7
|
+
import { ContextSceneEnum, Platform, SearchComponents, TreeHelper, t } from "@gct-paas/core";
|
|
8
8
|
import { message } from "ant-design-vue";
|
|
9
9
|
//#region src/hooks/design-view/designer/useDesignSave.ts
|
|
10
10
|
/**
|
|
@@ -169,10 +169,12 @@ function useDesignSave() {
|
|
|
169
169
|
*
|
|
170
170
|
* @param {boolean} flag 是否为保存操作(true为保存,false为恢复)
|
|
171
171
|
* @param {boolean} showSuccess 是否显示成功提示
|
|
172
|
+
* @param {string} scene 场景, 目前支持"txn"(事务) | "detail"(详情页)
|
|
172
173
|
* @returns {Promise<boolean>} 是否保存成功
|
|
173
174
|
*/
|
|
174
|
-
async function save(flag = true, showSuccess = true,
|
|
175
|
-
if (
|
|
175
|
+
async function save(flag = true, showSuccess = true, scene = "") {
|
|
176
|
+
if (scene === ContextSceneEnum.TXN) return saveTxn(flag, showSuccess);
|
|
177
|
+
if (scene === ContextSceneEnum.DETAIL) return saveDetail(flag, showSuccess);
|
|
176
178
|
const pageId = _gct.store.context.pid;
|
|
177
179
|
const _pageJson = transformPageJson(pageJson);
|
|
178
180
|
if (validateWidgets(_pageJson.widgets) === false) return false;
|
|
@@ -267,7 +269,34 @@ function useDesignSave() {
|
|
|
267
269
|
key: pageInfo.value.key
|
|
268
270
|
});
|
|
269
271
|
savePageJsonSnapshot(pageInfo.value.txnPageMode === "create" ? _designerJson : _detailDesignerJson);
|
|
270
|
-
if (showSuccess) _gct.message.success(flag ? "sys.saveSuccess" : "sys.recoverSuccess");
|
|
272
|
+
if (showSuccess) _gct.message.success(flag ? t("sys.saveSuccess") : t("sys.recoverSuccess"));
|
|
273
|
+
cancelOccupy();
|
|
274
|
+
noMore.value = false;
|
|
275
|
+
pageNo.value = 1;
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* 保存详情页
|
|
280
|
+
* @param {boolean} flag 是否为保存操作(true为保存,false为恢复)
|
|
281
|
+
* @param {boolean} showSuccess 是否显示成功提示
|
|
282
|
+
* @returns {Promise<boolean>} 是否保存成功
|
|
283
|
+
*/
|
|
284
|
+
async function saveDetail(flag = true, showSuccess = true) {
|
|
285
|
+
const pageId = _gct.store.context.pid;
|
|
286
|
+
const createPayload = await preparePagePayload(pageJson);
|
|
287
|
+
if (!createPayload) return false;
|
|
288
|
+
const { designerJson: _designerJson, runtimeJson } = createPayload;
|
|
289
|
+
pageInfo.value._designerJson = JSON.stringify(_designerJson);
|
|
290
|
+
await _api.apaas.detailPage.putUpdateDesignerJsonId({ id: pageId }, {
|
|
291
|
+
designerJson: JSON.stringify(_designerJson),
|
|
292
|
+
description: pageInfo.value.description,
|
|
293
|
+
key: pageInfo.value.key,
|
|
294
|
+
name: pageInfo.value.name,
|
|
295
|
+
logId: (pageDesignHistoryList.value[0] ?? {}).id,
|
|
296
|
+
runtimeJson: JSON.stringify(runtimeJson)
|
|
297
|
+
});
|
|
298
|
+
savePageJsonSnapshot();
|
|
299
|
+
if (showSuccess) _gct.message.success(flag ? t("sys.saveSuccess") : t("sys.recoverSuccess"));
|
|
271
300
|
cancelOccupy();
|
|
272
301
|
noMore.value = false;
|
|
273
302
|
pageNo.value = 1;
|
|
@@ -6,9 +6,9 @@ export declare function useGlobal(): {
|
|
|
6
6
|
updateInfo: (id: string, data: AppGlobalSettingsRequest) => Promise<void>;
|
|
7
7
|
addInfo: (data: AppGlobalSettingsRequest) => Promise<void>;
|
|
8
8
|
deleteInfo: (ids: string) => Promise<void>;
|
|
9
|
-
queryGModal: (fullInfo?: boolean) => Promise<void>;
|
|
10
|
-
queryGVar: (fullInfo?: boolean) => Promise<void>;
|
|
11
|
-
queryGEvent: (fullInfo?: boolean) => Promise<void>;
|
|
9
|
+
queryGModal: (fullInfo?: boolean, configObj?: Record<string, string>) => Promise<void>;
|
|
10
|
+
queryGVar: (fullInfo?: boolean, configObj?: Record<string, string>) => Promise<void>;
|
|
11
|
+
queryGEvent: (fullInfo?: boolean, configObj?: Record<string, string>) => Promise<void>;
|
|
12
12
|
gVar: import('vue').Ref<{
|
|
13
13
|
id: string;
|
|
14
14
|
key: string;
|
|
@@ -8,11 +8,16 @@ var gModal = ref([]);
|
|
|
8
8
|
/**全局事件 */
|
|
9
9
|
var gEvent = ref([]);
|
|
10
10
|
function useGlobal() {
|
|
11
|
-
async function queryGModal(fullInfo = false) {
|
|
12
|
-
|
|
11
|
+
async function queryGModal(fullInfo = false, configObj) {
|
|
12
|
+
let queryObj = {
|
|
13
13
|
type: GLOBAL_TYPE.MODAL,
|
|
14
14
|
fullInfo
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
|
+
if (configObj) queryObj = {
|
|
17
|
+
...queryObj,
|
|
18
|
+
...configObj
|
|
19
|
+
};
|
|
20
|
+
gModal.value = (await _api.apaas.appGlobalSettings.getList(queryObj))?.map((modal) => {
|
|
16
21
|
return {
|
|
17
22
|
id: modal.id,
|
|
18
23
|
name: modal.name,
|
|
@@ -21,11 +26,16 @@ function useGlobal() {
|
|
|
21
26
|
};
|
|
22
27
|
}) || [];
|
|
23
28
|
}
|
|
24
|
-
async function queryGVar(fullInfo = true) {
|
|
25
|
-
|
|
29
|
+
async function queryGVar(fullInfo = true, configObj) {
|
|
30
|
+
let queryObj = {
|
|
26
31
|
type: GLOBAL_TYPE.VAR,
|
|
27
32
|
fullInfo
|
|
28
|
-
}
|
|
33
|
+
};
|
|
34
|
+
if (configObj) queryObj = {
|
|
35
|
+
...queryObj,
|
|
36
|
+
...configObj
|
|
37
|
+
};
|
|
38
|
+
gVar.value = (await _api.apaas.appGlobalSettings.getList(queryObj))?.map((variable) => {
|
|
29
39
|
return {
|
|
30
40
|
id: variable.id,
|
|
31
41
|
key: variable.key,
|
|
@@ -33,11 +43,16 @@ function useGlobal() {
|
|
|
33
43
|
};
|
|
34
44
|
}) || [];
|
|
35
45
|
}
|
|
36
|
-
async function queryGEvent(fullInfo = false) {
|
|
37
|
-
|
|
46
|
+
async function queryGEvent(fullInfo = false, configObj) {
|
|
47
|
+
let queryObj = {
|
|
38
48
|
type: GLOBAL_TYPE.EVENT,
|
|
39
49
|
fullInfo
|
|
40
|
-
}
|
|
50
|
+
};
|
|
51
|
+
if (configObj) queryObj = {
|
|
52
|
+
...queryObj,
|
|
53
|
+
...configObj
|
|
54
|
+
};
|
|
55
|
+
gEvent.value = (await _api.apaas.appGlobalSettings.getList(queryObj))?.map((event) => {
|
|
41
56
|
return {
|
|
42
57
|
id: event.id,
|
|
43
58
|
key: event.key,
|
|
@@ -392,7 +392,7 @@ export declare function useToolkit(): {
|
|
|
392
392
|
}[];
|
|
393
393
|
}[]>;
|
|
394
394
|
initToolkitWidgets: () => void;
|
|
395
|
-
changeToolkitWidgets: ({ data, modalState,
|
|
395
|
+
changeToolkitWidgets: ({ data, modalState, scene }: IObject) => void;
|
|
396
396
|
fixedToolkit: () => void;
|
|
397
397
|
setFieldToolkit: ({ modelKey, formId, childParentModelKey, }: {
|
|
398
398
|
modelKey: string;
|
|
@@ -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
|
|
@@ -16,6 +16,7 @@ var instance = class ComponentUtils {
|
|
|
16
16
|
static SubTableGroup = "SubTableGroup";
|
|
17
17
|
static CardListGroup = "CardListGroup";
|
|
18
18
|
static TxnPageGroup = "TxnPageGroup";
|
|
19
|
+
static DetailPageGroup = "DetailPageGroup";
|
|
19
20
|
/** 按分组上下文存储分类组件映射,仅保留现有两套逻辑 */
|
|
20
21
|
static _categoryCompsMap = {
|
|
21
22
|
default: {
|
|
@@ -115,6 +116,26 @@ var instance = class ComponentUtils {
|
|
|
115
116
|
FormComponents.ResetButton
|
|
116
117
|
],
|
|
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]
|
|
118
139
|
}
|
|
119
140
|
};
|
|
120
141
|
static _instance;
|
|
@@ -138,6 +159,11 @@ var instance = class ComponentUtils {
|
|
|
138
159
|
CategoryTypeEnum.BUTTON,
|
|
139
160
|
CategoryTypeEnum.DATA
|
|
140
161
|
];
|
|
162
|
+
if (this.groupType === ComponentUtils.DetailPageGroup) return [
|
|
163
|
+
CategoryTypeEnum.FORM,
|
|
164
|
+
CategoryTypeEnum.LAYOUT,
|
|
165
|
+
CategoryTypeEnum.DATA
|
|
166
|
+
];
|
|
141
167
|
return [
|
|
142
168
|
CategoryTypeEnum.FORM,
|
|
143
169
|
CategoryTypeEnum.LAYOUT,
|
|
@@ -155,7 +181,19 @@ var instance = class ComponentUtils {
|
|
|
155
181
|
* @returns 当前上下文下允许使用的组件枚举值列表
|
|
156
182
|
*/
|
|
157
183
|
_getCompsForCategory(categoryType) {
|
|
158
|
-
|
|
184
|
+
let groupKey;
|
|
185
|
+
switch (this.groupType) {
|
|
186
|
+
case ComponentUtils.SubTableGroup:
|
|
187
|
+
groupKey = "SubTableGroup";
|
|
188
|
+
break;
|
|
189
|
+
case ComponentUtils.TxnPageGroup:
|
|
190
|
+
groupKey = "TxnPageGroup";
|
|
191
|
+
break;
|
|
192
|
+
case ComponentUtils.DetailPageGroup:
|
|
193
|
+
groupKey = "DetailPageGroup";
|
|
194
|
+
break;
|
|
195
|
+
default: groupKey = "default";
|
|
196
|
+
}
|
|
159
197
|
return ComponentUtils._categoryCompsMap[groupKey][categoryType] ?? [];
|
|
160
198
|
}
|
|
161
199
|
/**
|
|
@@ -163,9 +201,9 @@ var instance = class ComponentUtils {
|
|
|
163
201
|
*
|
|
164
202
|
* @param data - 当前选中组件数据
|
|
165
203
|
* @param modalState - 是否处于子表单(弹框)状态
|
|
166
|
-
* @param
|
|
204
|
+
* @param scene - 修改成场景,目前存在事务和详情两个场景 // _gct.store.context.scene
|
|
167
205
|
*/
|
|
168
|
-
changeGroupType({ data, modalState,
|
|
206
|
+
changeGroupType({ data, modalState, scene }) {
|
|
169
207
|
if (data.type === FormComponents.CardList) {
|
|
170
208
|
this._setGroupType(ComponentUtils.CardListGroup);
|
|
171
209
|
return;
|
|
@@ -174,10 +212,14 @@ var instance = class ComponentUtils {
|
|
|
174
212
|
this._setGroupType(ComponentUtils.SubTableGroup);
|
|
175
213
|
return;
|
|
176
214
|
}
|
|
177
|
-
if (
|
|
215
|
+
if (scene === ContextSceneEnum.TXN) {
|
|
178
216
|
this._setGroupType(ComponentUtils.TxnPageGroup);
|
|
179
217
|
return;
|
|
180
218
|
}
|
|
219
|
+
if (scene === ContextSceneEnum.DETAIL) {
|
|
220
|
+
this._setGroupType(ComponentUtils.DetailPageGroup);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
181
223
|
this._setGroupType("");
|
|
182
224
|
}
|
|
183
225
|
/** 更新组件分组上下文 */
|
|
@@ -297,12 +339,12 @@ function useToolkit() {
|
|
|
297
339
|
});
|
|
298
340
|
}
|
|
299
341
|
/** 根据当前选中组件的上下文刷新组件列表 */
|
|
300
|
-
function changeToolkitWidgets({ data, modalState,
|
|
342
|
+
function changeToolkitWidgets({ data, modalState, scene }) {
|
|
301
343
|
const oldGroupType = instance.groupType;
|
|
302
344
|
instance.changeGroupType({
|
|
303
345
|
data,
|
|
304
346
|
modalState,
|
|
305
|
-
|
|
347
|
+
scene
|
|
306
348
|
});
|
|
307
349
|
if (oldGroupType !== instance.groupType) toolkitWidgets.value = instance.getWidgetsToolkit({
|
|
308
350
|
platform: _gct.store.context.platform,
|
|
@@ -42,6 +42,11 @@ export declare function loadPageInfo(app: App): Promise<void>;
|
|
|
42
42
|
* @returns
|
|
43
43
|
*/
|
|
44
44
|
export declare function loadTxnPageInfo(app: App): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* 加载详情页面信息
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadDetailPageInfo(app: App): Promise<void>;
|
|
45
50
|
/**
|
|
46
51
|
* @param mode 切换模式
|
|
47
52
|
*/
|
|
@@ -49,7 +54,7 @@ export declare function toggleTxnPageInfo(mode: 'create' | 'detail'): Promise<vo
|
|
|
49
54
|
/**
|
|
50
55
|
* 初始化界面占用信息
|
|
51
56
|
*/
|
|
52
|
-
declare function initLockState(): void;
|
|
57
|
+
declare function initLockState(type?: string): void;
|
|
53
58
|
/**
|
|
54
59
|
* 更新页面锁定状态
|
|
55
60
|
* @param {boolean} value
|
|
@@ -10,7 +10,7 @@ import { useCacheHistory } from "../../develop/useCacheHistory.mjs";
|
|
|
10
10
|
import { useToolkit } from "../layout/useToolkit.mjs";
|
|
11
11
|
import { useDesigner } from "../useDesigner.mjs";
|
|
12
12
|
import { isEmpty, isNil } from "lodash-es";
|
|
13
|
-
import { ButtonSize, ButtonStyle, FormComponents, KitPkgUtil, PanelEnum, Platform, t } from "@gct-paas/core";
|
|
13
|
+
import { ButtonSize, ButtonStyle, ContextSceneEnum, FormComponents, KitPkgUtil, PanelEnum, Platform, t } from "@gct-paas/core";
|
|
14
14
|
import { computed, createVNode, ref } from "vue";
|
|
15
15
|
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
|
16
16
|
import { Modal } from "ant-design-vue";
|
|
@@ -208,8 +208,81 @@ async function loadTxnPageInfo(app) {
|
|
|
208
208
|
loadPageDesignHistoryList();
|
|
209
209
|
pagePermissions.value = await _api.apaas.permission.getList({ relationId: _gct.store.context.pid }) || [];
|
|
210
210
|
if (!pid.startsWith("___new___")) initLockState();
|
|
211
|
-
pageJson.pageConfig.unitType = "%";
|
|
212
|
-
pageJson.pageConfig.pageWidth = 80;
|
|
211
|
+
pageJson.pageConfig.unitType = pageJson.pageConfig.unitType || "%";
|
|
212
|
+
pageJson.pageConfig.pageWidth = 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("detail_page");
|
|
283
|
+
pageJson.pageConfig.title = pageJson.pageConfig.title || t("sys.detail");
|
|
284
|
+
pageJson.pageConfig.unitType = pageJson.pageConfig.unitType || "%";
|
|
285
|
+
pageJson.pageConfig.pageWidth = pageJson.pageConfig.pageWidth || 80;
|
|
213
286
|
savePageJsonSnapshot();
|
|
214
287
|
}
|
|
215
288
|
/**
|
|
@@ -239,13 +312,15 @@ async function toggleTxnPageInfo(mode) {
|
|
|
239
312
|
/**
|
|
240
313
|
* 初始化界面占用信息
|
|
241
314
|
*/
|
|
242
|
-
function initLockState() {
|
|
243
|
-
if (_gct.store.context.scene ===
|
|
315
|
+
function initLockState(type) {
|
|
316
|
+
if (_gct.store.context.scene === ContextSceneEnum.TXN) return;
|
|
244
317
|
const { setLockInfo, initOccupy, loadOccupyInfo } = useUserOccupy();
|
|
245
|
-
|
|
318
|
+
const initData = {
|
|
246
319
|
id: _gct.store.context.pid || "",
|
|
247
320
|
type: (platform.value === Platform.WEB ? PageTypeEnum.WEB : platform.value === Platform.PAD ? PageTypeEnum.PAD : PageTypeEnum.MOBILE).toString()
|
|
248
|
-
}
|
|
321
|
+
};
|
|
322
|
+
if (type) initData.type = type;
|
|
323
|
+
initOccupy(initData);
|
|
249
324
|
loadOccupyInfo();
|
|
250
325
|
setLockInfo({
|
|
251
326
|
id: pageInfo.value?.lockUserId,
|
|
@@ -289,4 +364,4 @@ function usePage() {
|
|
|
289
364
|
};
|
|
290
365
|
}
|
|
291
366
|
//#endregion
|
|
292
|
-
export { currentPanel, loadPageInfo, loadTxnPageInfo, lockPage, pagePermissions, togglePanel, toggleTxnPageInfo, unlockAvailable, usePage };
|
|
367
|
+
export { currentPanel, loadDetailPageInfo, loadPageInfo, loadTxnPageInfo, lockPage, pagePermissions, togglePanel, toggleTxnPageInfo, unlockAvailable, usePage };
|
|
@@ -1096,7 +1096,7 @@ export declare function useDesigner(): {
|
|
|
1096
1096
|
handleAddDrag: (newIndex: number, childrenList: LowCodeWidget.BasicSchema[], scope: SCOPE, formID?: string) => void;
|
|
1097
1097
|
setPageJson: (json: PageJson, hasFooter?: boolean) => Promise<void>;
|
|
1098
1098
|
setTxnPageJson: (json: PageJson, hasFooter?: boolean) => Promise<void>;
|
|
1099
|
-
save: (flag?: boolean, showSuccess?: boolean,
|
|
1099
|
+
save: (flag?: boolean, showSuccess?: boolean, scene?: string) => Promise<boolean>;
|
|
1100
1100
|
savePageJsonSnapshot: (json?: PageJson) => void;
|
|
1101
1101
|
emitCache: () => void;
|
|
1102
1102
|
undoOrRestore: (content: string) => void;
|
package/es/index.mjs
CHANGED
|
@@ -48,7 +48,7 @@ import { useDesignPreview } from "./hooks/design-view/designer/useDesignPreview.
|
|
|
48
48
|
import { useCacheHistory, useCacheHistoryInner } from "./hooks/develop/useCacheHistory.mjs";
|
|
49
49
|
import { useWidgetRegistry } from "./hooks/design-view/widget/useWidgetRegistry.mjs";
|
|
50
50
|
import { useToolkit } from "./hooks/design-view/layout/useToolkit.mjs";
|
|
51
|
-
import { currentPanel, loadPageInfo, loadTxnPageInfo, lockPage, pagePermissions, togglePanel, toggleTxnPageInfo, unlockAvailable, usePage } from "./hooks/design-view/page/usePage.mjs";
|
|
51
|
+
import { currentPanel, loadDetailPageInfo, loadPageInfo, loadTxnPageInfo, lockPage, pagePermissions, togglePanel, toggleTxnPageInfo, unlockAvailable, usePage } from "./hooks/design-view/page/usePage.mjs";
|
|
52
52
|
import { useWidgetQuery } from "./hooks/design-view/widget/useWidgetQuery.mjs";
|
|
53
53
|
import { useSelectedWidget } from "./hooks/design-view/widget/useSelectedWidget.mjs";
|
|
54
54
|
import { useDesignCache } from "./hooks/design-view/designer/useDesignCache.mjs";
|
|
@@ -105,4 +105,4 @@ function onInit() {
|
|
|
105
105
|
}
|
|
106
106
|
onInit();
|
|
107
107
|
//#endregion
|
|
108
|
-
export { BaseDate, BaseSearch, CategoryEnum, ControllerType, DesignContainerNode, DesignContent, DesignEditorNode, DesignEditorNodeProvider, DesignEditorType, DesignItemActionTag, DesignItemAttribute, DesignItemPreview, DesignNode, DesignNodePrefix, DesignNodeType, DesignPluginPgkUtil, DesignViewController, DesignViewHooks, DesignViewPrefix, DesignerRegister, FieldCascader_default as FieldCascader, FieldOverrideUtil, FieldSchema, InsertNodeMode, MaterialContent, MaterialGroup, MaterialRegister, MenuClickEvent, multi_field_display_default as MultiFieldDisplay, NodeBaseProvider, NodeRegister, NotMask, OCCUPY_MQTT_KEY, PageTypeEnum, PanelContent, PropsEditorRegister, SCREditorUtils, user_lock_default as UserLock, user_occupy_default as UserOccupy, asyncIdentify, baseBtnEditor, baseBtnProp, basicAttrsUtils, basicFieldEditor, beginDrag, BTN_TYPE_COLOR as btnTypeColor, buildRunJs, buildRuntimeJson, buttonEditor, buttonProps, buttonStyleEditor, changeCmpData, commonStyle, createWidgetByType, createWidgetProvider, createdSearchField, currentPanel, customMenu, deptFilter, designCreateAppVue, designInterceptors, designRegister, designSetupApp, destroyOccupyTimer, deviceEvent, displayEditor, displayProps, explainEditor, findAllChildrenTypes, fixedAlignEditor, flatten, formItemProps, formulaFilter, getAutofillEditor, getBindCmpTypeEditor, getInputAttrEditor, getSearchOptions, hiddenButtonProps, initFieldWidgetRuntime, initMethodMap, isCanCrop, isModified, loadPageInfo, loadPageOccupyInfo, loadTxnPageInfo, loading, lockPage, methodMap, modal_exports as modalCfg, modalDesignId, modalDesignState, modalInfo, multiFieldEditor, newKeyTag, noMore, nodeContainerProps, nodeEditorProps, nodeProps, notNeedPxStyle, occupyPage, onWidgetInfoInit, openFormulaEditorByDesign, pageDesignHistoryList, pageInfo, pageJson, pageJsonSnapshot, pageNo, pageOccupyInfo, pagePermissions, permissionEditor, placeholderEditor, platform, pluginConfigs, PRESET_COLOR as presetColor, propEditorProps, propsToStyle, regRoot, regexEditor, rgba2hex, schemaToStyle, setupOverride, shadeColor, styleEditorProps, subTableModalId, subTableModalState, submitInHideEditor, togglePanel, toggleTxnPageInfo, transformField2Component, transformPageJson, unlockAvailable, uploadDraggerEditor, useAsyncFieldConfig, useAsyncFileAttrs, useAsyncOperateField, useCacheHistory, useCacheHistoryInner, useDesignCache, useDesignHistory, useDesignModal, useDesignPreview, useDesignSave, useDesignViewController, useDesignViewStore, useDesigner, useDesignerController, useFieldTransfer, useGlobal, useModelField, usePage, usePageOccupy, usePropEditor, useScope, useSelectedWidget, useStyle, useStyleEditor, useToolkit, useUserOccupy, useWidget, useWidgetQuery, useWidgetRegistry, validatorEditor, wfNodesModalId, wfNodesModalState, widgetInfo, widgetProps, widgetWrapperProps, workflowModalId, workflowModalState };
|
|
108
|
+
export { BaseDate, BaseSearch, CategoryEnum, ControllerType, DesignContainerNode, DesignContent, DesignEditorNode, DesignEditorNodeProvider, DesignEditorType, DesignItemActionTag, DesignItemAttribute, DesignItemPreview, DesignNode, DesignNodePrefix, DesignNodeType, DesignPluginPgkUtil, DesignViewController, DesignViewHooks, DesignViewPrefix, DesignerRegister, FieldCascader_default as FieldCascader, FieldOverrideUtil, FieldSchema, InsertNodeMode, MaterialContent, MaterialGroup, MaterialRegister, MenuClickEvent, multi_field_display_default as MultiFieldDisplay, NodeBaseProvider, NodeRegister, NotMask, OCCUPY_MQTT_KEY, PageTypeEnum, PanelContent, PropsEditorRegister, SCREditorUtils, user_lock_default as UserLock, user_occupy_default as UserOccupy, asyncIdentify, baseBtnEditor, baseBtnProp, basicAttrsUtils, basicFieldEditor, beginDrag, BTN_TYPE_COLOR as btnTypeColor, buildRunJs, buildRuntimeJson, buttonEditor, buttonProps, buttonStyleEditor, changeCmpData, commonStyle, createWidgetByType, createWidgetProvider, createdSearchField, currentPanel, customMenu, deptFilter, designCreateAppVue, designInterceptors, designRegister, designSetupApp, destroyOccupyTimer, deviceEvent, displayEditor, displayProps, explainEditor, findAllChildrenTypes, fixedAlignEditor, flatten, formItemProps, formulaFilter, getAutofillEditor, getBindCmpTypeEditor, getInputAttrEditor, getSearchOptions, hiddenButtonProps, initFieldWidgetRuntime, initMethodMap, isCanCrop, isModified, loadDetailPageInfo, loadPageInfo, loadPageOccupyInfo, loadTxnPageInfo, loading, lockPage, methodMap, modal_exports as modalCfg, modalDesignId, modalDesignState, modalInfo, multiFieldEditor, newKeyTag, noMore, nodeContainerProps, nodeEditorProps, nodeProps, notNeedPxStyle, occupyPage, onWidgetInfoInit, openFormulaEditorByDesign, pageDesignHistoryList, pageInfo, pageJson, pageJsonSnapshot, pageNo, pageOccupyInfo, pagePermissions, permissionEditor, placeholderEditor, platform, pluginConfigs, PRESET_COLOR as presetColor, propEditorProps, propsToStyle, regRoot, regexEditor, rgba2hex, schemaToStyle, setupOverride, shadeColor, styleEditorProps, subTableModalId, subTableModalState, submitInHideEditor, togglePanel, toggleTxnPageInfo, transformField2Component, transformPageJson, unlockAvailable, uploadDraggerEditor, useAsyncFieldConfig, useAsyncFileAttrs, useAsyncOperateField, useCacheHistory, useCacheHistoryInner, useDesignCache, useDesignHistory, useDesignModal, useDesignPreview, useDesignSave, useDesignViewController, useDesignViewStore, useDesigner, useDesignerController, useFieldTransfer, useGlobal, useModelField, usePage, usePageOccupy, usePropEditor, useScope, useSelectedWidget, useStyle, useStyleEditor, useToolkit, useUserOccupy, useWidget, useWidgetQuery, useWidgetRegistry, validatorEditor, wfNodesModalId, wfNodesModalState, widgetInfo, widgetProps, widgetWrapperProps, workflowModalId, workflowModalState };
|
|
@@ -3,7 +3,7 @@ import { useScope } from "../../hooks/design-view/layout/useScope.mjs";
|
|
|
3
3
|
import { useDesigner } from "../../hooks/design-view/useDesigner.mjs";
|
|
4
4
|
import "../../hooks/index.mjs";
|
|
5
5
|
import { has } from "lodash-es";
|
|
6
|
-
import { BindCmpStyleEnum, BindCmpStyleTypeEnum, EntityModelTypeEnum, FIELD_TYPE, FormComponents, MaterialEnum, Platform, PropGroup, TreeHelper } from "@gct-paas/core";
|
|
6
|
+
import { BindCmpStyleEnum, BindCmpStyleTypeEnum, ContextSceneEnum, EntityModelTypeEnum, FIELD_TYPE, FormComponents, MaterialEnum, Platform, PropGroup, TreeHelper } from "@gct-paas/core";
|
|
7
7
|
import { isFormFieldType } from "@gct-paas/schema";
|
|
8
8
|
//#region src/schema/common-config/common-field-editor-config.ts
|
|
9
9
|
/** 字段名称和显示标题config */
|
|
@@ -62,7 +62,7 @@ var getInputAttrEditor = (needFieldAttrs) => {
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
hidden(widget) {
|
|
65
|
-
return widget.props.field === "operating_state_" || widget.props.bindFieldKey || widget.materialType === MaterialEnum.DescriptionsFormField || widget.props.fieldReadonly;
|
|
65
|
+
return widget.props.field === "operating_state_" || widget.props.bindFieldKey || widget.materialType === MaterialEnum.DescriptionsFormField || widget.props.fieldReadonly || _gct.store.context.scene === ContextSceneEnum.DETAIL;
|
|
66
66
|
}
|
|
67
67
|
}];
|
|
68
68
|
};
|
|
@@ -118,6 +118,7 @@ var explainEditor = [{
|
|
|
118
118
|
formItemStyle: { marginBottom: "12px" },
|
|
119
119
|
group: PropGroup.FIELD_CONFIG,
|
|
120
120
|
hidden: (widget) => {
|
|
121
|
+
if (widget.props.hiddenInDetail) return true;
|
|
121
122
|
if (widget.props.bindFieldKey || widget.props.fieldReadonly) return true;
|
|
122
123
|
if ((widget.materialType === MaterialEnum.MaterialFormField || widget.materialType === MaterialEnum.MaterialSubTableModalField) && widget.platform === Platform.PAD) return true;
|
|
123
124
|
return widget.platform !== Platform.WEB && widget.platform !== Platform.PAD;
|
|
@@ -160,7 +161,10 @@ var validatorEditor = [{
|
|
|
160
161
|
name: "closeValidator",
|
|
161
162
|
label: "sys.pageDesigner.closeValidator",
|
|
162
163
|
group: PropGroup.FIELD_CONFIG,
|
|
163
|
-
formField: true
|
|
164
|
+
formField: true,
|
|
165
|
+
hidden(widget) {
|
|
166
|
+
return widget.props.hiddenInDetail;
|
|
167
|
+
}
|
|
164
168
|
}];
|
|
165
169
|
/** 下拉列表、单选、多选公共config */
|
|
166
170
|
var SCREditorUtils = {
|
|
@@ -66,7 +66,7 @@ var displayEditor = [
|
|
|
66
66
|
label: "sys.pageDesigner.deviceConnectivity",
|
|
67
67
|
group: PropGroup.FIELD_CONFIG,
|
|
68
68
|
hidden: (widget) => {
|
|
69
|
-
return widget.platform !== Platform.WEB || ![MaterialEnum.MaterialFormField].includes(widget.materialType) || !deviceFields.includes(widget.props.fieldType) || widget.props.fieldReadonly;
|
|
69
|
+
return widget.platform !== Platform.WEB || ![MaterialEnum.MaterialFormField].includes(widget.materialType) || !deviceFields.includes(widget.props.fieldType) || widget.props.fieldReadonly || widget.props.hiddenInDetail;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { widget as widget$1 } from "./modal-body.mjs";
|
|
3
3
|
import { widget as widget$2 } from "./modal-footer.mjs";
|
|
4
|
-
import { BuiltinType, Platform, PropGroup, StyleGroup
|
|
4
|
+
import { BuiltinType, ContextSceneEnum, Platform, PropGroup, StyleGroup } from "@gct-paas/core";
|
|
5
5
|
//#region src/schema/modal/modal.ts
|
|
6
6
|
var modal_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
beforeCreate: () => beforeCreate,
|
|
@@ -145,7 +145,7 @@ var propEditorList = [
|
|
|
145
145
|
label: "sys.pageDesigner.operateButton",
|
|
146
146
|
group: PropGroup.BUTTON,
|
|
147
147
|
hidden: (widget) => {
|
|
148
|
-
return widget.props.isSubTableModal;
|
|
148
|
+
return widget.props.isSubTableModal || _gct.store.context.scene === ContextSceneEnum.DETAIL;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
];
|
|
@@ -166,8 +166,7 @@ var eventList = [{
|
|
|
166
166
|
}];
|
|
167
167
|
var runCallback = () => {};
|
|
168
168
|
var beforeCreate = (widget) => {
|
|
169
|
-
|
|
170
|
-
widget.children[1].id = buildShortUUID(widget.children[1].type);
|
|
169
|
+
if (_gct.store.context.scene === ContextSceneEnum.DETAIL) widget.props.hasFooter = false;
|
|
171
170
|
};
|
|
172
171
|
var designerConfig = { basicProps: {
|
|
173
172
|
key_label: "弹窗",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/design",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台设计界面底包",
|
|
6
6
|
"loader": "dist/loader.esm.min.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@ant-design/icons-vue": "^7.0.1",
|
|
35
35
|
"@babel/core": "^7.29.0",
|
|
36
36
|
"@babel/standalone": "^7.29.2",
|
|
37
|
-
"@gct-paas/api": "^6.0.0-dev.
|
|
37
|
+
"@gct-paas/api": "^6.0.0-dev.7",
|
|
38
38
|
"@jsplumb/browser-ui": "^6.2.10",
|
|
39
39
|
"@vueuse/core": "^14.1.0",
|
|
40
40
|
"ant-design-vue": "npm:@gct-paas/ant-design-vue@3.2.21",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"react-dnd-html5-backend": "^16.0.1",
|
|
52
52
|
"vue": "^3.5.30",
|
|
53
53
|
"vue3-dnd": "^2.1.0",
|
|
54
|
-
"@gct-paas/core
|
|
55
|
-
"@gct-paas/core": "6.0.0-dev.
|
|
56
|
-
"@gct-paas/schema": "6.0.0-dev.
|
|
57
|
-
"@gct-paas/scss": "6.0.0-dev.
|
|
54
|
+
"@gct-paas/core": "6.0.0-dev.11",
|
|
55
|
+
"@gct-paas/core-web": "6.0.0-dev.11",
|
|
56
|
+
"@gct-paas/schema": "6.0.0-dev.11",
|
|
57
|
+
"@gct-paas/scss": "6.0.0-dev.11"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/babel__core": "^7.20.5",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"@types/estraverse": "^5.1.7"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@gct-paas/api": "^6.0.0-dev.
|
|
65
|
+
"@gct-paas/api": "^6.0.0-dev.7",
|
|
66
66
|
"vue": ">=3",
|
|
67
|
-
"@gct-paas/
|
|
68
|
-
"@gct-paas/core-web": "6.0.0-dev.
|
|
69
|
-
"@gct-paas/
|
|
70
|
-
"@gct-paas/
|
|
67
|
+
"@gct-paas/scss": "6.0.0-dev.11",
|
|
68
|
+
"@gct-paas/core-web": "6.0.0-dev.11",
|
|
69
|
+
"@gct-paas/core": "6.0.0-dev.11",
|
|
70
|
+
"@gct-paas/schema": "6.0.0-dev.11"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",
|