cx-chat 0.0.1 → 0.0.3
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/cx-chat.css +1 -0
- package/dist/cx-chat.es.js +97326 -0
- package/dist/cx-chat.umd.js +734 -0
- package/package.json +21 -1
- package/.cursor/rules/i18n-cn-gloss-comments.mdc +0 -31
- package/.cursor/rules/list-page-view-pageconfig.mdc +0 -32
- package/.cursor/rules/no-over-defensive-programming.mdc +0 -90
- package/.cursor/rules/requirement-description-for-agent.mdc +0 -33
- package/.cursor/rules/use-showToast-not-antd-message.mdc +0 -28
- package/.docker/Dockerfile +0 -7
- package/.env +0 -9
- package/.env.development +0 -7
- package/.env.production +0 -7
- package/.gitlab-ci/docker-build.yaml +0 -28
- package/.gitlab-ci/k8s-deploy-dev-master.yaml +0 -42
- package/.gitlab-ci/npm-build.yaml +0 -17
- package/.gitlab-ci.yml +0 -8
- package/.k8s/0-namespace.yaml +0 -6
- package/.k8s/1-configmap-web.yaml +0 -7
- package/.k8s/1-nginx-conf-dev.yaml +0 -110
- package/.k8s/2-deployment.yaml +0 -27
- package/.k8s/3-service.yaml +0 -16
- package/.k8s/4-ingress-dev.yaml +0 -30
- package/.lingma/rules/use-showToast-not-antd-message.md +0 -34
- package/.nginx/nginx.conf +0 -52
- package/.prettierrc +0 -9
- package/eslint.config.js +0 -32
- package/index.html +0 -13
- package/postcss.config.js +0 -6
- package/src/App.tsx +0 -96
- package/src/_doc/0.docs-overview.md +0 -28
- package/src/_doc/cx-ui/0.docs-overview.md +0 -30
- package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +0 -82
- package/src/_doc/cx-ui/comp.2.cx-modal.md +0 -82
- package/src/_doc/cx-ui/comp.3.cx-button.md +0 -89
- package/src/_doc/cx-ui/comp.4.cx-form.md +0 -72
- package/src/_doc/cx-ui/comp.5.cx-fields.md +0 -76
- package/src/_doc/cx-ui/comp.6.cx-tag.md +0 -57
- package/src/_doc/cx-ui/comp.7.cx-empty-state.md +0 -29
- package/src/_doc/meta/0.docs-overview.md +0 -24
- package/src/_doc/meta/comp.1.enum-runtime.md +0 -33
- package/src/_doc/meta/comp.2.dict-runtime.md +0 -39
- package/src/_doc/router/0.docs-overview.md +0 -14
- package/src/_doc/router/guide.1.menu-component-config.md +0 -181
- package/src/_doc/router/guide.2.router-auto-registration.md +0 -114
- package/src/_doc/table-view/0.docs-overview.md +0 -30
- package/src/_doc/table-view/comp.1.table-view.md +0 -542
- package/src/_doc/table-view/props.1.create-table-view-config.md +0 -193
- package/src/_doc/table-view/props.2.table-view-search-fields.md +0 -106
- package/src/api/_mock/README.md +0 -340
- package/src/api/_mock/api.ts +0 -1642
- package/src/api/_mock/bundle-shim.ts +0 -16
- package/src/api/_mock/handler-shim.ts +0 -6
- package/src/api/_mock/handler.ts +0 -458
- package/src/api/_mock/index.ts +0 -711
- package/src/api/_mock/interceptor.ts +0 -15
- package/src/api/_mock/mod.ts +0 -12
- package/src/api/_mock/utils.ts +0 -65
- package/src/api/base/memory.js +0 -24
- package/src/api/chat.js +0 -210
- package/src/api/common/auth.js +0 -70
- package/src/api/menus/business-rules.js +0 -76
- package/src/api/menus/feedback.js +0 -102
- package/src/api/menus/knowledge.js +0 -159
- package/src/api/menus/model-metadata/manage.js +0 -70
- package/src/api/menus/model-metadata/role.js +0 -50
- package/src/api/menus/model-metadata/training-detail-mock-data.js +0 -569
- package/src/api/menus/model-metadata/training.js +0 -28
- package/src/api/menus/skill.js +0 -40
- package/src/api/system/agent-config.js +0 -16
- package/src/api/system/department.js +0 -94
- package/src/api/system/dict.js +0 -86
- package/src/api/system/menu.js +0 -37
- package/src/api/system/permission.js +0 -26
- package/src/api/system/role.js +0 -34
- package/src/api/system/sys-config.js +0 -16
- package/src/api/system/sys-log.js +0 -17
- package/src/api/system/user.js +0 -75
- package/src/api/upload.js +0 -39
- package/src/assets/react.svg +0 -1
- package/src/components/auth/current-user-avatar.tsx +0 -77
- package/src/components/common/code-view.tsx +0 -149
- package/src/components/common/detail-link.tsx +0 -67
- package/src/components/common/error-boundary.tsx +0 -98
- package/src/components/common/language-switcher.tsx +0 -91
- package/src/components/common/lite-table/index.tsx +0 -135
- package/src/components/common/md-editor.tsx +0 -126
- package/src/components/common/modal/confirm-dialog.tsx +0 -113
- package/src/components/common/modal/dep-user-select-multi.tsx +0 -324
- package/src/components/common/modal/dep-user-select.tsx +0 -249
- package/src/components/common/modal/user-select-multi.tsx +0 -266
- package/src/components/common/pagination.tsx +0 -472
- package/src/components/common/path.tsx +0 -175
- package/src/components/common/system-logo-mark.tsx +0 -48
- package/src/components/cx-ui/button/index.less +0 -208
- package/src/components/cx-ui/button/index.tsx +0 -611
- package/src/components/cx-ui/checkbox/index.tsx +0 -78
- package/src/components/cx-ui/date-picker/index.less +0 -17
- package/src/components/cx-ui/date-picker/index.tsx +0 -193
- package/src/components/cx-ui/drawer/index.tsx +0 -47
- package/src/components/cx-ui/empty-state/index.tsx +0 -20
- package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +0 -89
- package/src/components/cx-ui/floating-shell/cx-floating-shell.less +0 -283
- package/src/components/cx-ui/floating-shell/has-floating-value.ts +0 -41
- package/src/components/cx-ui/form/CxForm.tsx +0 -15
- package/src/components/cx-ui/form/index.tsx +0 -20
- package/src/components/cx-ui/form-item/index.less +0 -26
- package/src/components/cx-ui/form-item/index.tsx +0 -36
- package/src/components/cx-ui/index.ts +0 -70
- package/src/components/cx-ui/input/auto-complete.tsx +0 -134
- package/src/components/cx-ui/input/index.tsx +0 -259
- package/src/components/cx-ui/input-number/index.jsx +0 -66
- package/src/components/cx-ui/modal/index.jsx +0 -212
- package/src/components/cx-ui/modal/index.less +0 -144
- package/src/components/cx-ui/modal/useCxModal.ts +0 -125
- package/src/components/cx-ui/multi-select/index.jsx +0 -74
- package/src/components/cx-ui/multi-select/index.less +0 -40
- package/src/components/cx-ui/multi-select/index2.tsx +0 -361
- package/src/components/cx-ui/radio/index.tsx +0 -33
- package/src/components/cx-ui/range-picker/index.less +0 -65
- package/src/components/cx-ui/range-picker/index.tsx +0 -219
- package/src/components/cx-ui/select/index.less +0 -34
- package/src/components/cx-ui/select/index.tsx +0 -196
- package/src/components/cx-ui/skeleton/index.tsx +0 -12
- package/src/components/cx-ui/steps/index.tsx +0 -14
- package/src/components/cx-ui/styles/_tokens.less +0 -79
- package/src/components/cx-ui/styles/index.less +0 -246
- package/src/components/cx-ui/switch/index.less +0 -106
- package/src/components/cx-ui/switch/index.tsx +0 -120
- package/src/components/cx-ui/table/index.less +0 -160
- package/src/components/cx-ui/table/index.tsx +0 -152
- package/src/components/cx-ui/tabs/index.less +0 -15
- package/src/components/cx-ui/tabs/index.tsx +0 -34
- package/src/components/cx-ui/tag/index.less +0 -51
- package/src/components/cx-ui/tag/index.tsx +0 -140
- package/src/components/cx-ui/timeline/index.tsx +0 -14
- package/src/components/cx-ui/tooltip/index.tsx +0 -67
- package/src/components/cx-ui/tree/index.tsx +0 -193
- package/src/components/cx-ui/tree-select/index.jsx +0 -91
- package/src/components/cx-ui/tree-select/index.less +0 -27
- package/src/components/cx-ui/upload-file/index.less +0 -223
- package/src/components/cx-ui/upload-file/index.tsx +0 -640
- package/src/components/cx-ui/upload-img/index.tsx +0 -291
- package/src/components/layout/components/Header.tsx +0 -216
- package/src/components/layout/components/Sidebar.tsx +0 -717
- package/src/components/layout/index.tsx +0 -95
- package/src/components/table-view/components/search-area.tsx +0 -411
- package/src/components/table-view/components/table-view-config.tsx +0 -528
- package/src/components/table-view/components/table-view.types.ts +0 -478
- package/src/components/table-view/components/tree-api-normalize.ts +0 -38
- package/src/components/table-view/components/tree-data-annotate.ts +0 -31
- package/src/components/table-view/components/tree-sidebar.tsx +0 -74
- package/src/components/table-view/index.tsx +0 -61
- package/src/components/table-view/list-page-view.tsx +0 -1049
- package/src/components/table-view/select-table-view.tsx +0 -1094
- package/src/components/table-view/styles/select-table-view.less +0 -51
- package/src/config/default-system-name.ts +0 -9
- package/src/config/system.ts +0 -165
- package/src/constants/countryCodes.ts +0 -3
- package/src/contexts/AuthContext.tsx +0 -256
- package/src/contexts/ChatContext.tsx +0 -839
- package/src/contexts/MenuContext.tsx +0 -62
- package/src/contexts/ToastContext.tsx +0 -181
- package/src/hooks/useCopyToClipboard.ts +0 -47
- package/src/hooks/useModalSubmit.ts +0 -104
- package/src/hooks/useRouter.ts +0 -240
- package/src/hooks/useStepForm.ts +0 -46
- package/src/hooks/useStickyHeader.ts +0 -42
- package/src/hooks/useThreadActions.ts +0 -105
- package/src/hooks/useUserPreferences.ts +0 -101
- package/src/http/axios.js +0 -372
- package/src/http/mock.interceptor.ts +0 -9
- package/src/http/obfuscationKey.ts +0 -41
- package/src/i18n.ts +0 -60
- package/src/index.js +0 -1
- package/src/index.less +0 -169
- package/src/locales/en/auth.ts +0 -70
- package/src/locales/en/base/memory.ts +0 -28
- package/src/locales/en/base/settings.ts +0 -41
- package/src/locales/en/chat.ts +0 -40
- package/src/locales/en/common.ts +0 -173
- package/src/locales/en/enum.ts +0 -27
- package/src/locales/en/menus/business-rules.ts +0 -48
- package/src/locales/en/menus/feedback.ts +0 -62
- package/src/locales/en/menus/knowledge.ts +0 -120
- package/src/locales/en/menus/model-metadata/index.ts +0 -10
- package/src/locales/en/menus/model-metadata/manage.ts +0 -151
- package/src/locales/en/menus/model-metadata/role.ts +0 -48
- package/src/locales/en/menus/model-metadata/training.ts +0 -65
- package/src/locales/en/menus/skill.ts +0 -34
- package/src/locales/en/system/agent-config.ts +0 -34
- package/src/locales/en/system/department.ts +0 -68
- package/src/locales/en/system/dict.ts +0 -44
- package/src/locales/en/system/menu.ts +0 -45
- package/src/locales/en/system/permission.ts +0 -89
- package/src/locales/en/system/role.ts +0 -25
- package/src/locales/en/system/sys-config.ts +0 -33
- package/src/locales/en/system/sys-log.ts +0 -38
- package/src/locales/en/system/user.ts +0 -113
- package/src/locales/en.ts +0 -68
- package/src/locales/zh/auth.ts +0 -70
- package/src/locales/zh/base/memory.ts +0 -29
- package/src/locales/zh/base/settings.ts +0 -41
- package/src/locales/zh/chat.ts +0 -47
- package/src/locales/zh/common.ts +0 -178
- package/src/locales/zh/enum.ts +0 -28
- package/src/locales/zh/menus/business-rules.ts +0 -47
- package/src/locales/zh/menus/feedback.ts +0 -62
- package/src/locales/zh/menus/knowledge.ts +0 -117
- package/src/locales/zh/menus/model-metadata/index.ts +0 -10
- package/src/locales/zh/menus/model-metadata/manage.ts +0 -151
- package/src/locales/zh/menus/model-metadata/role.ts +0 -47
- package/src/locales/zh/menus/model-metadata/training.ts +0 -64
- package/src/locales/zh/menus/skill.ts +0 -34
- package/src/locales/zh/system/agent-config.ts +0 -33
- package/src/locales/zh/system/department.ts +0 -69
- package/src/locales/zh/system/dict.ts +0 -44
- package/src/locales/zh/system/menu.ts +0 -47
- package/src/locales/zh/system/permission.ts +0 -94
- package/src/locales/zh/system/role.ts +0 -25
- package/src/locales/zh/system/sys-config.ts +0 -32
- package/src/locales/zh/system/sys-log.ts +0 -38
- package/src/locales/zh/system/user.ts +0 -114
- package/src/locales/zh.ts +0 -67
- package/src/main.tsx +0 -50
- package/src/meta/const/index.ts +0 -40
- package/src/meta/index-dict.ts +0 -56
- package/src/meta/index-enum.ts +0 -95
- package/src/meta/index.ts +0 -14
- package/src/meta/module/dict-data/runtime.ts +0 -199
- package/src/meta/module/dict-data/types.ts +0 -17
- package/src/meta/module/enum-data/runtime.ts +0 -75
- package/src/meta/module/enum-data/types.ts +0 -18
- package/src/router/index.tsx +0 -312
- package/src/styles/AntdThemeProvider.tsx +0 -40
- package/src/styles/antd-theme.ts +0 -20
- package/src/styles/global.less +0 -107
- package/src/styles/variable.less +0 -103
- package/src/types/feedback.ts +0 -43
- package/src/types/index.ts +0 -85
- package/src/types/menu.ts +0 -43
- package/src/utils/aesUtil.ts +0 -123
- package/src/utils/chatUtils.ts +0 -524
- package/src/utils/cn.ts +0 -6
- package/src/utils/crypto.ts +0 -164
- package/src/utils/date.ts +0 -72
- package/src/utils/file-icons.tsx +0 -79
- package/src/utils/index.ts +0 -168
- package/src/utils/markdown-math-plugins.ts +0 -21
- package/src/utils/menuI18n.ts +0 -305
- package/src/utils/menuRouteRegistry.ts +0 -78
- package/src/utils/permission-crud.ts +0 -147
- package/src/utils/routeConfig.ts +0 -350
- package/src/utils/storage.ts +0 -135
- package/src/utils/toastBridge.ts +0 -26
- package/src/utils/url.ts +0 -38
- package/src/utils/validation.ts +0 -16
- package/src/views/auth/auth-code/index.less +0 -169
- package/src/views/auth/auth-code/index.module.less +0 -174
- package/src/views/auth/auth-code/index.tsx +0 -233
- package/src/views/auth/login.tsx +0 -498
- package/src/views/auth/register.tsx +0 -388
- package/src/views/base/memory/index.tsx +0 -136
- package/src/views/base/memory/modal/detail-modal.tsx +0 -89
- package/src/views/base/memory/modal/submit-modal.tsx +0 -134
- package/src/views/base/settings/index.tsx +0 -657
- package/src/views/chat/chat.less +0 -323
- package/src/views/chat/components/chat-input.tsx +0 -298
- package/src/views/chat/components/header-thread-title.tsx +0 -210
- package/src/views/chat/components/message-list/content-answer.tsx +0 -100
- package/src/views/chat/components/message-list/content-question.tsx +0 -18
- package/src/views/chat/components/message-list/index.tsx +0 -520
- package/src/views/chat/components/message-list/message-item.tsx +0 -199
- package/src/views/chat/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/chat/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/chat/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/chat/components/message-list/thinking-process.tsx +0 -49
- package/src/views/chat/components/message-list/toolbar.tsx +0 -224
- package/src/views/chat/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/chat/components/references-knowledge/context.tsx +0 -57
- package/src/views/chat/components/references-knowledge/index.ts +0 -9
- package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +0 -556
- package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +0 -529
- package/src/views/chat/components/references-knowledge/panel.tsx +0 -115
- package/src/views/chat/hooks/use-chat-common.ts +0 -19
- package/src/views/chat/index-session.tsx +0 -647
- package/src/views/chat/index.tsx +0 -127
- package/src/views/page-error/401.tsx +0 -56
- package/src/views/page-error/404.tsx +0 -56
- package/src/views/page-menus/business-rules/index.tsx +0 -376
- package/src/views/page-menus/business-rules/modal/detail-modal.tsx +0 -186
- package/src/views/page-menus/business-rules/modal/scope-modal.tsx +0 -272
- package/src/views/page-menus/business-rules/modal/submit-modal.tsx +0 -142
- package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +0 -471
- package/src/views/page-menus/feedback/index.tsx +0 -166
- package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +0 -367
- package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +0 -32
- package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +0 -330
- package/src/views/page-menus/knowledge/detail.tsx +0 -600
- package/src/views/page-menus/knowledge/index.tsx +0 -337
- package/src/views/page-menus/knowledge/modal/detail-modal.tsx +0 -618
- package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +0 -550
- package/src/views/page-menus/knowledge/modal/doc-parse.ts +0 -99
- package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +0 -349
- package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +0 -88
- package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +0 -283
- package/src/views/page-menus/knowledge/modal/submit-modal.tsx +0 -179
- package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +0 -114
- package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +0 -232
- package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +0 -316
- package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +0 -101
- package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +0 -338
- package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +0 -276
- package/src/views/page-menus/model-metadata/manage/detail.tsx +0 -298
- package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +0 -113
- package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +0 -20
- package/src/views/page-menus/model-metadata/manage/index.tsx +0 -304
- package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +0 -374
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +0 -151
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +0 -423
- package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +0 -218
- package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +0 -261
- package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +0 -196
- package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +0 -229
- package/src/views/page-menus/model-metadata/manage/submit.tsx +0 -31
- package/src/views/page-menus/model-metadata/role/index.tsx +0 -207
- package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +0 -97
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +0 -254
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +0 -393
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +0 -120
- package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +0 -698
- package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +0 -237
- package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +0 -135
- package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +0 -4
- package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +0 -72
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +0 -196
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +0 -153
- package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +0 -103
- package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +0 -82
- package/src/views/page-menus/model-metadata/training/detail.tsx +0 -159
- package/src/views/page-menus/model-metadata/training/index.tsx +0 -236
- package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +0 -154
- package/src/views/page-menus/skill/index.tsx +0 -201
- package/src/views/page-menus/skill/modal/detail-modal.tsx +0 -156
- package/src/views/page-menus/skill/modal/submit-modal.tsx +0 -214
- package/src/views/page-system/agent-config/index.tsx +0 -370
- package/src/views/page-system/department/departmentFormShared.ts +0 -36
- package/src/views/page-system/department/index.tsx +0 -541
- package/src/views/page-system/department/modal/detail-modal.tsx +0 -94
- package/src/views/page-system/department/modal/member-role-modal.tsx +0 -128
- package/src/views/page-system/department/modal/submit-modal.tsx +0 -265
- package/src/views/page-system/dict/index.tsx +0 -440
- package/src/views/page-system/dict/modal/cate-submit-modal.tsx +0 -315
- package/src/views/page-system/dict/modal/submit-modal.tsx +0 -184
- package/src/views/page-system/logs/components/index.ts +0 -3
- package/src/views/page-system/logs/components/log-message-demo.tsx +0 -30
- package/src/views/page-system/logs/components/log-message-stream.ts +0 -184
- package/src/views/page-system/logs/components/message-list/content-answer.tsx +0 -100
- package/src/views/page-system/logs/components/message-list/content-question.tsx +0 -18
- package/src/views/page-system/logs/components/message-list/index.tsx +0 -515
- package/src/views/page-system/logs/components/message-list/message-item.tsx +0 -193
- package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/page-system/logs/components/message-list/thinking-process.tsx +0 -49
- package/src/views/page-system/logs/components/message-list/toolbar.tsx +0 -134
- package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/page-system/logs/components/message-modal.tsx +0 -239
- package/src/views/page-system/logs/index.tsx +0 -132
- package/src/views/page-system/logs/modal/detail-modal.tsx +0 -157
- package/src/views/page-system/menu/components/menuFormShared.ts +0 -283
- package/src/views/page-system/menu/index.less +0 -12
- package/src/views/page-system/menu/index.tsx +0 -410
- package/src/views/page-system/menu/modal/icon-modal.less +0 -51
- package/src/views/page-system/menu/modal/icon-modal.tsx +0 -87
- package/src/views/page-system/menu/modal/submit-modal.tsx +0 -263
- package/src/views/page-system/permission/index.tsx +0 -562
- package/src/views/page-system/permission/modal/detail-modal.tsx +0 -179
- package/src/views/page-system/permission/modal/submit-modal.less +0 -146
- package/src/views/page-system/permission/modal/submit-modal.tsx +0 -650
- package/src/views/page-system/role/index.tsx +0 -163
- package/src/views/page-system/role/modal/detail-modal.tsx +0 -127
- package/src/views/page-system/role/modal/permission-assign-group-rules.ts +0 -86
- package/src/views/page-system/role/modal/permission-modal.tsx +0 -111
- package/src/views/page-system/role/modal/role-modal-shell-styles.ts +0 -21
- package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +0 -916
- package/src/views/page-system/role/modal/role-permission-assign-shared.ts +0 -1047
- package/src/views/page-system/role/modal/submit-modal.tsx +0 -193
- package/src/views/page-system/sys-config/index.tsx +0 -294
- package/src/views/page-system/user/components/user-role-column.tsx +0 -87
- package/src/views/page-system/user/index.tsx +0 -439
- package/src/views/page-system/user/modal/assign-roles-modal.tsx +0 -389
- package/src/views/page-system/user/modal/detail-modal.tsx +0 -72
- package/src/views/page-system/user/modal/modal-style/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.tsx +0 -287
- package/src/views/page-system/user/userFormShared.ts +0 -51
- package/tailwind.config.js +0 -17
- package/tsconfig.app.json +0 -48
- package/tsconfig.json +0 -11
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -264
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
2
|
-
import { getModelMetadataDetailAPI } from '@api/menus/model-metadata/manage'
|
|
3
|
-
import { CxButton, CxModal, CxTag, useCxModal } from '@cx-ui'
|
|
4
|
-
import { Form, Spin } from 'antd'
|
|
5
|
-
import { forwardRef, useImperativeHandle, useMemo, useState } from 'react'
|
|
6
|
-
import { useTranslation } from 'react-i18next'
|
|
7
|
-
|
|
8
|
-
type OpenPayload = {
|
|
9
|
-
opeType?: string
|
|
10
|
-
opeId?: string | number
|
|
11
|
-
data?: any
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type Props = {
|
|
15
|
-
onCancel?: () => void
|
|
16
|
-
/** 编辑主表:打开列表侧 SubmitModal(editModelMetadataAPI) */
|
|
17
|
-
onEditMain?: (id: string | number) => void
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** 仅基础字段,窄弹窗 + 两列只读表单项 */
|
|
21
|
-
const DETAIL_MODAL_WIDTH = 680
|
|
22
|
-
|
|
23
|
-
const DetailModal = forwardRef<
|
|
24
|
-
{ close: () => void; open: (payload?: OpenPayload) => void },
|
|
25
|
-
Props
|
|
26
|
-
>(function DetailModal(props, ref) {
|
|
27
|
-
const { onCancel, onEditMain } = props
|
|
28
|
-
const { t } = useTranslation()
|
|
29
|
-
const { hasPermission } = useAuth()
|
|
30
|
-
const [loading, setLoading] = useState(false)
|
|
31
|
-
|
|
32
|
-
const modal = useCxModal({
|
|
33
|
-
onOpen: async (payload) => {
|
|
34
|
-
const id = payload?.opeId ?? payload?.data?.id
|
|
35
|
-
setLoading(true)
|
|
36
|
-
modal.setFormData(null)
|
|
37
|
-
if (id == null || `${id}`.trim() === '') {
|
|
38
|
-
setLoading(false)
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const res = await getModelMetadataDetailAPI(id)
|
|
43
|
-
const row = (res as any)?.data ?? payload?.data ?? null
|
|
44
|
-
modal.setFormData(row)
|
|
45
|
-
} finally {
|
|
46
|
-
setLoading(false)
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
onClose: () => {
|
|
50
|
-
onCancel?.()
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const { isOpen, close } = modal
|
|
55
|
-
const record = modal.formData as Record<string, any> | null
|
|
56
|
-
|
|
57
|
-
const isEnabled =
|
|
58
|
-
record != null &&
|
|
59
|
-
record.status !== undefined &&
|
|
60
|
-
record.status !== null &&
|
|
61
|
-
Number(record.status) === 1
|
|
62
|
-
|
|
63
|
-
const title = useMemo(() => t('menus.model_metadata.manage.detail'), [t])
|
|
64
|
-
|
|
65
|
-
const canEditMain =
|
|
66
|
-
!loading &&
|
|
67
|
-
record != null &&
|
|
68
|
-
record.id != null &&
|
|
69
|
-
(hasPermission('model-metadata:edit') || hasPermission('model-metadata:edit-item')) &&
|
|
70
|
-
!isEnabled &&
|
|
71
|
-
onEditMain != null
|
|
72
|
-
|
|
73
|
-
const footerActions = useMemo(() => {
|
|
74
|
-
if (!canEditMain || !record || !onEditMain) return undefined
|
|
75
|
-
const id = record.id
|
|
76
|
-
return (
|
|
77
|
-
<div className="flex w-full justify-end gap-2">
|
|
78
|
-
<CxButton
|
|
79
|
-
type="primary"
|
|
80
|
-
onClick={() => {
|
|
81
|
-
onEditMain(id)
|
|
82
|
-
close()
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
{t('common.edit')}
|
|
86
|
-
</CxButton>
|
|
87
|
-
<CxButton type="text" onClick={close}>
|
|
88
|
-
{t('common.close')}
|
|
89
|
-
</CxButton>
|
|
90
|
-
</div>
|
|
91
|
-
)
|
|
92
|
-
}, [canEditMain, record, onEditMain, close, t])
|
|
93
|
-
|
|
94
|
-
useImperativeHandle(
|
|
95
|
-
ref,
|
|
96
|
-
() => ({
|
|
97
|
-
open: modal.open,
|
|
98
|
-
close,
|
|
99
|
-
}),
|
|
100
|
-
[modal.open, close],
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<CxModal
|
|
105
|
-
title={title}
|
|
106
|
-
isOpen={isOpen}
|
|
107
|
-
onClose={close}
|
|
108
|
-
opeType="detail"
|
|
109
|
-
modalConfig={{
|
|
110
|
-
width: DETAIL_MODAL_WIDTH,
|
|
111
|
-
styles: {
|
|
112
|
-
container: { backgroundColor: '#ffffff' },
|
|
113
|
-
body: { backgroundColor: '#ffffff' },
|
|
114
|
-
},
|
|
115
|
-
}}
|
|
116
|
-
{...(footerActions != null ? { actions: footerActions } : {})}
|
|
117
|
-
>
|
|
118
|
-
{loading ? (
|
|
119
|
-
<div className="flex justify-center py-12">
|
|
120
|
-
<Spin size="large" />
|
|
121
|
-
</div>
|
|
122
|
-
) : !record ? (
|
|
123
|
-
<div className="flex justify-center py-10 text-sm text-gray-500">
|
|
124
|
-
{t('common.no_data')}
|
|
125
|
-
</div>
|
|
126
|
-
) : (
|
|
127
|
-
<Form layout="horizontal" colon className="pb-1">
|
|
128
|
-
<div className="grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2">
|
|
129
|
-
<Form.Item
|
|
130
|
-
label={t('menus.model_metadata.manage.fields.subject')}
|
|
131
|
-
className="!mb-0"
|
|
132
|
-
>
|
|
133
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
134
|
-
{record.subject ?? '-'}
|
|
135
|
-
</div>
|
|
136
|
-
</Form.Item>
|
|
137
|
-
<Form.Item
|
|
138
|
-
label={t('menus.model_metadata.manage.fields.databaseName')}
|
|
139
|
-
className="!mb-0"
|
|
140
|
-
>
|
|
141
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
142
|
-
{record.databaseName ?? '-'}
|
|
143
|
-
</div>
|
|
144
|
-
</Form.Item>
|
|
145
|
-
<Form.Item
|
|
146
|
-
label={t('menus.model_metadata.manage.fields.dbType')}
|
|
147
|
-
className="!mb-0"
|
|
148
|
-
>
|
|
149
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
150
|
-
{record.dbType ?? '-'}
|
|
151
|
-
</div>
|
|
152
|
-
</Form.Item>
|
|
153
|
-
<Form.Item label={t('menus.model_metadata.manage.fields.status')} className="!mb-0">
|
|
154
|
-
<CxTag.Enabled value={record.status} />
|
|
155
|
-
</Form.Item>
|
|
156
|
-
<Form.Item
|
|
157
|
-
label={t('menus.model_metadata.manage.fields.host')}
|
|
158
|
-
className="!mb-0"
|
|
159
|
-
>
|
|
160
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
161
|
-
{record.host ?? '-'}:{record.port ?? '-'}
|
|
162
|
-
</div>
|
|
163
|
-
</Form.Item>
|
|
164
|
-
<Form.Item
|
|
165
|
-
label={t('menus.model_metadata.manage.fields.dbSchema')}
|
|
166
|
-
className="!mb-0"
|
|
167
|
-
>
|
|
168
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
169
|
-
{record.dbSchema ?? '-'}
|
|
170
|
-
</div>
|
|
171
|
-
</Form.Item>
|
|
172
|
-
<Form.Item
|
|
173
|
-
label={t('menus.model_metadata.manage.fields.username')}
|
|
174
|
-
className="!mb-0"
|
|
175
|
-
>
|
|
176
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
177
|
-
{record.username ?? '-'}
|
|
178
|
-
</div>
|
|
179
|
-
</Form.Item>
|
|
180
|
-
<Form.Item
|
|
181
|
-
label={t('menus.model_metadata.manage.fields.passwordMasked')}
|
|
182
|
-
className="!mb-0"
|
|
183
|
-
>
|
|
184
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
185
|
-
{record.passwordMasked ?? '-'}
|
|
186
|
-
</div>
|
|
187
|
-
</Form.Item>
|
|
188
|
-
<Form.Item
|
|
189
|
-
label={t('menus.model_metadata.manage.fields.charsetName')}
|
|
190
|
-
className="!mb-0"
|
|
191
|
-
>
|
|
192
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
193
|
-
{record.charsetName ?? '-'}
|
|
194
|
-
</div>
|
|
195
|
-
</Form.Item>
|
|
196
|
-
<Form.Item label={t('common.creator')} className="!mb-0">
|
|
197
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
198
|
-
{record.createBy ?? '-'}
|
|
199
|
-
</div>
|
|
200
|
-
</Form.Item>
|
|
201
|
-
<Form.Item label={t('common.create_time')} className="!mb-0">
|
|
202
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
203
|
-
{record.createTime ?? '-'}
|
|
204
|
-
</div>
|
|
205
|
-
</Form.Item>
|
|
206
|
-
<Form.Item label={t('common.update_time')} className="!mb-0">
|
|
207
|
-
<div className="break-words text-sm text-gray-900 dark:text-gray-100">
|
|
208
|
-
{record.updateTime ?? '-'}
|
|
209
|
-
</div>
|
|
210
|
-
</Form.Item>
|
|
211
|
-
</div>
|
|
212
|
-
</Form>
|
|
213
|
-
)}
|
|
214
|
-
</CxModal>
|
|
215
|
-
)
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
export default DetailModal
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { useAuth } from '@/contexts/AuthContext'
|
|
2
|
-
import { useModalSubmit } from '@/hooks/useModalSubmit'
|
|
3
|
-
import { DICT_DATA, DICT_KEY, ENUM_DATA } from '@/meta'
|
|
4
|
-
import { addModelMetadataAPI, editModelMetadataAPI, getModelMetadataDetailAPI } from '@api/menus/model-metadata/manage'
|
|
5
|
-
import { forwardRef, useImperativeHandle, useMemo } from 'react'
|
|
6
|
-
import { useTranslation } from 'react-i18next'
|
|
7
|
-
|
|
8
|
-
import { CxForm, CxFormItem, CxInput, CxModal, CxSelect, useCxModal } from '@cx-ui'
|
|
9
|
-
|
|
10
|
-
type OpenPayload = {
|
|
11
|
-
opeType?: string
|
|
12
|
-
opeId?: string | number
|
|
13
|
-
data?: any
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type Props = {
|
|
17
|
-
onCancel?: () => void
|
|
18
|
-
onOk?: (values: any) => void | Promise<void>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const SUBMIT_MODAL_WIDTH = 1120
|
|
22
|
-
const SUBMIT_MODAL_HEIGHT = '95vh'
|
|
23
|
-
|
|
24
|
-
const submitModalShellStyles = {
|
|
25
|
-
container: {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
flexDirection: 'column' as const,
|
|
28
|
-
overflow: 'hidden',
|
|
29
|
-
height: SUBMIT_MODAL_HEIGHT,
|
|
30
|
-
maxHeight: SUBMIT_MODAL_HEIGHT,
|
|
31
|
-
backgroundColor: '#ffffff',
|
|
32
|
-
},
|
|
33
|
-
body: {
|
|
34
|
-
flex: '1 1 0%',
|
|
35
|
-
minHeight: 0,
|
|
36
|
-
overflowY: 'auto',
|
|
37
|
-
overflowX: 'hidden',
|
|
38
|
-
padding: '20px 32px',
|
|
39
|
-
backgroundColor: '#ffffff',
|
|
40
|
-
},
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const SubmitModal = forwardRef<
|
|
44
|
-
{ close: () => void; open: (payload?: OpenPayload) => void },
|
|
45
|
-
Props
|
|
46
|
-
>(function SubmitModal(props, ref) {
|
|
47
|
-
const { onCancel, onOk } = props
|
|
48
|
-
const { t } = useTranslation()
|
|
49
|
-
const { commonDictRevision } = useAuth()
|
|
50
|
-
|
|
51
|
-
const dbTypeOptions = useMemo(
|
|
52
|
-
() => DICT_DATA[DICT_KEY.dbType]?.option ?? [],
|
|
53
|
-
[commonDictRevision],
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
const modal = useCxModal({
|
|
57
|
-
onOpen: async (payload) => {
|
|
58
|
-
form.resetFields()
|
|
59
|
-
const type = payload?.opeType ?? 'add'
|
|
60
|
-
if (type === 'edit' && payload?.opeId) {
|
|
61
|
-
try {
|
|
62
|
-
const res = await getModelMetadataDetailAPI(payload.opeId)
|
|
63
|
-
const data = res?.data
|
|
64
|
-
if (data) {
|
|
65
|
-
form.setFieldsValue({
|
|
66
|
-
subject: data.subject,
|
|
67
|
-
databaseName: data.databaseName,
|
|
68
|
-
dbType: data.dbType,
|
|
69
|
-
host: data.host,
|
|
70
|
-
port: data.port,
|
|
71
|
-
dbSchema: data.dbSchema,
|
|
72
|
-
username: data.username,
|
|
73
|
-
charsetName: data.charsetName,
|
|
74
|
-
optionsJson: data.optionsJson,
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
} catch (error) {
|
|
78
|
-
console.error('Failed to fetch model metadata detail:', error)
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
form.setFieldsValue({
|
|
82
|
-
subject: '',
|
|
83
|
-
databaseName: '',
|
|
84
|
-
dbType: '',
|
|
85
|
-
host: '',
|
|
86
|
-
port: undefined,
|
|
87
|
-
dbSchema: '',
|
|
88
|
-
username: '',
|
|
89
|
-
optionsJson: '',
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
onClose: () => {
|
|
94
|
-
onCancel?.()
|
|
95
|
-
},
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
const { isOpen, close, form, opeType, opeId } = modal
|
|
99
|
-
const { submitting, handleSubmit } = useModalSubmit()
|
|
100
|
-
|
|
101
|
-
// rules.* 中文:locales/zh/menus/model-metadata.ts
|
|
102
|
-
const formRules = useMemo(
|
|
103
|
-
() => ({
|
|
104
|
-
subject: [
|
|
105
|
-
{ required: true, message: t('menus.model_metadata.manage.rules.subject_required') }, // 主题必填
|
|
106
|
-
{ whitespace: true, message: t('menus.model_metadata.manage.rules.subject_required') },
|
|
107
|
-
],
|
|
108
|
-
databaseName: [
|
|
109
|
-
{ required: true, message: t('menus.model_metadata.manage.rules.databaseName_required') }, // 库名必填
|
|
110
|
-
{ whitespace: true, message: t('menus.model_metadata.manage.rules.databaseName_required') },
|
|
111
|
-
],
|
|
112
|
-
dbType: [
|
|
113
|
-
{ required: true, message: t('menus.model_metadata.manage.rules.dbType_required') }, // 库类型必填
|
|
114
|
-
],
|
|
115
|
-
host: [
|
|
116
|
-
{ required: true, message: t('menus.model_metadata.manage.rules.host_required') }, // 主机必填
|
|
117
|
-
{ whitespace: true, message: t('menus.model_metadata.manage.rules.host_required') },
|
|
118
|
-
],
|
|
119
|
-
port: [
|
|
120
|
-
{ required: true, message: t('menus.model_metadata.manage.rules.port_required') }, // 端口必填
|
|
121
|
-
],
|
|
122
|
-
username: [
|
|
123
|
-
{ required: true, message: t('menus.model_metadata.manage.rules.username_required') }, // 用户名必填
|
|
124
|
-
{ whitespace: true, message: t('menus.model_metadata.manage.rules.username_required') },
|
|
125
|
-
],
|
|
126
|
-
password: opeType === 'add'
|
|
127
|
-
? [
|
|
128
|
-
{ required: true, message: t('menus.model_metadata.manage.rules.password_required') }, // 密码必填
|
|
129
|
-
{ whitespace: true, message: t('menus.model_metadata.manage.rules.password_required') },
|
|
130
|
-
]
|
|
131
|
-
: [],
|
|
132
|
-
}),
|
|
133
|
-
[t, opeType],
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
// 弹窗标题:新增 / 更新
|
|
137
|
-
const title = useMemo(
|
|
138
|
-
() =>
|
|
139
|
-
opeType === 'add' ? t('menus.model_metadata.manage.add') : t('menus.model_metadata.manage.edit'),
|
|
140
|
-
[opeType, t],
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
const onOkClick = async () => {
|
|
144
|
-
const result = await handleSubmit({
|
|
145
|
-
opeType,
|
|
146
|
-
validate: () => form.validateFields(),
|
|
147
|
-
addAPI: addModelMetadataAPI,
|
|
148
|
-
editAPI: editModelMetadataAPI,
|
|
149
|
-
transform: (values) => ({
|
|
150
|
-
...(opeType === 'edit' ? { id: opeId } : {}),
|
|
151
|
-
subject: values.subject,
|
|
152
|
-
databaseName: values.databaseName,
|
|
153
|
-
dbType: values.dbType,
|
|
154
|
-
host: values.host,
|
|
155
|
-
port: values.port,
|
|
156
|
-
dbSchema: values.dbSchema,
|
|
157
|
-
username: values.username,
|
|
158
|
-
password: values.password,
|
|
159
|
-
charsetName: values.charsetName,
|
|
160
|
-
optionsJson: values.optionsJson,
|
|
161
|
-
}),
|
|
162
|
-
onSuccess: async ({ payload }) => {
|
|
163
|
-
await onOk?.(payload)
|
|
164
|
-
},
|
|
165
|
-
})
|
|
166
|
-
if (result) close()
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
useImperativeHandle(
|
|
170
|
-
ref,
|
|
171
|
-
() => ({
|
|
172
|
-
open: modal.open,
|
|
173
|
-
close,
|
|
174
|
-
}),
|
|
175
|
-
[modal.open, close],
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<CxModal
|
|
180
|
-
isOpen={isOpen}
|
|
181
|
-
modalConfig={{
|
|
182
|
-
width: SUBMIT_MODAL_WIDTH,
|
|
183
|
-
styles: {
|
|
184
|
-
...submitModalShellStyles,
|
|
185
|
-
},
|
|
186
|
-
rootClassName: 'cx-modal-content-fill scroll',
|
|
187
|
-
}}
|
|
188
|
-
opeType={opeType}
|
|
189
|
-
submitting={submitting}
|
|
190
|
-
title={title}
|
|
191
|
-
onClose={close}
|
|
192
|
-
onSubmit={onOkClick}
|
|
193
|
-
>
|
|
194
|
-
<CxForm form={form} rules={formRules} layout="vertical" className="flex h-full min-h-0 flex-col bg-white">
|
|
195
|
-
{/* fields / placeholders:zh/menus/model-metadata.ts */}
|
|
196
|
-
<div className="flex flex-col gap-3">
|
|
197
|
-
<div className="grid grid-cols-2 gap-4">
|
|
198
|
-
{/* 主题 */}
|
|
199
|
-
<CxFormItem label={t('menus.model_metadata.manage.fields.subject')} name="subject">
|
|
200
|
-
<CxInput placeholder={t('menus.model_metadata.manage.placeholders.subject')} />
|
|
201
|
-
</CxFormItem>
|
|
202
|
-
{/* 数据库名 */}
|
|
203
|
-
<CxFormItem label={t('menus.model_metadata.manage.fields.databaseName')} name="databaseName">
|
|
204
|
-
<CxInput placeholder={t('menus.model_metadata.manage.placeholders.databaseName')} />
|
|
205
|
-
</CxFormItem>
|
|
206
|
-
</div>
|
|
207
|
-
<div className="grid grid-cols-2 gap-4">
|
|
208
|
-
{/* 库类型 */}
|
|
209
|
-
<CxFormItem label={t('menus.model_metadata.manage.fields.dbType')} name="dbType">
|
|
210
|
-
<CxSelect
|
|
211
|
-
placeholder={t('menus.model_metadata.manage.placeholders.dbType')}
|
|
212
|
-
options={dbTypeOptions}
|
|
213
|
-
fieldNames={{ label: 'name', value: 'value' }}
|
|
214
|
-
/>
|
|
215
|
-
</CxFormItem>
|
|
216
|
-
{/* 字符集 */}
|
|
217
|
-
<CxFormItem label={t('menus.model_metadata.manage.fields.charsetName')} name="charsetName">
|
|
218
|
-
<CxSelect
|
|
219
|
-
allowClear
|
|
220
|
-
placeholder={t('menus.model_metadata.manage.placeholders.charsetName')}
|
|
221
|
-
options={ENUM_DATA.dbCharset.option}
|
|
222
|
-
/>
|
|
223
|
-
</CxFormItem>
|
|
224
|
-
</div>
|
|
225
|
-
<div className="grid grid-cols-4 gap-4">
|
|
226
|
-
{/* 主机 */}
|
|
227
|
-
<CxFormItem className="col-span-3" label={t('menus.model_metadata.manage.fields.host')} name="host">
|
|
228
|
-
<CxInput placeholder={t('menus.model_metadata.manage.placeholders.host')} />
|
|
229
|
-
</CxFormItem>
|
|
230
|
-
{/* 端口 */}
|
|
231
|
-
<CxFormItem label={t('menus.model_metadata.manage.fields.port')} name="port">
|
|
232
|
-
<CxInput placeholder={t('menus.model_metadata.manage.placeholders.port')} />
|
|
233
|
-
</CxFormItem>
|
|
234
|
-
</div>
|
|
235
|
-
<div className="grid grid-cols-4 gap-4">
|
|
236
|
-
{/* Schema */}
|
|
237
|
-
<CxFormItem className="col-span-4" label={t('menus.model_metadata.manage.fields.dbSchema')} name="dbSchema">
|
|
238
|
-
<CxInput placeholder={t('menus.model_metadata.manage.placeholders.dbSchema')} />
|
|
239
|
-
</CxFormItem>
|
|
240
|
-
</div>
|
|
241
|
-
<div className="grid grid-cols-4 gap-4">
|
|
242
|
-
{/* 用户名 */}
|
|
243
|
-
<CxFormItem className="col-span-2" label={t('menus.model_metadata.manage.fields.username')} name="username">
|
|
244
|
-
<CxInput placeholder={t('menus.model_metadata.manage.placeholders.username')} />
|
|
245
|
-
</CxFormItem>
|
|
246
|
-
{/* 密码 */}
|
|
247
|
-
<CxFormItem className="col-span-2" label={t('menus.model_metadata.manage.fields.password')} name="password">
|
|
248
|
-
<CxInput type="password" autoComplete="new-password" placeholder={t('menus.model_metadata.manage.placeholders.password')} />
|
|
249
|
-
</CxFormItem>
|
|
250
|
-
</div>
|
|
251
|
-
{/* 配置 JSON */}
|
|
252
|
-
<CxFormItem label={t('menus.model_metadata.manage.fields.optionsJson')} name="optionsJson">
|
|
253
|
-
<CxInput.Textarea rows={4} placeholder={t('menus.model_metadata.manage.placeholders.optionsJson')} />
|
|
254
|
-
</CxFormItem>
|
|
255
|
-
</div>
|
|
256
|
-
</CxForm>
|
|
257
|
-
</CxModal>
|
|
258
|
-
)
|
|
259
|
-
})
|
|
260
|
-
|
|
261
|
-
export default SubmitModal
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import type { CxModalRef } from '@cx-ui/modal/useCxModal'
|
|
2
|
-
import { useCxModal } from '@cx-ui/modal/useCxModal'
|
|
3
|
-
import { CxModal, CxTable, CxTabs } from '@cx-ui'
|
|
4
|
-
import { Form } from 'antd'
|
|
5
|
-
import { forwardRef, useImperativeHandle, useState } from 'react'
|
|
6
|
-
import { useTranslation } from 'react-i18next'
|
|
7
|
-
import {
|
|
8
|
-
TABLE_SUBMIT_MODAL_WIDTH,
|
|
9
|
-
clonePart,
|
|
10
|
-
normalizeForeignKeyColumnsInput,
|
|
11
|
-
normalizeIndexColumnsInput,
|
|
12
|
-
tableSubmitModalShellStyles,
|
|
13
|
-
} from './components/table-schema'
|
|
14
|
-
import type { Column, ForeignKey, Index, TableDetail } from './components/table-schema'
|
|
15
|
-
import { useTableDetailTabs } from './components/use-table-detail-tabs'
|
|
16
|
-
|
|
17
|
-
const TableDetailModal = forwardRef<CxModalRef, {}>(function TableDetailModal(_props, ref) {
|
|
18
|
-
const { t } = useTranslation()
|
|
19
|
-
const [activeTab, setActiveTab] = useState('columns')
|
|
20
|
-
const [viewColumns, setViewColumns] = useState<Column[]>([])
|
|
21
|
-
const [viewIndexes, setViewIndexes] = useState<Index[]>([])
|
|
22
|
-
const [viewForeignKeys, setViewForeignKeys] = useState<ForeignKey[]>([])
|
|
23
|
-
const [headerSnapshot, setHeaderSnapshot] = useState<{
|
|
24
|
-
tableSchema?: string
|
|
25
|
-
tableName?: string
|
|
26
|
-
tableComment?: string
|
|
27
|
-
tableType?: string
|
|
28
|
-
}>({})
|
|
29
|
-
|
|
30
|
-
const { columnsTabColumns, indexesTabColumns, foreignKeysTabColumns } = useTableDetailTabs({ t })
|
|
31
|
-
|
|
32
|
-
const modal = useCxModal({
|
|
33
|
-
onOpen: (payload: any) => {
|
|
34
|
-
setActiveTab('columns')
|
|
35
|
-
if (payload.data) {
|
|
36
|
-
modal.setFormData(payload.data)
|
|
37
|
-
setViewColumns(clonePart(payload.data.columns || []))
|
|
38
|
-
setViewIndexes(
|
|
39
|
-
(clonePart(payload.data.indexes || []) as Index[]).map((idx) => ({
|
|
40
|
-
...idx,
|
|
41
|
-
indexColumns: normalizeIndexColumnsInput(idx.indexColumns),
|
|
42
|
-
})),
|
|
43
|
-
)
|
|
44
|
-
setViewForeignKeys(
|
|
45
|
-
(clonePart(payload.data.foreignKeys || []) as ForeignKey[]).map((fk) => ({
|
|
46
|
-
...fk,
|
|
47
|
-
fkColumns: normalizeForeignKeyColumnsInput(fk.fkColumns),
|
|
48
|
-
})),
|
|
49
|
-
)
|
|
50
|
-
setHeaderSnapshot({
|
|
51
|
-
tableSchema: payload.data.tableSchema,
|
|
52
|
-
tableName: payload.data.tableName,
|
|
53
|
-
tableComment: payload.data.tableComment,
|
|
54
|
-
tableType: payload.data.tableType,
|
|
55
|
-
})
|
|
56
|
-
} else {
|
|
57
|
-
setViewColumns([])
|
|
58
|
-
setViewIndexes([])
|
|
59
|
-
setViewForeignKeys([])
|
|
60
|
-
setHeaderSnapshot({})
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
const { isOpen, close, open } = modal
|
|
66
|
-
const data = modal.formData as TableDetail | null
|
|
67
|
-
const modalTitle = `${t('common.view')}: ${data?.tableName || headerSnapshot.tableName || ''}`
|
|
68
|
-
|
|
69
|
-
useImperativeHandle(
|
|
70
|
-
ref,
|
|
71
|
-
() => ({
|
|
72
|
-
open,
|
|
73
|
-
close,
|
|
74
|
-
}),
|
|
75
|
-
[open, close],
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
const tabItems = [
|
|
79
|
-
{
|
|
80
|
-
key: 'columns',
|
|
81
|
-
label: `${t('menus.model_metadata.manage.tab_columns')} (${viewColumns.length})`,
|
|
82
|
-
children: (
|
|
83
|
-
<div className="flex h-full min-h-0 flex-col">
|
|
84
|
-
<div className="min-h-0 flex-1 overflow-hidden rounded border border-gray-200 dark:border-gray-700">
|
|
85
|
-
<CxTable<Column>
|
|
86
|
-
size="mini"
|
|
87
|
-
autoScrollY
|
|
88
|
-
minScrollY={120}
|
|
89
|
-
columns={columnsTabColumns}
|
|
90
|
-
dataSource={viewColumns}
|
|
91
|
-
rowKey={(_, index) => String(index)}
|
|
92
|
-
scroll={{ x: 844 }}
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
),
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
key: 'indexes',
|
|
100
|
-
label: `${t('menus.model_metadata.manage.tab_indexes')} (${viewIndexes.length})`,
|
|
101
|
-
children: (
|
|
102
|
-
<div className="flex h-full min-h-0 flex-col">
|
|
103
|
-
<div className="min-h-0 flex-1 overflow-hidden rounded border border-gray-200 dark:border-gray-700">
|
|
104
|
-
<CxTable<Index>
|
|
105
|
-
size="mini"
|
|
106
|
-
autoScrollY
|
|
107
|
-
minScrollY={120}
|
|
108
|
-
columns={indexesTabColumns}
|
|
109
|
-
dataSource={viewIndexes}
|
|
110
|
-
rowKey={(_, index) => String(index)}
|
|
111
|
-
scroll={{ x: 800 }}
|
|
112
|
-
/>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
),
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
key: 'foreignKeys',
|
|
119
|
-
label: `${t('menus.model_metadata.manage.tab_foreignKeys')} (${viewForeignKeys.length})`,
|
|
120
|
-
children: (
|
|
121
|
-
<div className="flex h-full min-h-0 flex-col">
|
|
122
|
-
<div className="min-h-0 flex-1 overflow-hidden rounded border border-gray-200 dark:border-gray-700">
|
|
123
|
-
<CxTable<ForeignKey>
|
|
124
|
-
size="mini"
|
|
125
|
-
autoScrollY
|
|
126
|
-
minScrollY={120}
|
|
127
|
-
columns={foreignKeysTabColumns}
|
|
128
|
-
dataSource={viewForeignKeys}
|
|
129
|
-
rowKey={(_, index) => String(index)}
|
|
130
|
-
scroll={{ x: 1108 }}
|
|
131
|
-
/>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
),
|
|
135
|
-
},
|
|
136
|
-
]
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<CxModal
|
|
140
|
-
title={modalTitle}
|
|
141
|
-
isOpen={isOpen}
|
|
142
|
-
onClose={close}
|
|
143
|
-
opeType="detail"
|
|
144
|
-
modalConfig={{
|
|
145
|
-
width: TABLE_SUBMIT_MODAL_WIDTH,
|
|
146
|
-
styles: { ...tableSubmitModalShellStyles },
|
|
147
|
-
rootClassName: 'cx-modal-content-fill scroll',
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
<div className="flex h-full min-h-0 flex-1 flex-col gap-0 overflow-hidden">
|
|
151
|
-
<div className="shrink-0 border-b border-gray-200 pb-4 dark:border-gray-700">
|
|
152
|
-
<Form layout="horizontal" colon className="w-full">
|
|
153
|
-
<div className="grid grid-cols-1 gap-x-4 gap-y-2 md:grid-cols-3">
|
|
154
|
-
<Form.Item label={t('menus.model_metadata.manage.fields.tableSchema')} className="!mb-0">
|
|
155
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">
|
|
156
|
-
{headerSnapshot.tableSchema ?? '—'}
|
|
157
|
-
</div>
|
|
158
|
-
</Form.Item>
|
|
159
|
-
<Form.Item label={t('menus.model_metadata.manage.fields.tableName')} className="!mb-0">
|
|
160
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">
|
|
161
|
-
{headerSnapshot.tableName ?? '—'}
|
|
162
|
-
</div>
|
|
163
|
-
</Form.Item>
|
|
164
|
-
<Form.Item label={t('menus.model_metadata.manage.fields.tableType')} className="!mb-0">
|
|
165
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">
|
|
166
|
-
{headerSnapshot.tableType ?? '—'}
|
|
167
|
-
</div>
|
|
168
|
-
</Form.Item>
|
|
169
|
-
<Form.Item
|
|
170
|
-
label={t('menus.model_metadata.manage.fields.tableComment')}
|
|
171
|
-
className="!mb-0 md:col-span-3"
|
|
172
|
-
>
|
|
173
|
-
<div className="text-sm text-gray-900 dark:text-gray-100">
|
|
174
|
-
{headerSnapshot.tableComment ?? '—'}
|
|
175
|
-
</div>
|
|
176
|
-
</Form.Item>
|
|
177
|
-
</div>
|
|
178
|
-
</Form>
|
|
179
|
-
</div>
|
|
180
|
-
|
|
181
|
-
<div className="flex min-h-0 flex-1 flex-col overflow-hidden pt-4">
|
|
182
|
-
<CxTabs
|
|
183
|
-
activeKey={activeTab}
|
|
184
|
-
onChange={setActiveTab}
|
|
185
|
-
items={tabItems}
|
|
186
|
-
className="flex min-h-0 flex-1 flex-col [&_.ant-tabs-nav]:shrink-0 [&_.ant-tabs-content-holder]:min-h-0 [&_.ant-tabs-content-holder]:flex-1 [&_.ant-tabs-content]:h-full [&_.ant-tabs-tabpane]:h-full"
|
|
187
|
-
/>
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
</CxModal>
|
|
191
|
-
)
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
TableDetailModal.displayName = 'TableDetailModal'
|
|
195
|
-
|
|
196
|
-
export default TableDetailModal
|