@gct-paas/core 0.1.4-dev.10 → 0.1.4-dev.12
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.esm.min.js +21679 -0
- package/es/constants/core.mjs +5 -4
- package/es/constants/default-date-type/default-date-type.d.ts +70 -0
- package/es/constants/default-date-type/default-date-type.mjs +74 -0
- package/es/constants/editor-register/editor-register.mjs +17 -5
- package/es/constants/expression-type/BuiltOperators.mjs +152 -145
- package/es/constants/expression-type/FunctionKeys.mjs +75 -79
- package/es/constants/expression-type/editor.mjs +10 -3
- package/es/constants/expression-type/function.mjs +602 -613
- package/es/constants/expression-type/index.mjs +111 -113
- package/es/constants/expression-type/modeCfg.mjs +256 -263
- package/es/constants/expression-type/variable.mjs +43 -39
- package/es/constants/form-container-type/form-container-type.mjs +17 -5
- package/es/constants/index.d.ts +2 -1
- package/es/constants/index.mjs +30 -10
- package/es/constants/page-designer/model.d.ts +4 -0
- package/es/constants/page-designer/model.mjs +17 -0
- package/es/create-app-vue.mjs +15 -9
- package/es/enums/app-designer/index.d.ts +19 -0
- package/es/enums/app-designer/index.mjs +131 -63
- package/es/enums/appEnum.mjs +681 -360
- package/es/enums/appStateEnum.mjs +17 -10
- package/es/enums/authActionEnum.mjs +63 -51
- package/es/enums/breakpointEnum.mjs +27 -26
- package/es/enums/cacheEnum.mjs +22 -21
- package/es/enums/designEnum.mjs +110 -71
- package/es/enums/developer-center/integration.mjs +7 -6
- package/es/enums/exceptionEnum.mjs +21 -17
- package/es/enums/expressionEnum.d.ts +1 -1
- package/es/enums/expressionEnum.mjs +81 -74
- package/es/enums/globalEnum.d.ts +15 -0
- package/es/enums/globalEnum.mjs +60 -25
- package/es/enums/httpEnum.mjs +71 -61
- package/es/enums/index.mjs +43 -14
- package/es/enums/menuEnum.mjs +42 -38
- package/es/enums/page-designer/designer.mjs +403 -407
- package/es/enums/page-designer/index.mjs +4 -0
- package/es/enums/page-designer/panel.mjs +341 -213
- package/es/enums/page-designer/toolkit.mjs +13 -12
- package/es/enums/page-designer/widget.d.ts +5 -0
- package/es/enums/page-designer/widget.mjs +426 -334
- package/es/enums/pageEnum.mjs +14 -13
- package/es/enums/plugin-enum.mjs +23 -7
- package/es/enums/processEnum.mjs +95 -60
- package/es/enums/roleEnum.mjs +7 -6
- package/es/enums/sizeEnum.d.ts +18 -0
- package/es/enums/sizeEnum.mjs +28 -8
- package/es/global/gct/gct.d.ts +9 -3
- package/es/global/gct/gct.mjs +84 -91
- package/es/global/index.mjs +1 -0
- package/es/hooks/index.d.ts +0 -2
- package/es/hooks/index.mjs +4 -0
- package/es/hooks/use-app-inst/use-app-inst.mjs +11 -5
- package/es/hooks/use-modal/use-modal.mjs +16 -10
- package/es/hooks/use-sub-app-utils/use-sub-app-utils.mjs +43 -23
- package/es/hooks/useCopyToClipboard.mjs +50 -50
- package/es/index.d.ts +1 -3
- package/es/index.mjs +122 -134
- package/es/interface/i-dictionary/i-dictionary-item.d.ts +6 -0
- package/es/interface/i-global-register/i-global-register.d.ts +8 -0
- package/es/interface/i-pinia-action/i-global-actions.d.ts +4 -0
- package/es/interface/i-pinia-getter/i-global-getters.d.ts +2 -0
- package/es/interface/i-pinia-state/i-global-state.d.ts +12 -1
- package/es/interface/index.d.ts +3 -6
- package/es/interface/model-desginer/entity.d.ts +110 -0
- package/es/interface/provider/index.d.ts +0 -2
- package/es/locale/index.mjs +43 -57
- package/es/modules/env-manager/env-manager.const.mjs +16 -8
- package/es/modules/env-manager/env-manager.interface.mjs +14 -7
- package/es/modules/env-manager/env-manager.mjs +104 -107
- package/es/modules/error-handler/error-handler.const.mjs +11 -16
- package/es/modules/error-handler/error-strategy.mjs +199 -175
- package/es/modules/error-handler/index.mjs +120 -106
- package/es/modules/mqtt/constants/mqtt.const.d.ts +33 -0
- package/es/modules/mqtt/constants/mqtt.const.mjs +24 -0
- package/es/modules/mqtt/enums/mqtt-status.enum.d.ts +20 -0
- package/es/modules/mqtt/enums/mqtt-status.enum.mjs +24 -0
- package/es/modules/mqtt/index.d.ts +5 -0
- package/es/modules/mqtt/index.mjs +4 -0
- package/es/modules/mqtt/interfaces/i-mqtt.d.ts +139 -0
- package/es/modules/mqtt/mqtt-client.d.ts +117 -0
- package/es/modules/mqtt/mqtt-client.mjs +229 -0
- package/es/modules/mqtt/mqtt-manager.d.ts +87 -0
- package/es/modules/mqtt/mqtt-manager.mjs +118 -0
- package/es/modules/platform-config/constants/index.mjs +4 -0
- package/es/modules/platform-config/constants/login.const.mjs +48 -45
- package/es/modules/platform-config/constants/org.const.mjs +57 -52
- package/es/modules/platform-config/constants/theme.const.mjs +11 -4
- package/es/modules/platform-config/constants/watermark.const.mjs +17 -12
- package/es/modules/platform-config/enums/deploy.enum.mjs +13 -6
- package/es/modules/platform-config/enums/login.enum.mjs +29 -15
- package/es/modules/platform-config/enums/platform.enum.d.ts +0 -15
- package/es/modules/platform-config/enums/platform.enum.mjs +17 -26
- package/es/modules/platform-config/index.mjs +9 -0
- package/es/modules/platform-config/interfaces/index.d.ts +0 -1
- package/es/modules/platform-config/store.mjs +68 -76
- package/es/modules/platform-config/useBasicSetting.mjs +47 -35
- package/es/modules/platform-config/useDeploySetting.mjs +29 -21
- package/es/modules/platform-config/useLoginSetting.mjs +151 -173
- package/es/modules/platform-config/useOrgSetting.mjs +63 -62
- package/es/modules/platform-config/useProjectSetting.mjs +14 -6
- package/es/modules/platform-config/useSecuritySetting.mjs +68 -56
- package/es/modules/platform-config/useThemeSetting.mjs +78 -59
- package/es/modules/platform-config/useWatermarkSetting.mjs +37 -23
- package/es/modules/user-stores/index.mjs +3 -0
- package/es/modules/user-stores/store/permission.store.mjs +27 -36
- package/es/modules/user-stores/store/tenant.store.mjs +20 -22
- package/es/modules/user-stores/store/user.store.d.ts +74 -0
- package/es/modules/user-stores/store/user.store.mjs +94 -102
- package/es/modules/user-stores/types/user.d.ts +1 -0
- package/es/router/index.mjs +25 -28
- package/es/setup-app.mjs +23 -28
- package/es/state/global-pinia-state/global-pinia-state.d.ts +15 -1
- package/es/state/global-pinia-state/global-pinia-state.mjs +49 -57
- package/es/state/index.d.ts +0 -9
- package/es/state/index.mjs +1 -0
- package/es/store/global-store.mjs +50 -58
- package/es/store/index.mjs +25 -19
- package/es/types/index.d.ts +7 -0
- package/es/utils/axios/interceptors.mjs +21 -17
- package/es/utils/cache-adapter/cache-adapter.mjs +61 -56
- package/es/utils/design/design.d.ts +11 -0
- package/es/utils/design/design.mjs +21 -0
- package/es/utils/deviceFingerprint.mjs +74 -63
- package/es/utils/dictionary/dictionary.mjs +142 -145
- package/es/utils/file/base64Conver.d.ts +9 -0
- package/es/utils/file/base64Conver.mjs +40 -0
- package/es/utils/file/download.d.ts +44 -0
- package/es/utils/file/download.mjs +103 -0
- package/es/utils/file/parser.d.ts +3 -0
- package/es/utils/file/parser.mjs +29 -0
- package/es/utils/i18n/index.mjs +14 -3
- package/es/utils/index.d.ts +7 -2
- package/es/utils/index.mjs +31 -0
- package/es/utils/is-sort-filed/is-sort-filed.mjs +42 -37
- package/es/utils/linked-list/linked-list.mjs +115 -118
- package/es/utils/linked-node/linked-node.mjs +41 -31
- package/es/utils/lowcode/utils.mjs +13 -18
- package/es/utils/lowcode/validate.mjs +20 -26
- package/es/utils/mitt/mitt.mjs +4 -4
- package/es/utils/model-loader/model-loader.mjs +280 -325
- package/es/utils/namespace/namespace.mjs +178 -164
- package/es/utils/openUtil/index.mjs +2 -0
- package/es/utils/openUtil/modal/modal.mjs +72 -79
- package/es/utils/openUtil/overlay-container/overlay-container.mjs +144 -138
- package/es/utils/permission.d.ts +19 -0
- package/es/utils/permission.mjs +34 -0
- package/es/utils/plugin-static-resource/plugin-static-resource.mjs +46 -42
- package/es/utils/style/index.mjs +94 -138
- package/es/utils/tools/tools.mjs +86 -54
- package/es/utils/treeHelper/treeHelper.mjs +205 -233
- package/es/utils/uploader/uploader.d.ts +20 -0
- package/es/utils/uploader/uploader.mjs +86 -0
- package/es/utils/useUUid.mjs +79 -87
- package/es/utils/util.mjs +55 -35
- package/es/utils/uuid/uuid.d.ts +1 -0
- package/es/utils/uuid/uuid.mjs +36 -43
- package/es/utils/validate.d.ts +5 -0
- package/es/utils/validate.mjs +21 -0
- package/es/utils/value-helper/value-helper.mjs +113 -98
- package/package.json +14 -14
- package/dist/index.esm.min.mjs +0 -8101
- package/dist/index.min.cjs +0 -386
- package/dist/index.system.min.js +0 -386
- package/es/constants/editor-type/editor-type.d.ts +0 -244
- package/es/constants/editor-type/editor-type.mjs +0 -63
- package/es/controller/edit-form/edit-form.controller.d.ts +0 -28
- package/es/controller/edit-form/edit-form.controller.mjs +0 -47
- package/es/controller/editor/color-editor.controller.d.ts +0 -13
- package/es/controller/editor/color-editor.controller.mjs +0 -6
- package/es/controller/editor/length-unit-editor.controller.d.ts +0 -13
- package/es/controller/editor/length-unit-editor.controller.mjs +0 -6
- package/es/controller/editor-item/editor-item.controller.d.ts +0 -14
- package/es/controller/editor-item/editor-item.controller.mjs +0 -8
- package/es/controller/form/form.controller.d.ts +0 -76
- package/es/controller/form/form.controller.mjs +0 -147
- package/es/controller/form-collapse/form-collapse.controller.d.ts +0 -18
- package/es/controller/form-collapse/form-collapse.controller.mjs +0 -14
- package/es/controller/form-collapse-pane/form-collapse-pane.controller.d.ts +0 -18
- package/es/controller/form-collapse-pane/form-collapse-pane.controller.mjs +0 -14
- package/es/controller/form-edit-item/form-edit-item.controller.d.ts +0 -27
- package/es/controller/form-edit-item/form-edit-item.controller.mjs +0 -74
- package/es/controller/form-group/form-group.controller.d.ts +0 -18
- package/es/controller/form-group/form-group.controller.mjs +0 -14
- package/es/controller/form-item/form-item.controller.d.ts +0 -21
- package/es/controller/form-item/form-item.controller.mjs +0 -43
- package/es/controller/form-item-basic/form-item-basic.controller.d.ts +0 -57
- package/es/controller/form-item-basic/form-item-basic.controller.mjs +0 -49
- package/es/controller/form-item-hidden/form-item-hidden.controller.d.ts +0 -17
- package/es/controller/form-item-hidden/form-item-hidden.controller.mjs +0 -7
- package/es/controller/form-tab/form-tab.controller.d.ts +0 -18
- package/es/controller/form-tab/form-tab.controller.mjs +0 -14
- package/es/controller/form-tab-pane/form-tab-pane.controller.d.ts +0 -18
- package/es/controller/form-tab-pane/form-tab-pane.controller.mjs +0 -14
- package/es/controller/gct-form/gct-form.controller.d.ts +0 -101
- package/es/controller/gct-form/gct-form.controller.mjs +0 -214
- package/es/controller/index.d.ts +0 -15
- package/es/hooks/use-form/use-form.d.ts +0 -10
- package/es/hooks/use-form/use-form.mjs +0 -8
- package/es/hooks/use-gct-form-value/use-gct-form-value.d.ts +0 -22
- package/es/hooks/use-gct-form-value/use-gct-form-value.mjs +0 -89
- package/es/hooks/use-overlay-scrollbars/use-overlay-scrollbars.d.ts +0 -11
- package/es/interface/controller/edit-form/edit-form.controller.d.ts +0 -26
- package/es/interface/controller/editor/i-color-editor.controller.d.ts +0 -11
- package/es/interface/controller/editor/i-length-unit-editor.controller.d.ts +0 -11
- package/es/interface/controller/editor-item/editor-item.controller.d.ts +0 -19
- package/es/interface/controller/form/form.controller.d.ts +0 -121
- package/es/interface/controller/form-collapse/form-collapse.controller.d.ts +0 -23
- package/es/interface/controller/form-collapse-pane/form-collapse-pane.controller.d.ts +0 -23
- package/es/interface/controller/form-edit-item/form-edit-item.controller.d.ts +0 -59
- package/es/interface/controller/form-group/form-group.controller.d.ts +0 -24
- package/es/interface/controller/form-hidden-item/form-hidden-item.controller.d.ts +0 -24
- package/es/interface/controller/form-item/form-item.controller.d.ts +0 -40
- package/es/interface/controller/form-item-basic/form-item-basic.controller.d.ts +0 -51
- package/es/interface/controller/form-tab/form-tab.controller.d.ts +0 -23
- package/es/interface/controller/form-tab-pane/form-tab-pane.controller.d.ts +0 -23
- package/es/interface/controller/index.d.ts +0 -14
- package/es/interface/events/form/i-form.event.d.ts +0 -11
- package/es/interface/events/index.d.ts +0 -1
- package/es/interface/form/i-editor/i-check-switch.d.ts +0 -29
- package/es/interface/form/i-editor/i-checkbox-editor.d.ts +0 -9
- package/es/interface/form/i-editor/i-color-editor.d.ts +0 -13
- package/es/interface/form/i-editor/i-editor-basic.d.ts +0 -87
- package/es/interface/form/i-editor/i-icon-select-editor.d.ts +0 -21
- package/es/interface/form/i-editor/i-info-editor.d.ts +0 -21
- package/es/interface/form/i-editor/i-length-unit-editor.d.ts +0 -13
- package/es/interface/form/i-editor/i-model-field-select-editor.d.ts +0 -18
- package/es/interface/form/i-editor/i-number-editor.d.ts +0 -21
- package/es/interface/form/i-editor/i-picker-editor.d.ts +0 -30
- package/es/interface/form/i-editor/i-radio-editor.d.ts +0 -21
- package/es/interface/form/i-editor/i-select-editor.d.ts +0 -14
- package/es/interface/form/i-editor/i-span-editor.d.ts +0 -30
- package/es/interface/form/i-editor/i-switch-editor.d.ts +0 -14
- package/es/interface/form/i-editor/i-text-editor.d.ts +0 -46
- package/es/interface/form/i-editor/i-textarea-editor.d.ts +0 -25
- package/es/interface/form/i-form/i-edit-form.d.ts +0 -48
- package/es/interface/form/i-form/i-form-collapse-pane.d.ts +0 -30
- package/es/interface/form/i-form/i-form-collapse.d.ts +0 -35
- package/es/interface/form/i-form/i-form-container.d.ts +0 -53
- package/es/interface/form/i-form/i-form-edit-item.d.ts +0 -140
- package/es/interface/form/i-form/i-form-group-container.d.ts +0 -24
- package/es/interface/form/i-form/i-form-group.d.ts +0 -35
- package/es/interface/form/i-form/i-form-hidden-item.d.ts +0 -11
- package/es/interface/form/i-form/i-form-item-basic.d.ts +0 -126
- package/es/interface/form/i-form/i-form-item.d.ts +0 -11
- package/es/interface/form/i-form/i-form-tab-pane.d.ts +0 -23
- package/es/interface/form/i-form/i-form-tab.d.ts +0 -21
- package/es/interface/form/i-form/i-form.d.ts +0 -79
- package/es/interface/form/index.d.ts +0 -29
- package/es/interface/layout/i-flex-layout/i-flex-container.d.ts +0 -75
- package/es/interface/layout/i-flex-layout/i-flex-item.d.ts +0 -51
- package/es/interface/layout/i-grid-layout/i-grid-container.d.ts +0 -29
- package/es/interface/layout/i-grid-layout/i-grid-item-span.d.ts +0 -54
- package/es/interface/layout/i-grid-layout/i-grid-item.d.ts +0 -37
- package/es/interface/layout/i-layout-basis/i-layout-container-basis.d.ts +0 -11
- package/es/interface/layout/index.d.ts +0 -6
- package/es/interface/provider/i-editor-provider/i-editor-provider.d.ts +0 -24
- package/es/interface/provider/i-form-item-provider/i-form-item-provider.d.ts +0 -44
- package/es/interface/state/form/form.state.d.ts +0 -53
- package/es/interface/state/form-collapse/form-collapse.state.d.ts +0 -11
- package/es/interface/state/form-collapse-pane/form-collapse-pane.state.d.ts +0 -11
- package/es/interface/state/form-edit-item/form-edit-item.state.d.ts +0 -38
- package/es/interface/state/form-group/form-group.state.d.ts +0 -21
- package/es/interface/state/form-hidden-item/form-hidden-item.state.d.ts +0 -5
- package/es/interface/state/form-item/form-item.state.d.ts +0 -20
- package/es/interface/state/form-item-basic/form-item-basic.state.d.ts +0 -63
- package/es/interface/state/form-tab/form-tab.state.d.ts +0 -19
- package/es/interface/state/form-tab-pane/form-tab-pane.state.d.ts +0 -11
- package/es/interface/state/index.d.ts +0 -10
- package/es/modules/platform-config/interfaces/global-setting.interface.d.ts +0 -7
- package/es/register/editor-register/editor-register.d.ts +0 -49
- package/es/register/editor-register/editor-register.mjs +0 -57
- package/es/register/form-item-register/form-item-register.d.ts +0 -36
- package/es/register/form-item-register/form-item-register.mjs +0 -42
- package/es/register/index.d.ts +0 -14
- package/es/state/form/form.state.d.ts +0 -24
- package/es/state/form/form.state.mjs +0 -16
- package/es/state/form-collapse/form-collapse.state.d.ts +0 -14
- package/es/state/form-collapse/form-collapse.state.mjs +0 -6
- package/es/state/form-collapse-pane/form-collapse-pane.state.d.ts +0 -14
- package/es/state/form-collapse-pane/form-collapse-pane.state.mjs +0 -6
- package/es/state/form-edit-item/form-edit-item.state.d.ts +0 -17
- package/es/state/form-edit-item/form-edit-item.state.mjs +0 -10
- package/es/state/form-group/form-group.state.d.ts +0 -21
- package/es/state/form-group/form-group.state.mjs +0 -14
- package/es/state/form-item/form-item.state.d.ts +0 -14
- package/es/state/form-item/form-item.state.mjs +0 -6
- package/es/state/form-item-basic/form-item-basic.state.d.ts +0 -17
- package/es/state/form-item-basic/form-item-basic.state.mjs +0 -9
- package/es/state/form-tab/form-tab.state.d.ts +0 -15
- package/es/state/form-tab/form-tab.state.mjs +0 -7
- package/es/state/form-tab-pane/form-tab-pane.state.d.ts +0 -14
- package/es/state/form-tab-pane/form-tab-pane.state.mjs +0 -6
- package/es/utils/props/gct-form-item/gct-form-item.props.d.ts +0 -63
- package/es/utils/props/gct-form-item/gct-form-item.props.mjs +0 -66
- package/es/utils/props/index.d.ts +0 -1
- package/es/utils/width-install/width-install.d.ts +0 -17
- package/es/utils/width-install/width-install.mjs +0 -23
|
@@ -1,326 +1,281 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
enumKeysToDelete.forEach((key) => {
|
|
284
|
-
this.enumCache.delete(key);
|
|
285
|
-
this.enumLoadingCache.delete(key);
|
|
286
|
-
});
|
|
287
|
-
const queryRefKeysToDelete = [];
|
|
288
|
-
this.queryRefDataCache.forEach((_, cacheKey) => {
|
|
289
|
-
if (cacheKey.includes(`"modelKey":"${modelKey}"`)) {
|
|
290
|
-
queryRefKeysToDelete.push(cacheKey);
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
queryRefKeysToDelete.forEach((key) => {
|
|
294
|
-
this.queryRefDataCache.delete(key);
|
|
295
|
-
this.queryRefDataLoadingCache.delete(key);
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* 清除所有模型缓存
|
|
300
|
-
*
|
|
301
|
-
* @author chitanda
|
|
302
|
-
* @date 2025-06-20 16:06:35
|
|
303
|
-
*/
|
|
304
|
-
clearAll() {
|
|
305
|
-
this.modelCache.clear();
|
|
306
|
-
this.modelLoadingCache.clear();
|
|
307
|
-
this.modelsLoadingCache.clear();
|
|
308
|
-
this.enumCache.clear();
|
|
309
|
-
this.enumLoadingCache.clear();
|
|
310
|
-
this.queryRefDataCache.clear();
|
|
311
|
-
this.queryRefDataLoadingCache.clear();
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* 获取所有已缓存的模型键
|
|
315
|
-
*
|
|
316
|
-
* @author chitanda
|
|
317
|
-
* @date 2025-06-20 16:06:55
|
|
318
|
-
* @returns {*} {string[]}
|
|
319
|
-
*/
|
|
320
|
-
keys() {
|
|
321
|
-
return Array.from(this.modelCache.keys());
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
const modelLoader = new ModelLoader();
|
|
325
|
-
|
|
1
|
+
import { EntityModelCategoryEnum } from "../../enums/app-designer/index.mjs";
|
|
2
|
+
import "../../enums/index.mjs";
|
|
3
|
+
import { cloneDeep } from "lodash-es";
|
|
4
|
+
//#region src/utils/model-loader/model-loader.ts
|
|
5
|
+
/**
|
|
6
|
+
* 模型加载器,提供模型缓存和请求去重功能
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2025-06-20 16:06:12
|
|
10
|
+
* @class ModelLoader
|
|
11
|
+
*/
|
|
12
|
+
var ModelLoader = class {
|
|
13
|
+
CACHE_EXPIRATION_TIME = 600 * 1e3;
|
|
14
|
+
modelCache = /* @__PURE__ */ new Map();
|
|
15
|
+
modelLoadingCache = /* @__PURE__ */ new Map();
|
|
16
|
+
modelsLoadingCache = /* @__PURE__ */ new Map();
|
|
17
|
+
enumCache = /* @__PURE__ */ new Map();
|
|
18
|
+
enumLoadingCache = /* @__PURE__ */ new Map();
|
|
19
|
+
queryRefDataCache = /* @__PURE__ */ new Map();
|
|
20
|
+
queryRefDataLoadingCache = /* @__PURE__ */ new Map();
|
|
21
|
+
/**
|
|
22
|
+
* 检查缓存条目是否过期
|
|
23
|
+
*
|
|
24
|
+
* @param {CacheEntry<any>} entry
|
|
25
|
+
* @returns {*} {boolean}
|
|
26
|
+
*/
|
|
27
|
+
isExpired(entry) {
|
|
28
|
+
return Date.now() > entry.expiresAt;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 创建缓存条目
|
|
32
|
+
*
|
|
33
|
+
* @param {T} data
|
|
34
|
+
* @returns {*} {CacheEntry<T>}
|
|
35
|
+
*/
|
|
36
|
+
createCacheEntry(data) {
|
|
37
|
+
return {
|
|
38
|
+
data,
|
|
39
|
+
expiresAt: Date.now() + this.CACHE_EXPIRATION_TIME
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 加载模型信息,具有缓存和请求去重功能
|
|
44
|
+
*
|
|
45
|
+
* @author chitanda
|
|
46
|
+
* @date 2025-06-20 16:06:05
|
|
47
|
+
* @param {string} modelKey
|
|
48
|
+
* @returns {*} {Promise<ModelMetaDTO>}
|
|
49
|
+
*/
|
|
50
|
+
async loadModel(modelKey) {
|
|
51
|
+
if (this.modelCache.has(modelKey)) {
|
|
52
|
+
const cacheEntry = this.modelCache.get(modelKey);
|
|
53
|
+
if (!this.isExpired(cacheEntry)) return cacheEntry.data;
|
|
54
|
+
this.modelCache.delete(modelKey);
|
|
55
|
+
}
|
|
56
|
+
if (this.modelLoadingCache.has(modelKey)) return this.modelLoadingCache.get(modelKey);
|
|
57
|
+
const loadPromise = (async () => {
|
|
58
|
+
try {
|
|
59
|
+
const data = await _api.apaas.modelMeta.getDetail({ modelKey });
|
|
60
|
+
if (data) {
|
|
61
|
+
this.modelCache.set(modelKey, this.createCacheEntry(data));
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
65
|
+
} finally {
|
|
66
|
+
this.modelLoadingCache.delete(modelKey);
|
|
67
|
+
}
|
|
68
|
+
})();
|
|
69
|
+
this.modelLoadingCache.set(modelKey, loadPromise);
|
|
70
|
+
return loadPromise;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 加载多个模型信息
|
|
74
|
+
*
|
|
75
|
+
* @author chitanda
|
|
76
|
+
* @date 2025-06-22 15:06:54
|
|
77
|
+
* @param {string[]} modelKeys
|
|
78
|
+
* @returns {*} {Promise<ModelMetaDTO[]>}
|
|
79
|
+
*/
|
|
80
|
+
async loadModels(modelKeys) {
|
|
81
|
+
const cacheKey = modelKeys.join(",");
|
|
82
|
+
if (modelKeys.every((key) => {
|
|
83
|
+
const entry = this.modelCache.get(key);
|
|
84
|
+
return entry && !this.isExpired(entry);
|
|
85
|
+
})) return modelKeys.map((key) => this.modelCache.get(key).data);
|
|
86
|
+
modelKeys.forEach((key) => {
|
|
87
|
+
const entry = this.modelCache.get(key);
|
|
88
|
+
if (entry && this.isExpired(entry)) this.modelCache.delete(key);
|
|
89
|
+
});
|
|
90
|
+
if (this.modelsLoadingCache.has(cacheKey)) return this.modelsLoadingCache.get(cacheKey);
|
|
91
|
+
const loadPromise = (async () => {
|
|
92
|
+
try {
|
|
93
|
+
const pendingKeys = modelKeys.filter((key) => !this.modelCache.has(key));
|
|
94
|
+
if (pendingKeys.length > 0) {
|
|
95
|
+
const data = await _api.apaas.modelMeta.getByKeys({ modelKeys: pendingKeys.join(",") });
|
|
96
|
+
if (data && data.length > 0) data.forEach((model) => {
|
|
97
|
+
this.modelCache.set(model.key, this.createCacheEntry(model));
|
|
98
|
+
model.fieldMetaList = model.fieldMetas || [];
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return modelKeys.map((key) => {
|
|
102
|
+
return this.modelCache.get(key).data;
|
|
103
|
+
});
|
|
104
|
+
} finally {
|
|
105
|
+
this.modelsLoadingCache.delete(cacheKey);
|
|
106
|
+
}
|
|
107
|
+
})();
|
|
108
|
+
this.modelsLoadingCache.set(cacheKey, loadPromise);
|
|
109
|
+
return loadPromise;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 加载指定模型的字段信息
|
|
113
|
+
*
|
|
114
|
+
* @author chitanda
|
|
115
|
+
* @date 2025-06-22 14:06:37
|
|
116
|
+
* @param {string} modelKey
|
|
117
|
+
* @param {string} fieldKey
|
|
118
|
+
* @returns {*} {(Promise<FieldMetaDTO | undefined>)}
|
|
119
|
+
*/
|
|
120
|
+
async loadField(modelKey, fieldKey) {
|
|
121
|
+
const model = await this.loadModel(modelKey);
|
|
122
|
+
if (model?.fieldMetaList) return model.fieldMetaList.find((field) => field.key === fieldKey);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 加载指定模型的字段路径信息
|
|
126
|
+
*
|
|
127
|
+
* @author chitanda
|
|
128
|
+
* @date 2025-06-22 14:06:11
|
|
129
|
+
* @param {string} modelKey
|
|
130
|
+
* @param {string} fieldKey
|
|
131
|
+
* @returns {*} {Promise<string[]>}
|
|
132
|
+
*/
|
|
133
|
+
async loadFieldPaths(modelKey, fieldKey, fieldCodeChain) {
|
|
134
|
+
if (!fieldCodeChain) return [];
|
|
135
|
+
const list = [];
|
|
136
|
+
const isFieldModel = !!fieldCodeChain.bindFieldKey;
|
|
137
|
+
const modelKeys = isFieldModel ? fieldCodeChain.modelLink || [fieldCodeChain.belongModelKey, fieldCodeChain.bindModelKey] : [fieldCodeChain.modelKey];
|
|
138
|
+
const models = await this.loadModels(modelKeys);
|
|
139
|
+
if (isFieldModel) list.push(...models.map((model) => model.name));
|
|
140
|
+
else {
|
|
141
|
+
const model = await this.loadModel(fieldCodeChain.modelKey);
|
|
142
|
+
if (model) list.push(model.name);
|
|
143
|
+
}
|
|
144
|
+
const model = await this.loadModel(modelKey);
|
|
145
|
+
if (model?.fieldMetaList) {
|
|
146
|
+
const field = model.fieldMetaList.find((field) => field.key === fieldKey);
|
|
147
|
+
if (field) list.push(field.name);
|
|
148
|
+
}
|
|
149
|
+
return list;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* 加载指定模型的枚举列表
|
|
153
|
+
*
|
|
154
|
+
* @param {string} modelKey
|
|
155
|
+
* @param {string} fieldKey
|
|
156
|
+
* @param {string} [modelCategory=EntityModelCategoryEnum.ENTITY]
|
|
157
|
+
* @returns {*} {Promise<IObject[]>}
|
|
158
|
+
*/
|
|
159
|
+
async loadEnumList(modelKey, fieldKey, modelCategory = EntityModelCategoryEnum.ENTITY) {
|
|
160
|
+
const cacheKey = `${modelCategory}:${modelKey}:${fieldKey}`;
|
|
161
|
+
if (this.enumCache.has(cacheKey)) {
|
|
162
|
+
const cacheEntry = this.enumCache.get(cacheKey);
|
|
163
|
+
if (!this.isExpired(cacheEntry)) return cloneDeep(cacheEntry.data);
|
|
164
|
+
this.enumCache.delete(cacheKey);
|
|
165
|
+
this.enumLoadingCache.delete(cacheKey);
|
|
166
|
+
}
|
|
167
|
+
if (this.enumLoadingCache.has(cacheKey)) return this.enumLoadingCache.get(cacheKey);
|
|
168
|
+
const loadPromise = (async () => {
|
|
169
|
+
try {
|
|
170
|
+
return [];
|
|
171
|
+
} finally {
|
|
172
|
+
this.enumLoadingCache.delete(cacheKey);
|
|
173
|
+
}
|
|
174
|
+
})();
|
|
175
|
+
this.enumLoadingCache.set(cacheKey, loadPromise);
|
|
176
|
+
return loadPromise;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 加载关联数据查询(QueryRef)
|
|
180
|
+
*
|
|
181
|
+
* @param {QueryRefDataRequest} request
|
|
182
|
+
* @returns {*} {Promise<ModelPageableRow>}
|
|
183
|
+
*/
|
|
184
|
+
async loadQueryRefData(request) {
|
|
185
|
+
if (!request || !request.modelKey) throw new Error(`queryRefData 参数缺失`);
|
|
186
|
+
const cacheKey = JSON.stringify(request);
|
|
187
|
+
if (this.queryRefDataCache.has(cacheKey)) {
|
|
188
|
+
const cacheEntry = this.queryRefDataCache.get(cacheKey);
|
|
189
|
+
if (!this.isExpired(cacheEntry)) return cloneDeep(cacheEntry.data);
|
|
190
|
+
this.queryRefDataCache.delete(cacheKey);
|
|
191
|
+
this.queryRefDataLoadingCache.delete(cacheKey);
|
|
192
|
+
}
|
|
193
|
+
if (this.queryRefDataLoadingCache.has(cacheKey)) return this.queryRefDataLoadingCache.get(cacheKey);
|
|
194
|
+
const loadPromise = (async () => {
|
|
195
|
+
try {
|
|
196
|
+
const data = await _api.apaas.modelData.postQueryRefData(request);
|
|
197
|
+
if (data) {
|
|
198
|
+
this.queryRefDataCache.set(cacheKey, this.createCacheEntry(data));
|
|
199
|
+
return cloneDeep(data);
|
|
200
|
+
}
|
|
201
|
+
return {};
|
|
202
|
+
} finally {
|
|
203
|
+
this.queryRefDataLoadingCache.delete(cacheKey);
|
|
204
|
+
}
|
|
205
|
+
})();
|
|
206
|
+
this.queryRefDataLoadingCache.set(cacheKey, loadPromise);
|
|
207
|
+
return loadPromise;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 获取已缓存的模型
|
|
211
|
+
* @param modelKey 模型键
|
|
212
|
+
* @returns ModelMetaDTO | undefined
|
|
213
|
+
*/
|
|
214
|
+
getCachedModel(modelKey) {
|
|
215
|
+
const entry = this.modelCache.get(modelKey);
|
|
216
|
+
if (entry && !this.isExpired(entry)) return entry.data;
|
|
217
|
+
if (entry && this.isExpired(entry)) this.modelCache.delete(modelKey);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* 清除指定模型的缓存
|
|
221
|
+
*
|
|
222
|
+
* @author chitanda
|
|
223
|
+
* @date 2025-06-20 16:06:41
|
|
224
|
+
* @param {string} modelKey
|
|
225
|
+
*/
|
|
226
|
+
clear(modelKey) {
|
|
227
|
+
this.modelCache.delete(modelKey);
|
|
228
|
+
this.modelLoadingCache.delete(modelKey);
|
|
229
|
+
const keysToDelete = [];
|
|
230
|
+
this.modelsLoadingCache.forEach((_, cacheKey) => {
|
|
231
|
+
if (cacheKey.includes(modelKey)) keysToDelete.push(cacheKey);
|
|
232
|
+
});
|
|
233
|
+
keysToDelete.forEach((key) => {
|
|
234
|
+
this.modelsLoadingCache.delete(key);
|
|
235
|
+
});
|
|
236
|
+
const enumKeysToDelete = [];
|
|
237
|
+
this.enumCache.forEach((_, cacheKey) => {
|
|
238
|
+
if (cacheKey.includes(modelKey)) enumKeysToDelete.push(cacheKey);
|
|
239
|
+
});
|
|
240
|
+
enumKeysToDelete.forEach((key) => {
|
|
241
|
+
this.enumCache.delete(key);
|
|
242
|
+
this.enumLoadingCache.delete(key);
|
|
243
|
+
});
|
|
244
|
+
const queryRefKeysToDelete = [];
|
|
245
|
+
this.queryRefDataCache.forEach((_, cacheKey) => {
|
|
246
|
+
if (cacheKey.includes(`"modelKey":"${modelKey}"`)) queryRefKeysToDelete.push(cacheKey);
|
|
247
|
+
});
|
|
248
|
+
queryRefKeysToDelete.forEach((key) => {
|
|
249
|
+
this.queryRefDataCache.delete(key);
|
|
250
|
+
this.queryRefDataLoadingCache.delete(key);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* 清除所有模型缓存
|
|
255
|
+
*
|
|
256
|
+
* @author chitanda
|
|
257
|
+
* @date 2025-06-20 16:06:35
|
|
258
|
+
*/
|
|
259
|
+
clearAll() {
|
|
260
|
+
this.modelCache.clear();
|
|
261
|
+
this.modelLoadingCache.clear();
|
|
262
|
+
this.modelsLoadingCache.clear();
|
|
263
|
+
this.enumCache.clear();
|
|
264
|
+
this.enumLoadingCache.clear();
|
|
265
|
+
this.queryRefDataCache.clear();
|
|
266
|
+
this.queryRefDataLoadingCache.clear();
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* 获取所有已缓存的模型键
|
|
270
|
+
*
|
|
271
|
+
* @author chitanda
|
|
272
|
+
* @date 2025-06-20 16:06:55
|
|
273
|
+
* @returns {*} {string[]}
|
|
274
|
+
*/
|
|
275
|
+
keys() {
|
|
276
|
+
return Array.from(this.modelCache.keys());
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
var modelLoader = new ModelLoader();
|
|
280
|
+
//#endregion
|
|
326
281
|
export { modelLoader };
|