@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.
Files changed (89) hide show
  1. package/README.md +157 -0
  2. package/dist/index.min.css +1 -1
  3. package/dist/loader.esm.min.js +2 -1
  4. package/es/components/field-transfer/components/field-transfer-modal.vue.mjs +2 -2
  5. package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_style_index_0_scoped_2f34388d_lang.css +8 -0
  6. package/es/components/index.d.ts +0 -4
  7. package/es/components/index.mjs +0 -5
  8. package/es/components/mobile-container/mobile-container.d.ts +2 -2
  9. package/es/components/multi-field/multi-field-display.vue.mjs +2 -2
  10. package/es/components/multi-field/multi-field-display.vue_vue_type_script_setup_true_lang.mjs +1 -1
  11. 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
  12. package/es/components/user-occupy/index.d.ts +0 -1
  13. package/es/components/user-occupy/index.mjs +0 -1
  14. package/es/components/user-occupy/user-lock.vue.mjs +2 -2
  15. package/es/components/user-occupy/user-lock.vue_vue_type_script_setup_true_lang.mjs +2 -1
  16. package/es/components/user-occupy/user-lock.vue_vue_type_style_index_0_scoped_143659f6_lang.css +29 -0
  17. package/es/components/user-occupy/user-occupy.vue.mjs +2 -2
  18. package/es/components/user-occupy/user-occupy.vue_vue_type_script_setup_true_lang.mjs +2 -1
  19. 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
  20. package/es/constant/index.d.ts +5 -0
  21. package/es/constant/index.mjs +6 -1
  22. package/es/constant/page-designer.d.ts +9 -36
  23. package/es/constant/page-designer.mjs +2 -32
  24. package/es/{components/user-occupy → hooks/design-view/components}/useUserOccupy.d.ts +3 -3
  25. package/es/{components/user-occupy → hooks/design-view/components}/useUserOccupy.mjs +48 -27
  26. package/es/hooks/design-view/design-state.d.ts +91 -1
  27. package/es/hooks/design-view/design-state.mjs +7 -7
  28. package/es/hooks/design-view/designer/useDesignCache.mjs +2 -3
  29. package/es/hooks/design-view/designer/useDesignPreview.mjs +15 -5
  30. package/es/hooks/design-view/designer/useDesignSave.d.ts +2 -2
  31. package/es/hooks/design-view/designer/useDesignSave.mjs +160 -23
  32. package/es/hooks/design-view/layout/useToolkit.d.ts +1 -1
  33. package/es/hooks/design-view/layout/useToolkit.mjs +166 -82
  34. package/es/hooks/design-view/page/usePage.d.ts +17 -7
  35. package/es/hooks/design-view/page/usePage.mjs +205 -9
  36. package/es/hooks/design-view/useDesigner.d.ts +7 -2
  37. package/es/hooks/design-view/useDesigner.mjs +25 -3
  38. package/es/hooks/design-view/widget/useSelectedWidget.mjs +55 -28
  39. package/es/hooks/design-view/widget/useWidget.mjs +2 -1
  40. package/es/hooks/index.d.ts +1 -1
  41. package/es/hooks/index.mjs +1 -1
  42. package/es/index.mjs +9 -12
  43. package/es/interface/index.d.ts +0 -1
  44. package/es/locale/auto-register.d.ts +2 -0
  45. package/es/locale/auto-register.mjs +25 -0
  46. package/es/locale/sys/app.mjs +6 -0
  47. package/es/locale/sys/appDesigner.mjs +9 -0
  48. package/es/locale/sys/cardDesign.d.ts +4 -4
  49. package/es/locale/sys/cardDesign.mjs +17 -0
  50. package/es/locale/sys/component.mjs +21 -0
  51. package/es/locale/sys/model.mjs +10 -0
  52. package/es/locale/sys/pageDesigner.mjs +32 -0
  53. package/es/locale/sys/platform.mjs +11 -0
  54. package/es/locale/sys.d.ts +7 -5
  55. package/es/locale/sys.mjs +26 -0
  56. package/es/register/designer-register/designer-register.d.ts +6 -3
  57. package/es/register/designer-register/designer-register.mjs +20 -14
  58. package/es/register/index.d.ts +1 -0
  59. package/es/register/index.mjs +1 -0
  60. package/es/register/props-editor/props-editor.register.d.ts +24 -0
  61. package/es/register/props-editor/props-editor.register.mjs +30 -0
  62. package/es/schema/begin-drag/begin-drag.mjs +1 -1
  63. package/es/schema/common-config/common-field-editor-config.mjs +7 -3
  64. package/es/schema/common-config/display-editor-config.mjs +2 -2
  65. package/es/schema/field/index.mjs +17 -3
  66. package/es/setup-app.d.ts +2 -1
  67. package/es/setup-app.mjs +3 -1
  68. package/es/types/index.d.ts +2 -1
  69. package/es/utils/design-interceptors/design-interceptors.mjs +1 -1
  70. package/package.json +12 -12
  71. package/es/components/design-save-tip/design-save-tip.css +0 -107
  72. package/es/components/design-save-tip/design-save-tip.d.ts +0 -44
  73. package/es/components/design-save-tip/design-save-tip.mjs +0 -81
  74. package/es/components/design-step-check/design-step-check.css +0 -133
  75. package/es/components/design-step-check/design-step-check.d.ts +0 -30
  76. package/es/components/design-step-check/design-step-check.mjs +0 -96
  77. package/es/components/design-view-layout/design-view-layout.css +0 -157
  78. package/es/components/design-view-layout/design-view-layout.d.ts +0 -1
  79. package/es/components/design-view-layout/design-view-layout.mjs +0 -139
  80. package/es/components/field-transfer/components/field-transfer-modal.vue_vue_type_style_index_0_scoped_711e6992_lang.css +0 -8
  81. package/es/components/modal-name-editor/modal-name-editor.css +0 -117
  82. package/es/components/modal-name-editor/modal-name-editor.d.ts +0 -34
  83. package/es/components/modal-name-editor/modal-name-editor.mjs +0 -124
  84. package/es/components/user-occupy/occupy.const.d.ts +0 -4
  85. package/es/components/user-occupy/occupy.const.mjs +0 -7
  86. package/es/components/user-occupy/user-lock.vue_vue_type_style_index_0_scoped_b40d46ff_lang.css +0 -29
  87. package/es/hooks/develop/useKeyParser.d.ts +0 -16
  88. package/es/hooks/develop/useKeyParser.mjs +0 -79
  89. package/es/interface/i-view-step/i-view-step.d.ts +0 -32
