@gct-paas/design 0.1.6-dev.25 → 0.1.6-dev.27

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.
@@ -1,5 +1,6 @@
1
1
  import { PageTypeEnum } from "../../../constant/page-designer.mjs";
2
2
  import { OCCUPY_MQTT_KEY } from "../../../constant/index.mjs";
3
+ import { pageInfo } from "../design-state.mjs";
3
4
  import { throttle } from "lodash-es";
4
5
  import { ScriptTypeEnum, t } from "@gct-paas/core";
5
6
  import { computed, createVNode, ref } from "vue";
@@ -28,8 +29,15 @@ function _useUserOccupy() {
28
29
  });
29
30
  const unlockAvailable = computed(() => {
30
31
  const { userId, username } = _gct.store.userInfo;
31
- return lockInfo.value.id === userId || username === "admin";
32
+ const lockUserId = lockInfo.value.id;
33
+ if (!lockUserId) return false;
34
+ return String(lockUserId) === String(userId) || username === "admin";
32
35
  });
36
+ function applyLockInfo(data) {
37
+ lockInfo.value = data;
38
+ pageInfo.value.lockUserId = data.id || "";
39
+ pageInfo.value.lockUserName = data.name || "";
40
+ }
33
41
  /** 查询占用定时器 */
34
42
  let occupyTimer = null;
35
43
  /** 节流 wait 是否已按真实 cacheNum 初始化 */
@@ -122,7 +130,7 @@ function _useUserOccupy() {
122
130
  await _loadOccupyInfo();
123
131
  }
124
132
  function setLockInfo(data) {
125
- lockInfo.value = data;
133
+ applyLockInfo(data);
126
134
  }
127
135
  /**
128
136
  * 锁定
@@ -138,10 +146,10 @@ function _useUserOccupy() {
138
146
  async onOk() {
139
147
  await _api.apaas.designerLock.postLockPage(params);
140
148
  _gct.message.success(t("sys.operationSuccess"));
141
- lockInfo.value = {
142
- id: _gct.store.userInfo.userId,
149
+ applyLockInfo({
150
+ id: String(_gct.store.userInfo.userId),
143
151
  name: _gct.store.userInfo.fullname
144
- };
152
+ });
145
153
  }
146
154
  });
147
155
  }
@@ -149,12 +157,13 @@ function _useUserOccupy() {
149
157
  * 解锁
150
158
  */
151
159
  async function unlock() {
160
+ if (!unlockAvailable.value) return;
152
161
  await _api.apaas.designerLock.postUnLockPage(params);
153
162
  _gct.message.success(t("sys.operationSuccess"));
154
- lockInfo.value = {
163
+ applyLockInfo({
155
164
  id: "",
156
165
  name: ""
157
- };
166
+ });
158
167
  }