@@ -1,7 +1,7 @@
1
1
  import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_export-helper.mjs";
2
2
  import field_transfer_modal_vue_vue_type_script_setup_true_name_field_transfer_modal_lang_default from "./field-transfer-modal.vue_vue_type_script_setup_true_name_field-transfer-modal_lang.mjs";
3
- import './field-transfer-modal.vue_vue_type_style_index_0_scoped_711e6992_lang.css';/* empty css */
3
+ import './field-transfer-modal.vue_vue_type_style_index_0_scoped_2f34388d_lang.css';/* empty css */
4
4
  //#region src/components/field-transfer/components/field-transfer-modal.vue
5
- var field_transfer_modal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(field_transfer_modal_vue_vue_type_script_setup_true_name_field_transfer_modal_lang_default, [["__scopeId", "data-v-711e6992"]]);
5
+ var field_transfer_modal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(field_transfer_modal_vue_vue_type_script_setup_true_name_field_transfer_modal_lang_default, [["__scopeId", "data-v-2f34388d"]]);
6
6
  //#endregion
7
7
  export { field_transfer_modal_default as default };
@@ -0,0 +1,8 @@
1
+ .field-transfer-container[data-v-2f34388d] {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ }
6
+ .field-transfer-container .field-cascader[data-v-2f34388d] {
7
+ margin-bottom: 8px;
8
+ }
@@ -6,10 +6,6 @@ export default _default;
6
6
  export * from './design';
7
7
  export * from './material';
8
8
  export * from './panel';
9
- export { DesignSaveTip } from './design-save-tip/design-save-tip';
10
- export { DesignStepCheck } from './design-step-check/design-step-check';
11
- export { DesignViewLayout } from './design-view-layout/design-view-layout';
12
9
  export * from './field-transfer';
13
- export { ModalNameEditor } from './modal-name-editor/modal-name-editor';
14
10
  export * from './user-occupy';
15
11
  export * from './multi-field';
@@ -8,14 +8,9 @@ import "./material/material-content/material-content.mjs";
8
8
  import "./material/index.mjs";
9
9
  import "./panel/panel-content/panel-content.mjs";
10
10
  import "./panel/index.mjs";
11
- import "./design-save-tip/design-save-tip.mjs";
12
- import "./design-step-check/design-step-check.mjs";
13
- import "./modal-name-editor/modal-name-editor.mjs";
14
- import "./design-view-layout/design-view-layout.mjs";
15
11
  import "./field-transfer/components/Cascader/FieldCascader.mjs";
16
12
  import "./field-transfer/useFieldTransfer.mjs";
17
13
  import "./field-transfer/index.mjs";
18
- import "./user-occupy/useUserOccupy.mjs";
19
14
  import "./user-occupy/user-lock.vue.mjs";
20
15
  import "./user-occupy/user-occupy.vue.mjs";
21
16
  import "./user-occupy/index.mjs";
@@ -9,7 +9,7 @@ export declare const MobileContainer: import('vue').DefineComponent<import('vue'
9
9
  };
10
10
  title: {
11
11
  type: StringConstructor;
12
- default: () => any;
12
+ default: () => string | undefined;
13
13
  };
14
14
  }>, {
15
15
  ns: import('@gct-paas/core').Namespace;
@@ -25,7 +25,7 @@ export declare const MobileContainer: import('vue').DefineComponent<import('vue'
25
25
  };
26
26
  title: {
27
27
  type: StringConstructor;
28
- default: () => any;
28
+ default: () => string | undefined;
29
29
  };
30
30
  }>> & Readonly<{}>, {
31
31
  headerBgColor: boolean;
@@ -1,7 +1,7 @@
1
1
  import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export-helper.mjs";
2
2
  import multi_field_display_vue_vue_type_script_setup_true_lang_default from "./multi-field-display.vue_vue_type_script_setup_true_lang.mjs";
3
- import './multi-field-display.vue_vue_type_style_index_0_scoped_802ade7b_lang.css';/* empty css */
3
+ import './multi-field-display.vue_vue_type_style_index_0_scoped_83390705_lang.css';/* empty css */
4
4
  //#region src/components/multi-field/multi-field-display.vue
5
- var multi_field_display_default = /* @__PURE__ */ _plugin_vue_export_helper_default(multi_field_display_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-802ade7b"]]);
5
+ var multi_field_display_default = /* @__PURE__ */ _plugin_vue_export_helper_default(multi_field_display_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-83390705"]]);
6
6
  //#endregion
7
7
  export { multi_field_display_default as default };
@@ -4,7 +4,7 @@ import { Fragment, computed, createCommentVNode, createElementBlock, createVNode
4
4
  //#region src/components/multi-field/multi-field-display.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = {
6
6
  key: 0,
7
- class: "flex tag-area"
7
+ class: "flex tag-area items-center"
8
8
  };
9
9
  var multi_field_display_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
10
10
  __name: "multi-field-display",
@@ -1,4 +1,4 @@
1
- .tag-area[data-v-802ade7b] {
1
+ .tag-area[data-v-83390705] {
2
2
  flex-wrap: nowrap;
3
3
  width: auto;
4
4
  }
@@ -1,4 +1,3 @@
1
1
  import { default as UserLock } from './user-lock.vue';
2
2
  import { default as UserOccupy } from './user-occupy.vue';
3
3
  export { UserLock, UserOccupy };
4
- export { useUserOccupy } from './useUserOccupy';
@@ -1,3 +1,2 @@
1
- import "./useUserOccupy.mjs";
2
1
  import "./user-lock.vue.mjs";
3
2
  import "./user-occupy.vue.mjs";
@@ -1,7 +1,7 @@
1
1
  import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export-helper.mjs";
2
2
  import user_lock_vue_vue_type_script_setup_true_lang_default from "./user-lock.vue_vue_type_script_setup_true_lang.mjs";
3
- import './user-lock.vue_vue_type_style_index_0_scoped_b40d46ff_lang.css';/* empty css */
3
+ import './user-lock.vue_vue_type_style_index_0_scoped_143659f6_lang.css';/* empty css */
4
4
  //#region src/components/user-occupy/user-lock.vue
5
- var user_lock_default = /* @__PURE__ */ _plugin_vue_export_helper_default(user_lock_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-b40d46ff"]]);
5
+ var user_lock_default = /* @__PURE__ */ _plugin_vue_export_helper_default(user_lock_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-143659f6"]]);
6
6
  //#endregion
7
7
  export { user_lock_default as default };
@@ -1,4 +1,5 @@
1
- import { useUserOccupy } from "./useUserOccupy.mjs";
1
+ import { useUserOccupy } from "../../hooks/design-view/components/useUserOccupy.mjs";
2
+ import "../../hooks/index.mjs";
2
3
  import { t } from "@gct-paas/core";
3
4
  import { Fragment, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref } from "vue";
4
5
  //#region src/components/user-occupy/user-lock.vue?vue&type=script&setup=true&lang.ts
@@ -0,0 +1,29 @@
1
+ .user-lock[data-v-143659f6] {
2
+ color: rgba(255, 255, 255, 0.72);
3
+ cursor: pointer;
4
+ }
5
+ .user-lock .user-lock-info[data-v-143659f6] {
6
+ padding-right: 4px;
7
+ color: rgba(255, 255, 255, 0.72);
8
+ }
9
+ .user-lock .iconfont[data-v-143659f6] {
10
+ color: rgba(255, 255, 255, 0.72);
11
+ margin-right: 6px;
12
+ margin-left: 6px;
13
+ }
14
+ .user-lock[data-v-143659f6]:hover {
15
+ color: #ffffff;
16
+ }
17
+ .user-lock:hover .iconfont[data-v-143659f6],
18
+ .user-lock:hover .user-lock-info[data-v-143659f6] {
19
+ color: #ffffff;
20
+ }
21
+ .user-lock.locked[data-v-143659f6] {
22
+ color: #ff8c4b;
23
+ }
24
+ .user-lock.locked .iconfont[data-v-143659f6] {
25
+ color: #ff8c4b;
26
+ }
27
+ .user-lock.locked .user-lock-info[data-v-143659f6] {
28
+ color: #ffffff;
29
+ }
@@ -1,7 +1,7 @@
1
1
  import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export-helper.mjs";
2
2
  import user_occupy_vue_vue_type_script_setup_true_lang_default from "./user-occupy.vue_vue_type_script_setup_true_lang.mjs";
3
- import './user-occupy.vue_vue_type_style_index_0_scoped_9b136922_lang.css';/* empty css */
3
+ import './user-occupy.vue_vue_type_style_index_0_scoped_1234af11_lang.css';/* empty css */
4
4
  //#region src/components/user-occupy/user-occupy.vue
5
- var user_occupy_default = /* @__PURE__ */ _plugin_vue_export_helper_default(user_occupy_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-9b136922"]]);
5
+ var user_occupy_default = /* @__PURE__ */ _plugin_vue_export_helper_default(user_occupy_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-1234af11"]]);
6
6
  //#endregion
7
7
  export { user_occupy_default as default };
@@ -1,4 +1,5 @@
1
- import { useUserOccupy } from "./useUserOccupy.mjs";
1
+ import { useUserOccupy } from "../../hooks/design-view/components/useUserOccupy.mjs";
2
+ import "../../hooks/index.mjs";
2
3
  import { t } from "@gct-paas/core";
3
4
  import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, resolveComponent, toDisplayString, unref } from "vue";
4
5
  //#region src/components/user-occupy/user-occupy.vue?vue&type=script&setup=true&lang.ts
@@ -1,25 +1,25 @@
1
- .gct-svg-icon[data-v-9b136922] {
1
+ .gct-svg-icon[data-v-1234af11] {
2
2
  margin-right: 8px;
3
3
  font-size: 16px;
4
4
  }
5
- .user-occupy[data-v-9b136922] {
5
+ .user-occupy[data-v-1234af11] {
6
6
  color: #fff;
7
7
  display: flex;
8
8
  align-items: center;
9
9
  line-height: 1em;
10
10
  font-size: 12px;
11
11
  }
12
- .user-occupy__username[data-v-9b136922] {
12
+ .user-occupy__username[data-v-1234af11] {
13
13
  color: var(--ant-primary-color);
14
14
  display: inline-block;
15
15
  white-space: nowrap;
16
16
  overflow: hidden;
17
17
  vertical-align: bottom;
18
18
  }
19
- .user-occupy .iconfont[data-v-9b136922] {
19
+ .user-occupy .gct-assets-svg-icon[data-v-1234af11] {
20
20
  margin-right: 6px;
21
21
  }
22
- .designer-stage .user-occupy[data-v-9b136922],
23
- .so-toolbar .user-occupy[data-v-9b136922] {
22
+ .designer-stage .user-occupy[data-v-1234af11],
23
+ .so-toolbar .user-occupy[data-v-1234af11] {
24
24
  color: #5c616a;
25
25
  }
@@ -228,3 +228,8 @@ export declare enum DesignItemActionTag {
228
228
  */
229
229
  SELECT_PARENT = "select-parent"
230
230
  }
231
+ export declare const newKeyTag = "___new___";
232
+ /**
233
+ * occupy 的 mqtt 唯一实例的 key 标识
234
+ */
235
+ export declare const OCCUPY_MQTT_KEY = "occupy_mqtt_key";
@@ -237,5 +237,10 @@ var DesignItemActionTag = /* @__PURE__ */ function(DesignItemActionTag) {
237
237
  DesignItemActionTag["SELECT_PARENT"] = "select-parent";
238
238
  return DesignItemActionTag;
239
239
  }({});
240
+ var newKeyTag = "___new___";
241
+ /**
242
+ * occupy 的 mqtt 唯一实例的 key 标识
243
+ */
244
+ var OCCUPY_MQTT_KEY = "occupy_mqtt_key";
240
245
  //#endregion
241
- export { ControllerType, DesignItemActionTag, DesignItemAttribute, DesignNodePrefix, DesignNodeType, DesignViewPrefix, InsertNodeMode, MaterialGroup };
246
+ export { ControllerType, DesignItemActionTag, DesignItemAttribute, DesignNodePrefix, DesignNodeType, DesignViewPrefix, InsertNodeMode, MaterialGroup, OCCUPY_MQTT_KEY, newKeyTag };
@@ -1,23 +1,9 @@
1
- import { FormDesignEnum, PrintTypeEnum } from '@gct-paas/core';
1
+ import { FormDesignEnum, PrintTypeEnum, ProcessTypeEnum, ScriptTypeEnum, ModelTypeEnum } from '@gct-paas/core';
2
2
  export declare enum MenuClickEvent {
3
3
  NEW = "new",
4
4
  EDIT = "edit",
5
5
  DELETE = "delete"
6
6
  }
7
- export declare enum ModelTypeEnum {
8
- /** 实体模型 */
9
- ENTITY = "entity_module",
10
- /** 枚举 */
11
- ENUM = "enum_module",
12
- /** 虚拟 */
13
- VIRTUAL = 5,
14
- /** 视图 */
15
- VIEW = "view_model_module",
16
- /** SQL */
17
- SQL = 7,
18
- /** 数据 */
19
- DATA = "data_model"
20
- }
21
7
  export declare enum PageTypeEnum {
22
8
  /** WEB */
23
9
  WEB = "web_module",
@@ -28,37 +14,24 @@ export declare enum PageTypeEnum {
28
14
  /** 统计 */
29
15
  STATISTICS = 8
30
16
  }
31
- export declare enum ScriptTypeEnum {
32
- /** 公共方法 */
33
- GLOBAL_METHOD = "global_method_module",
34
- /** 脚本 */
35
- DEFAULT = "script_module",
36
- /** 编排 */
37
- ORCHESTRATION = "so_module"
38
- }
39
- export declare enum ProcessTypeEnum {
40
- /** 业务流 */
41
- /** 审批流 */
42
- APPROVAL = "approval_process_module"
43
- }
44
17
  export declare const CategoryEnum: {
45
- ONLINE_FORM: FormDesignEnum.ONLINE_FORM;
46
- EDHR: FormDesignEnum.EDHR;
47
- LABEL: PrintTypeEnum.LABEL;
48
- RECEIPT: PrintTypeEnum.RECEIPT;
18
+ GLOBAL_METHOD: ScriptTypeEnum.GLOBAL_METHOD;
19
+ DEFAULT: ScriptTypeEnum.DEFAULT;
20
+ ORCHESTRATION: ScriptTypeEnum.ORCHESTRATION;
49
21
  ENTITY: ModelTypeEnum.ENTITY;
50
22
  ENUM: ModelTypeEnum.ENUM;
51
23
  VIRTUAL: ModelTypeEnum.VIRTUAL;
52
24
  VIEW: ModelTypeEnum.VIEW;
53
25
  SQL: ModelTypeEnum.SQL;
54
26
  DATA: ModelTypeEnum.DATA;
27
+ ONLINE_FORM: FormDesignEnum.ONLINE_FORM;
28
+ EDHR: FormDesignEnum.EDHR;
29
+ LABEL: PrintTypeEnum.LABEL;
30
+ RECEIPT: PrintTypeEnum.RECEIPT;
31
+ APPROVAL: ProcessTypeEnum.APPROVAL;
55
32
  WEB: PageTypeEnum.WEB;
56
33
  MOBILE: PageTypeEnum.MOBILE;
57
34
  PAD: PageTypeEnum.PAD;
58
35
  STATISTICS: PageTypeEnum.STATISTICS;
59
- GLOBAL_METHOD: ScriptTypeEnum.GLOBAL_METHOD;
60
- DEFAULT: ScriptTypeEnum.DEFAULT;
61
- ORCHESTRATION: ScriptTypeEnum.ORCHESTRATION;
62
- APPROVAL: ProcessTypeEnum.APPROVAL;
63
36
  };
64
37
  export type CategoryType = ModelTypeEnum | PageTypeEnum | ScriptTypeEnum | PrintTypeEnum | ProcessTypeEnum;
@@ -1,4 +1,4 @@
1
- import { FormDesignEnum, PrintTypeEnum } from "@gct-paas/core";
1
+ import { FormDesignEnum, ModelTypeEnum, PrintTypeEnum, ProcessTypeEnum, ScriptTypeEnum } from "@gct-paas/core";
2
2
  //#region src/constant/page-designer.ts
3
3
  var MenuClickEvent = /* @__PURE__ */ function(MenuClickEvent) {
4
4
  MenuClickEvent["NEW"] = "new";
@@ -6,21 +6,6 @@ var MenuClickEvent = /* @__PURE__ */ function(MenuClickEvent) {
6
6
  MenuClickEvent["DELETE"] = "delete";
7
7
  return MenuClickEvent;
8
8
  }({});
9
- var ModelTypeEnum = /* @__PURE__ */ function(ModelTypeEnum) {
10
- /** 实体模型 */
11
- ModelTypeEnum["ENTITY"] = "entity_module";
12
- /** 枚举 */
13
- ModelTypeEnum["ENUM"] = "enum_module";
14
- /** 虚拟 */
15
- ModelTypeEnum[ModelTypeEnum["VIRTUAL"] = 5] = "VIRTUAL";
16
- /** 视图 */
17
- ModelTypeEnum["VIEW"] = "view_model_module";
18
- /** SQL */
19
- ModelTypeEnum[ModelTypeEnum["SQL"] = 7] = "SQL";
20
- /** 数据 */
21
- ModelTypeEnum["DATA"] = "data_model";
22
- return ModelTypeEnum;
23
- }({});
24
9
  var PageTypeEnum = /* @__PURE__ */ function(PageTypeEnum) {
25
10
  /** WEB */
26
11
  PageTypeEnum["WEB"] = "web_module";
@@ -32,21 +17,6 @@ var PageTypeEnum = /* @__PURE__ */ function(PageTypeEnum) {
32
17
  PageTypeEnum[PageTypeEnum["STATISTICS"] = 8] = "STATISTICS";
33
18
  return PageTypeEnum;
34
19
  }({});
35
- var ScriptTypeEnum = /* @__PURE__ */ function(ScriptTypeEnum) {
36
- /** 公共方法 */
37
- ScriptTypeEnum["GLOBAL_METHOD"] = "global_method_module";
38
- /** 脚本 */
39
- ScriptTypeEnum["DEFAULT"] = "script_module";
40
- /** 编排 */
41
- ScriptTypeEnum["ORCHESTRATION"] = "so_module";
42
- return ScriptTypeEnum;
43
- }({});
44
- var ProcessTypeEnum = /* @__PURE__ */ function(ProcessTypeEnum) {
45
- /** 业务流 */
46
- /** 审批流 */
47
- ProcessTypeEnum["APPROVAL"] = "approval_process_module";
48
- return ProcessTypeEnum;
49
- }({});
50
20
  var CategoryEnum = {
51
21
  ...ModelTypeEnum,
52
22
  ...PageTypeEnum,
@@ -56,4 +26,4 @@ var CategoryEnum = {
56
26
  ...FormDesignEnum
57
27
  };
58
28
  //#endregion
59
- export { CategoryEnum, MenuClickEvent, ModelTypeEnum, PageTypeEnum, ProcessTypeEnum, ScriptTypeEnum };
29
+ export { CategoryEnum, MenuClickEvent, PageTypeEnum };
@@ -1,11 +1,10 @@
1
1
  import { PageOccupyResponse } from '@gct-paas/api/apaas';
2
- import { DebouncedFunc } from 'lodash-es';
3
2
  import { getGetPageOccupyMsgQuery } from '@gct-paas/api/apaas/apis/designer-lock.service';
4
3
  interface IUserLockInfo {
5
4
  id?: string;
6
5
  name?: string;
7
6
  }
8
- export declare function useUserOccupy(): {
7
+ declare function _useUserOccupy(): {
9
8
  initOccupy: (data: getGetPageOccupyMsgQuery) => void;
10
9
  loadOccupyInfo: () => Promise<void>;
11
10
  occupyInfo: import('vue').Ref<{
@@ -21,7 +20,7 @@ export declare function useUserOccupy(): {
21
20
  occupyName?: string | undefined;
22
21
  querySpanNum?: number | undefined;
23
22
  }>;
24
- occupy: DebouncedFunc<() => Promise<void>>;
23
+ occupy: () => Promise<void> | undefined;
25
24
  cancelOccupy: () => Promise<void>;
26
25
  setLockInfo: (data: IUserLockInfo) => void;
27
26
  lockInfo: import('vue').Ref<{
@@ -35,4 +34,5 @@ export declare function useUserOccupy(): {
35
34
  lock: () => Promise<void>;
36
35
  unlock: () => Promise<void>;
37
36
  };
37
+ export declare const useUserOccupy: typeof _useUserOccupy;
38
38
  export {};
@@ -1,23 +1,22 @@
1
- import { PageTypeEnum, ScriptTypeEnum } from "../../constant/page-designer.mjs";
2
- import "../../constant/index.mjs";
3
- import "../../hooks/design-view/page/usePage.mjs";
4
- import "../../hooks/index.mjs";
5
- import { OCCUPY_MQTT_KEY } from "./occupy.const.mjs";
1
+ import { PageTypeEnum } from "../../../constant/page-designer.mjs";
2
+ import { OCCUPY_MQTT_KEY } from "../../../constant/index.mjs";
3
+ import { pageInfo } from "../design-state.mjs";
6
4
  import { throttle } from "lodash-es";
7
- import { t } from "@gct-paas/core";
5
+ import { ScriptTypeEnum, t } from "@gct-paas/core";
8
6
  import { computed, createVNode, ref } from "vue";
9
7
  import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
8
+ import { createSharedComposable } from "@vueuse/core";
10
9
  import { Modal } from "ant-design-vue";
11
- //#region src/components/user-occupy/useUserOccupy.ts
10
+ //#region src/hooks/design-view/components/useUserOccupy.ts
12
11
  var i18nKeyMap = {
13
12
  [PageTypeEnum.WEB]: "sys.page",
14
13
  [PageTypeEnum.MOBILE]: "sys.page",
15
14
  [PageTypeEnum.PAD]: "sys.page",
16
15
  [ScriptTypeEnum.DEFAULT]: "sys.script"
17
16
  };
18
- /** 参数 */
19
- var params = {};
20
- function useUserOccupy() {
17
+ function _useUserOccupy() {
18
+ /** 参数 */
19
+ let params = {};
21
20
  /** 占用信息 */
22
21
  const occupyInfo = ref({});
23
22
  /** 锁定信息 */
@@ -30,10 +29,19 @@ function useUserOccupy() {
30
29
  });
31
30
  const unlockAvailable = computed(() => {
32
31
  const { userId, username } = _gct.store.userInfo;
33
- 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";
34
35
  });
36
+ function applyLockInfo(data) {
37
+ lockInfo.value = data;
38
+ pageInfo.value.lockUserId = data.id || "";
39
+ pageInfo.value.lockUserName = data.name || "";
40
+ }
35
41
  /** 查询占用定时器 */
36
42
  let occupyTimer = null;
43
+ /** 节流 wait 是否已按真实 cacheNum 初始化 */
44
+ let _occupyThrottleInitialized = false;
37
45
  async function _loadOccupyInfo() {
38
46
  if (!params.id || !params.type || params.id.startsWith("___new___")) return;
39
47
  const res = await _api.apaas.designerLock.getGetPageOccupyMsg(params);
@@ -41,6 +49,11 @@ function useUserOccupy() {
41
49
  if (!data.querySpanNum) data.querySpanNum = 120;
42
50
  if (!data.cacheNum) data.cacheNum = 500;
43
51
  occupyInfo.value = data;
52
+ if (wait.value > 0 && !_occupyThrottleInitialized) {
53
+ _occupyThrottle.cancel();
54
+ _occupyThrottle = throttle(_occupy, wait.value, { trailing: false });
55
+ _occupyThrottleInitialized = true;
56
+ }
44
57
  if (res?.occupyId) destoryOccupyTimer();
45
58
  else if (!occupyTimer) occupyTimer = setInterval(() => {
46
59
  _loadOccupyInfo();
@@ -67,17 +80,20 @@ function useUserOccupy() {
67
80
  })
68
81
  }
69
82
  }).subscribe(CLEAN_CACHE, () => {
70
- const currentUrl = window.location.href;
71
- if (currentUrl.includes("?")) if (currentUrl.includes("reloadTime")) {
72
- const arr = currentUrl.split("reloadTime=");
73
- arr[1] = Date.now().toString();
74
- window.location.href = arr.join("reloadTime=");
75
- } else window.location.href = currentUrl + "&reloadTime=" + Date.now();
76
- else window.location.href = currentUrl + "?reloadTime=" + Date.now();
83
+ const url = new URL(window.location.href);
84
+ url.searchParams.set("reloadTime", Date.now().toString());
85
+ window.location.href = url.toString();
77
86
  location.reload();
78
87
  });
79
88
  }
80
89
  function initOccupy(data) {
90
+ destoryOccupyTimer();
91
+ if (_gct.mqtt.has("occupy_mqtt_key")) _gct.mqtt.destroy(OCCUPY_MQTT_KEY);
92
+ occupyInfo.value = {};
93
+ lockInfo.value = {};
94
+ _occupyThrottle.cancel();
95
+ _occupyThrottle = throttle(_occupy, 0, { trailing: false });
96
+ _occupyThrottleInitialized = false;
81
97
  params = data;
82
98
  initMqttOccupy(params);
83
99
  }
@@ -89,29 +105,32 @@ function useUserOccupy() {
89
105
  if (lockInfo.value.id) return;
90
106
  if (_gct.store.userInfo.userId !== occupyInfo.value.occupyId && occupyInfo.value.occupyId) return;
91
107
  try {
92
- await _api.apaas.designerLock.getGetPageOccupyMsg(params);
108
+ await _api.apaas.designerLock.postOccupyPage(params);
93
109
  } catch (err) {
94
110
  console.warn("【占用异常】", err);
95
111
  } finally {
96
112
  await _loadOccupyInfo();
97
113
  }
98
114
  }
115
+ let _occupyThrottle = throttle(_occupy, 0, { trailing: false });
99
116
  /**
100
117
  * 占用
101
118
  */
102
- const occupy = throttle(_occupy, wait.value, { trailing: false });
119
+ function occupy() {
120
+ return _occupyThrottle();
121
+ }
103
122
  /**
104
123
  * 取消占用
105
124
  */
106
125
  async function cancelOccupy() {
107
126
  if (!params.id || !params.type) return;
108
127
  if (lockInfo.value.id) return;
109
- occupy.cancel();
128
+ _occupyThrottle.cancel();
110
129
  await _api.apaas.designerLock.postCancelOccupyPage(params);
111
130
  await _loadOccupyInfo();
112
131
  }
113
132
  function setLockInfo(data) {
114
- lockInfo.value = data;
133
+ applyLockInfo(data);
115
134
  }
116
135
  /**
117
136
  * 锁定
@@ -127,10 +146,10 @@ function useUserOccupy() {
127
146
  async onOk() {
128
147
  await _api.apaas.designerLock.postLockPage(params);
129
148
  _gct.message.success(t("sys.operationSuccess"));
130
- lockInfo.value = {
131
- id: _gct.store.userInfo.userId,
149
+ applyLockInfo({
150
+ id: String(_gct.store.userInfo.userId),
132
151
  name: _gct.store.userInfo.fullname
133
- };
152
+ });
134
153
  }
135
154
  });
136
155
  }
@@ -138,12 +157,13 @@ function useUserOccupy() {
138
157
  * 解锁
139
158
  */
140
159
  async function unlock() {
160
+ if (!unlockAvailable.value) return;
141
161
  await _api.apaas.designerLock.postUnLockPage(params);
142
162
  _gct.message.success(t("sys.operationSuccess"));
143
- lockInfo.value = {
163
+ applyLockInfo({
144
164
  id: "",
145
165
  name: ""
146
- };
166
+ });
147
167
  }
148
168
  return {
149
169
  initOccupy,
@@ -158,5 +178,6 @@ function useUserOccupy() {
158
178
  unlock
159
179
  };
160
180
  }
181
+ var useUserOccupy = createSharedComposable(_useUserOccupy);
161
182
  //#endregion
162
183
  export { useUserOccupy };