159
168
  return {
160
169
  initOccupy,
@@ -99,26 +99,7 @@ export declare const pageInfo: import('vue').Ref<{
99
99
  txnPageMode?: "create" | "detail" | undefined;
100
100
  baseId?: string | undefined;
101
101
  } | PageInfo>;
102
- export declare const defaultPageJson: {
103
- id: string;
104
- keepAlive: boolean;
105
- pageEvents: {};
106
- pageVars: never[];
107
- widgets: never[];
108
- js: string;
109
- css: string;
110
- modals: never[];
111
- globalEvents: {};
112
- permissions: {};
113
- plugins: never[];
114
- style: {};
115
- pageConfig: {
116
- title: string;
117
- i18n: {};
118
- hasFooter: undefined;
119
- };
120
- pageLayoutMode: pageLayoutModeEnum;
121
- };
102
+ export declare const defaultPageJson: PageJson;
122
103
  /** 设计页面JSON */
123
104
  export declare const pageJson: {
124
105
  id: string;
@@ -1187,6 +1168,9 @@ export declare const pageJson: {
1187
1168
  title?: string | undefined;
1188
1169
  } | undefined;
1189
1170
  hasFooter?: boolean | undefined;
1171
+ unitType?: "px" | "%" | undefined;
1172
+ pageWidth?: number | undefined;
1173
+ independentDetailPage?: boolean | undefined;
1190
1174
  };
1191
1175
  pageVars: {
1192
1176
  id: string;
@@ -34,7 +34,11 @@ function useDesignPreview() {
34
34
  bid: _gct.store.context.bid,
35
35
  env: env || _gct.env.getEnv()
36
36
  };
37
- const hasUrl = `/PagePreview/${pid}`;
37
+ let hasUrl = `/PagePreview/${pid}`;
38
+ if (_gct.store.context.scene === "txn") {
39
+ matrixParams.scene = "txn";
40
+ hasUrl = `/TxnPagePreview/${pid}`;
41
+ }
38
42
  if (platform.value === Platform.MOBILE) openWindow(buildPreviewUrl(mobileUrl, hasUrl, matrixParams), {
39
43
  noopener: false,
40
44
  noreferrer: false,
@@ -208,6 +208,7 @@ async function loadTxnPageInfo(app) {
208
208
  initToolkitWidgets();
209
209
  loadPageDesignHistoryList();
210
210
  pagePermissions.value = await _api.apaas.permission.getList({ relationId: _gct.store.context.pid }) || [];
211
+ if (!pid.startsWith("___new___")) initLockState();
211
212
  savePageJsonSnapshot();
212
213
  }
213
214
  /**
@@ -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;
@@ -7,8 +7,8 @@ export declare function useSelectedWidget(): {
7
7
  resetSelectedModal: () => void;
8
8
  setSelectedWidget: (widget: Partial<LowCodeWidget.BasicSchema>, scope?: SCOPE) => void;
9
9
  resetSelectedWidget: (scope?: SCOPE) => void;
10
- selectedAllPropEditors: import('vue').ComputedRef<import('@gct-paas/schema').IPropEditor[]>;
11
- selectedAllStyleEditors: import('vue').ComputedRef<import('@gct-paas/schema').IStyleEditor[]>;
10
+ selectedAllPropEditors: import('vue').ComputedRef<import('@gct-paas/schema').IPropEditor[] | undefined>;
11
+ selectedAllStyleEditors: import('vue').ComputedRef<import('@gct-paas/schema').IStyleEditor[] | undefined>;
12
12
  selectedAllEvents: import('vue').ComputedRef<IObject[]>;
13
13
  selectedEvents: import('vue').WritableComputedRef<import('@gct-paas/schema').IBasicEvents, import('@gct-paas/schema').IBasicEvents>;
14
14
  selectedProps: import('vue').ComputedRef<import('@gct-paas/schema').ICommonProps & import('@gct-paas/schema').IWidgetProps>;
@@ -126,22 +126,26 @@ function useSelectedWidget() {
126
126
  });
127
127
  /**被选择的组件/弹框拥有的所有事件 */
128
128
  const selectedAllEvents = computed(() => {
129
- const { type } = selectedRef.value;
129
+ const { type, materialType } = selectedRef.value;
130
130
  const widgetEvents = widgetInfo.value.events;
131
- if (widgetEvents[type] && isArray(widgetEvents[type])) return widgetEvents[type];
132
- const provider = designRegister.value.getProvider(type);
133
- if (!provider) {
134
- console.warn(`selectedAllEvents 未找到组件 ${type} 的设计器项配置信息,请确保该组件已正确注册`);
135
- return [];
131
+ let defaultEvents = [];
132
+ if (widgetEvents[type] && isArray(widgetEvents[type])) defaultEvents = widgetEvents[type];
133
+ if (defaultEvents.length === 0) {
134
+ const provider = designRegister.value.getProvider(type);
135
+ if (!provider) {
136
+ console.warn(`selectedAllEvents 未找到组件 ${type} 的设计器项配置信息,请确保该组件已正确注册`);
137
+ return [];
138
+ }
139
+ defaultEvents = provider.events || [];
136
140
  }
137
- if (selectedRef.value.props.fieldReadonly) return (provider.events || []).filter((event) => event.name === "onClick");
138
- const overrideEvents = FieldEditorOverrideRegistry.get(type)?.events;
139
- const defaultEvents = provider.events || [];
140
- return overrideEvents?.(selectedRef.value, defaultEvents) || defaultEvents;
141
+ if (selectedRef.value.props.fieldReadonly) return defaultEvents.filter((event) => event.name === "onClick");
142
+ const overrideEvents = FieldEditorOverrideRegistry.get(materialType)?.events;
143
+ if (overrideEvents) return overrideEvents(selectedRef.value, defaultEvents);
144
+ return defaultEvents;
141
145
  });
142
146
  /**被选择的组件/弹框拥有的所有属性编辑器的描述集合 */
143
147
  const selectedAllPropEditors = computed(() => {
144
- const { type } = selectedRef.value;
148
+ const { type, materialType } = selectedRef.value;
145
149
  const widgetPropsEditors = widgetInfo.value.propEditors;
146
150
  let preCompInfo;
147
151
  if (has(selectedRef.value, "preLocation")) {
@@ -150,28 +154,36 @@ function useSelectedWidget() {
150
154
  return widget.id === get(selectedRef.value, "preLocation");
151
155
  });
152
156
  }
153
- if (widgetPropsEditors[type] && isArray(widgetPropsEditors[type])) return widgetPropsEditors[type];
154
- const provider = designRegister.value.getProvider(type);
155
- if (!provider) {
156
- console.warn(`selectedAllPropEditors 未找到组件 ${type} 的设计器项配置信息,请确保该组件已正确注册`);
157
- return [];
157
+ let defaultPropEditors = [];
158
+ if (widgetPropsEditors[type] && isArray(widgetPropsEditors[type])) defaultPropEditors = widgetPropsEditors[type];
159
+ if (defaultPropEditors.length === 0) {
160
+ const provider = designRegister.value.getProvider(type);
161
+ if (!provider) {
162
+ console.warn(`selectedAllPropEditors 未找到组件 ${type} 的设计器项配置信息,请确保该组件已正确注册`);
163
+ return [];
164
+ }
165
+ defaultPropEditors = provider.propEditors || [];
158
166
  }
159
- const overridePropEditor = FieldEditorOverrideRegistry.get(type)?.propEditor;
160
- const defaultPropEditors = provider.propEditors || [];
161
- return overridePropEditor?.(selectedRef.value, defaultPropEditors, preCompInfo) || defaultPropEditors;
167
+ const overridePropEditor = FieldEditorOverrideRegistry.get(materialType)?.propEditor;
168
+ if (overridePropEditor) return overridePropEditor(selectedRef.value, defaultPropEditors, preCompInfo);
169
+ return defaultPropEditors;
162
170
  });
163
171
  /**被选择的组件/弹框拥有的所有样式编辑器的描述集合 */
164
172
  const selectedAllStyleEditors = computed(() => {
165
- const { type } = selectedRef.value;
166
- if (widgetInfo.value.styleEditors[type] && isArray(widgetInfo.value.styleEditors[type])) return widgetInfo.value.styleEditors[type];
167
- const provider = designRegister.value.getProvider(type);
168
- if (!provider) {
169
- console.warn(`selectedAllStyleEditors 未找到组件 ${type} 的设计器项配置信息,请确保该组件已正确注册`);
170
- return [];
173
+ const { type, materialType } = selectedRef.value;
174
+ let defaultStyleEditors = [];
175
+ if (widgetInfo.value.styleEditors[type] && isArray(widgetInfo.value.styleEditors[type])) defaultStyleEditors = widgetInfo.value.styleEditors[type];
176
+ if (defaultStyleEditors.length === 0) {
177
+ const provider = designRegister.value.getProvider(type);
178
+ if (!provider) {
179
+ console.warn(`selectedAllStyleEditors 未找到组件 ${type} 的设计器项配置信息,请确保该组件已正确注册`);
180
+ return [];
181
+ }
182
+ defaultStyleEditors = provider.styleEditors || [];
171
183
  }
172
- const overrideStyleEditor = FieldEditorOverrideRegistry.get(type)?.styleEditor;
173
- const defaultStyleEditors = provider.styleEditors || [];
174
- return overrideStyleEditor?.(selectedRef.value, defaultStyleEditors) || defaultStyleEditors;
184
+ const overrideStyleEditor = FieldEditorOverrideRegistry.get(materialType)?.styleEditor;
185
+ if (overrideStyleEditor) return overrideStyleEditor(selectedRef.value, defaultStyleEditors);
186
+ return defaultStyleEditors;
175
187
  });
176
188
  /**被选择的组件所有设计相关配置信息集合 */
177
189
  const selectedAllDesingerConfig = computed(() => {
@@ -10,19 +10,19 @@ declare const _default: {
10
10
  prop: string;
11
11
  defaultValue: string;
12
12
  codeError: string;
13
+ topBorder: string;
14
+ leftBorder: string;
15
+ bottomBorder: string;
16
+ rightBorder: string;
17
+ whole: string;
13
18
  upLeft: string;
14
19
  upRight: string;
15
20
  downLeft: string;
16
21
  downRight: string;
17
- whole: string;
18
22
  radius: string;
19
23
  bold: string;
20
24
  italic: string;
21
25
  underline: string;
22
26
  linethrough: string;
23
- topBorder: string;
24
- leftBorder: string;
25
- bottomBorder: string;
26
- rightBorder: string;
27
27
  };
28
28
  export default _default;
@@ -13,20 +13,20 @@ var pageDesigner_default = {
13
13
  prop: "属性",
14
14
  defaultValue: "默认值",
15
15
  codeError: "语法错误请检查!",
16
+ topBorder: "上边框",
17
+ leftBorder: "左边框",
18
+ bottomBorder: "下边框",
19
+ rightBorder: "右边框",
20
+ whole: "全部",
16
21
  upLeft: "左上角",
17
22
  upRight: "右上角",
18
23
  downLeft: "左下角",
19
24
  downRight: "右下角",
20
- whole: "全部",
21
25
  radius: "圆角",
22
26
  bold: "加粗",
23
27
  italic: "倾斜",
24
28
  underline: "下划线",
25
- linethrough: "删除线",
26
- topBorder: "上边框",
27
- leftBorder: "左边框",
28
- bottomBorder: "下边框",
29
- rightBorder: "右边框"
29
+ linethrough: "删除线"
30
30
  };
31
31
  //#endregion
32
32
  export { pageDesigner_exports };
@@ -65,7 +65,7 @@ var DesignerRegister = class {
65
65
  const instance = provider();
66
66
  this.providers.set(fullTag, instance);
67
67
  this.hooks.register.callSync(null, fullTag, instance);
68
- this.addComponent("gct-" + instance.schema.type, instance.component);
68
+ if (!prefix) this.addComponent("gct-" + instance.schema.type, instance.component);
69
69
  }
70
70
  /**
71
71
  * 设计器项适配器注销
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/design",
3
- "version": "0.1.6-dev.25",
3
+ "version": "0.1.6-dev.27",
4
4
  "type": "module",
5
5
  "description": "paas 平台设计界面底包",
6
6
  "loader": "dist/loader.esm.min.js",
@@ -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-web": "0.1.6-dev.25",
55
- "@gct-paas/schema": "0.1.6-dev.25",
56
- "@gct-paas/core": "0.1.6-dev.25",
57
- "@gct-paas/scss": "0.1.6-dev.25"
54
+ "@gct-paas/core": "0.1.6-dev.27",
55
+ "@gct-paas/core-web": "0.1.6-dev.27",
56
+ "@gct-paas/schema": "0.1.6-dev.27",
57
+ "@gct-paas/scss": "0.1.6-dev.27"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/babel__core": "^7.20.5",
@@ -64,10 +64,10 @@
64
64
  "peerDependencies": {
65
65
  "@gct-paas/api": "^0.1.6-dev.14",
66
66
  "vue": ">=3",
67
- "@gct-paas/core": "0.1.6-dev.25",
68
- "@gct-paas/core-web": "0.1.6-dev.25",
69
- "@gct-paas/schema": "0.1.6-dev.25",
70
- "@gct-paas/scss": "0.1.6-dev.25"
67
+ "@gct-paas/core-web": "0.1.6-dev.27",
68
+ "@gct-paas/scss": "0.1.6-dev.27",
69
+ "@gct-paas/core": "0.1.6-dev.27",
70
+ "@gct-paas/schema": "0.1.6-dev.27"
71
71
  },
72
72
  "scripts": {
73
73
  "dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",