cx-chat 0.0.2 → 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 -272
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 动态菜单生成的路由元数据(由 {@link generateAdminRoutes} 写入)。
|
|
3
|
-
* 用于:从详情/提交页回到真实列表路径、按菜单 code 跳转(避免写死 path)。
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type AdminMenuRouteEntry = {
|
|
7
|
-
/** 与 generateAdminRoutes 中 `basePath` 一致,无首尾 /,如 `page-menus/knowledge` */
|
|
8
|
-
basePath: string
|
|
9
|
-
/** 列表页 pathname,与路由注册一致,如 `/page-menus/knowledge/index` 或 `/knowledge` */
|
|
10
|
-
listPath: string
|
|
11
|
-
/** 后台菜单 code,可空 */
|
|
12
|
-
menuCode?: string
|
|
13
|
-
hasDetail: boolean
|
|
14
|
-
hasSubmit: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let entries: AdminMenuRouteEntry[] = []
|
|
18
|
-
|
|
19
|
-
const codeToListPath = new Map<string, string>()
|
|
20
|
-
|
|
21
|
-
function normalizePathname(p: string): string {
|
|
22
|
-
if (!p || p === '/') return '/'
|
|
23
|
-
return p.startsWith('/') ? p : `/${p}`
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function resetMenuRouteRegistry(): void {
|
|
27
|
-
entries = []
|
|
28
|
-
codeToListPath.clear()
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 在生成主布局业务路由时调用,与 router 里对 `route.path` / `basePath` 的计算保持一致。
|
|
33
|
-
*/
|
|
34
|
-
export function registerAdminMenuRoute(entry: AdminMenuRouteEntry): void {
|
|
35
|
-
entries.push(entry)
|
|
36
|
-
if (entry.menuCode != null && String(entry.menuCode).trim() !== '') {
|
|
37
|
-
codeToListPath.set(String(entry.menuCode).trim(), entry.listPath)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 当前 pathname 是否落在某菜单的详情/提交子路由下;是则返回该菜单的列表页 pathname。
|
|
43
|
-
* 按 basePath 长度降序匹配,避免父子路径串台。
|
|
44
|
-
*/
|
|
45
|
-
export function getListPathFromSubRoutePathname(pathname: string): string | null {
|
|
46
|
-
const p = normalizePathname(pathname)
|
|
47
|
-
const sorted = [...entries].sort((a, b) => b.basePath.length - a.basePath.length)
|
|
48
|
-
|
|
49
|
-
for (const e of sorted) {
|
|
50
|
-
const bp = e.basePath.replace(/^\/+|\/+$/g, '')
|
|
51
|
-
if (!bp) continue
|
|
52
|
-
|
|
53
|
-
if (e.hasDetail) {
|
|
54
|
-
const detailPrefix = `/${bp}/detail`
|
|
55
|
-
if (p === detailPrefix || p.startsWith(`${detailPrefix}/`)) {
|
|
56
|
-
return e.listPath
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (e.hasSubmit) {
|
|
60
|
-
const submitPrefix = `/${bp}/submit`
|
|
61
|
-
if (p === submitPrefix || p.startsWith(`${submitPrefix}/`)) {
|
|
62
|
-
return e.listPath
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return null
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** 按菜单 code 取列表页 pathname(需在菜单里配置过 code 且已注册) */
|
|
70
|
-
export function getListPathByMenuCode(menuCode: string): string | undefined {
|
|
71
|
-
if (!menuCode || String(menuCode).trim() === '') return undefined
|
|
72
|
-
return codeToListPath.get(String(menuCode).trim())
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** 供调试或侧栏高亮 */
|
|
76
|
-
export function getRegisteredMenuRouteEntries(): readonly AdminMenuRouteEntry[] {
|
|
77
|
-
return entries
|
|
78
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 权限操作语义:列表「复制为×」用前四种;名称/后缀推断含 导出、启用、禁用。
|
|
3
|
-
*/
|
|
4
|
-
export type PermissionCrud =
|
|
5
|
-
| 'add'
|
|
6
|
-
| 'edit'
|
|
7
|
-
| 'delete'
|
|
8
|
-
| 'detail'
|
|
9
|
-
| 'export'
|
|
10
|
-
| 'enable'
|
|
11
|
-
| 'disable'
|
|
12
|
-
|
|
13
|
-
/** 兼容旧命名(列表复制菜单仍为 add/edit/delete/view) */
|
|
14
|
-
export type PermissionCrudCopyVariant = PermissionCrud
|
|
15
|
-
|
|
16
|
-
const TITLE_WORD: Record<PermissionCrud, string> = {
|
|
17
|
-
add: '新增',
|
|
18
|
-
edit: '修改',
|
|
19
|
-
delete: '删除',
|
|
20
|
-
detail: '详情',
|
|
21
|
-
export: '导出',
|
|
22
|
-
enable: '启用',
|
|
23
|
-
disable: '禁用',
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const TITLE_KEYWORDS = [
|
|
27
|
-
'新增',
|
|
28
|
-
'修改',
|
|
29
|
-
'删除',
|
|
30
|
-
'详情',
|
|
31
|
-
'导出',
|
|
32
|
-
'启用',
|
|
33
|
-
'禁用',
|
|
34
|
-
] as const
|
|
35
|
-
|
|
36
|
-
const HTTP_METHOD: Record<PermissionCrud, string> = {
|
|
37
|
-
add: 'POST',
|
|
38
|
-
edit: 'PUT',
|
|
39
|
-
delete: 'DELETE',
|
|
40
|
-
detail: 'GET',
|
|
41
|
-
export: 'GET',
|
|
42
|
-
enable: 'PUT',
|
|
43
|
-
disable: 'PUT',
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const EN_VERB: Record<PermissionCrud, string> = {
|
|
47
|
-
add: 'add',
|
|
48
|
-
edit: 'edit',
|
|
49
|
-
delete: 'delete',
|
|
50
|
-
detail: 'detail',
|
|
51
|
-
export: 'export',
|
|
52
|
-
enable: 'enable',
|
|
53
|
-
disable: 'disable',
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/** 长词、易混词优先;edit 前须非小写字母,避免命中 credit 等 */
|
|
57
|
-
const VERBS: { kw: string; crud: PermissionCrud }[] = [
|
|
58
|
-
{ kw: 'edit', crud: 'edit' },
|
|
59
|
-
{ kw: 'disable', crud: 'disable' },
|
|
60
|
-
{ kw: 'delete', crud: 'delete' },
|
|
61
|
-
{ kw: 'export', crud: 'export' },
|
|
62
|
-
{ kw: 'enable', crud: 'enable' },
|
|
63
|
-
{ kw: 'detail', crud: 'detail' },
|
|
64
|
-
{ kw: 'edit', crud: 'edit' },
|
|
65
|
-
{ kw: 'add', crud: 'add' },
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
function hitVerb(lower: string): { i: number; len: number; crud: PermissionCrud } | null {
|
|
69
|
-
let best: { i: number; len: number; crud: PermissionCrud } | null = null
|
|
70
|
-
for (const { kw, crud } of VERBS) {
|
|
71
|
-
let from = 0
|
|
72
|
-
while (from <= lower.length - kw.length) {
|
|
73
|
-
const i = lower.indexOf(kw, from)
|
|
74
|
-
if (i < 0) break
|
|
75
|
-
const ok = i === 0 || /[^a-z]/.test(lower[i - 1])
|
|
76
|
-
if (ok && (!best || i < best.i)) {
|
|
77
|
-
best = { i, len: kw.length, crud }
|
|
78
|
-
}
|
|
79
|
-
from = i + 1
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return best
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function patchTitle(title: string, op: PermissionCrud): string {
|
|
86
|
-
const w = TITLE_WORD[op]
|
|
87
|
-
const s = String(title ?? '')
|
|
88
|
-
let bi = -1
|
|
89
|
-
let bl = 0
|
|
90
|
-
for (const kw of TITLE_KEYWORDS) {
|
|
91
|
-
const i = s.indexOf(kw)
|
|
92
|
-
if (i >= 0 && (bi < 0 || i < bi)) {
|
|
93
|
-
bi = i
|
|
94
|
-
bl = kw.length
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (bi >= 0) return s.slice(0, bi) + w + s.slice(bi + bl)
|
|
98
|
-
return w + s
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function patchSuffix(suffix: string, op: PermissionCrud): string {
|
|
102
|
-
const s = String(suffix ?? '')
|
|
103
|
-
const lower = s.toLowerCase()
|
|
104
|
-
const h = hitVerb(lower)
|
|
105
|
-
// 无法识别动词时,直接使用目标操作的后缀
|
|
106
|
-
if (!h) return EN_VERB[op]
|
|
107
|
-
const en = EN_VERB[op]
|
|
108
|
-
return s.slice(0, h.i) + en + s.slice(h.i + h.len)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** 旧数据 + 目标操作 → 名称、请求方法、编码后缀(与列表「复制为×」同一套规则) */
|
|
112
|
-
export type PermissionCrudSlice = {
|
|
113
|
-
title: string
|
|
114
|
-
httpMethod: string
|
|
115
|
-
/** 权限编码里菜单冒号后的整段后缀 */
|
|
116
|
-
codeSuffix: string
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function toPermissionCrudSlice(
|
|
120
|
-
prev: PermissionCrudSlice,
|
|
121
|
-
op: PermissionCrud,
|
|
122
|
-
): PermissionCrudSlice {
|
|
123
|
-
return {
|
|
124
|
-
title: patchTitle(prev.title, op),
|
|
125
|
-
httpMethod: HTTP_METHOD[op],
|
|
126
|
-
codeSuffix: patchSuffix(prev.codeSuffix, op),
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** 从后缀推断操作;无识别动词则 null */
|
|
131
|
-
export function inferCrudFromSuffix(suffix: string | null | undefined): PermissionCrud | null {
|
|
132
|
-
const h = hitVerb(String(suffix ?? '').toLowerCase())
|
|
133
|
-
return h ? h.crud : null
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** 表单:自定义优先于字典选中项,得到有效后缀 */
|
|
137
|
-
export function getEffectiveCodeSuffix(
|
|
138
|
-
codeCustom: unknown,
|
|
139
|
-
codePreset: unknown,
|
|
140
|
-
): string {
|
|
141
|
-
const c = String(codeCustom ?? '').trim()
|
|
142
|
-
const p =
|
|
143
|
-
codePreset != null && String(codePreset).trim() !== ''
|
|
144
|
-
? String(codePreset).trim()
|
|
145
|
-
: ''
|
|
146
|
-
return c !== '' ? c : p
|
|
147
|
-
}
|
package/src/utils/routeConfig.ts
DELETED
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
import * as Icons from 'lucide-react';
|
|
2
|
-
import type { MenuTreeItem } from '../types/menu';
|
|
3
|
-
|
|
4
|
-
// 图标映射表 - 将字符串映射到实际的图标组件
|
|
5
|
-
export const iconMap: Record<string, any> = {
|
|
6
|
-
MessageSquare: Icons.MessageSquare,
|
|
7
|
-
MessageSquareQuote: Icons.MessageSquareQuote,
|
|
8
|
-
Settings: Icons.Settings,
|
|
9
|
-
Cog: Icons.Cog,
|
|
10
|
-
Wrench: Icons.Wrench,
|
|
11
|
-
SlidersHorizontal: Icons.SlidersHorizontal,
|
|
12
|
-
LogOut: Icons.LogOut,
|
|
13
|
-
LogIn: Icons.LogIn,
|
|
14
|
-
Menu: Icons.Menu,
|
|
15
|
-
Plus: Icons.Plus,
|
|
16
|
-
Minus: Icons.Minus,
|
|
17
|
-
CirclePlus: Icons.CirclePlus,
|
|
18
|
-
SquarePlus: Icons.SquarePlus,
|
|
19
|
-
Trash2: Icons.Trash2,
|
|
20
|
-
Check: Icons.Check,
|
|
21
|
-
CheckCircle2: Icons.CheckCircle2,
|
|
22
|
-
X: Icons.X,
|
|
23
|
-
CircleX: Icons.CircleX,
|
|
24
|
-
Search: Icons.Search,
|
|
25
|
-
Filter: Icons.Filter,
|
|
26
|
-
Funnel: Icons.Funnel,
|
|
27
|
-
ChevronDown: Icons.ChevronDown,
|
|
28
|
-
ChevronRight: Icons.ChevronRight,
|
|
29
|
-
ChevronLeft: Icons.ChevronLeft,
|
|
30
|
-
ChevronUp: Icons.ChevronUp,
|
|
31
|
-
Loader2: Icons.Loader2,
|
|
32
|
-
Shield: Icons.Shield,
|
|
33
|
-
ShieldUser: Icons.ShieldUser,
|
|
34
|
-
ShieldCheck: Icons.ShieldCheck,
|
|
35
|
-
Users: Icons.Users,
|
|
36
|
-
User: Icons.User,
|
|
37
|
-
UserCog: Icons.UserCog,
|
|
38
|
-
UserRound: Icons.UserRound,
|
|
39
|
-
Lock: Icons.Lock,
|
|
40
|
-
Unlock: Icons.Unlock,
|
|
41
|
-
KeyRound: Icons.KeyRound,
|
|
42
|
-
MoreVertical: Icons.MoreVertical,
|
|
43
|
-
MoreHorizontal: Icons.MoreHorizontal,
|
|
44
|
-
Pin: Icons.Pin,
|
|
45
|
-
PinOff: Icons.PinOff,
|
|
46
|
-
Edit2: Icons.Edit2,
|
|
47
|
-
Pencil: Icons.Pencil,
|
|
48
|
-
PenSquare: Icons.PenSquare,
|
|
49
|
-
LibraryBig: Icons.LibraryBig,
|
|
50
|
-
BookOpen: Icons.BookOpen,
|
|
51
|
-
FileText: Icons.FileText,
|
|
52
|
-
File: Icons.File,
|
|
53
|
-
Files: Icons.Files,
|
|
54
|
-
FileCode2: Icons.FileCode2,
|
|
55
|
-
FileStack: Icons.FileStack,
|
|
56
|
-
HousePlus: Icons.HousePlus,
|
|
57
|
-
Home: Icons.Home,
|
|
58
|
-
House: Icons.House,
|
|
59
|
-
Building2: Icons.Building2,
|
|
60
|
-
Landmark: Icons.Landmark,
|
|
61
|
-
Briefcase: Icons.Briefcase,
|
|
62
|
-
Folder: Icons.Folder,
|
|
63
|
-
FolderOpen: Icons.FolderOpen,
|
|
64
|
-
Database: Icons.Database,
|
|
65
|
-
Server: Icons.Server,
|
|
66
|
-
Cloud: Icons.Cloud,
|
|
67
|
-
Globe: Icons.Globe,
|
|
68
|
-
Network: Icons.Network,
|
|
69
|
-
Terminal: Icons.Terminal,
|
|
70
|
-
Code2: Icons.Code2,
|
|
71
|
-
Bug: Icons.Bug,
|
|
72
|
-
Bell: Icons.Bell,
|
|
73
|
-
Mail: Icons.Mail,
|
|
74
|
-
Phone: Icons.Phone,
|
|
75
|
-
Calendar: Icons.Calendar,
|
|
76
|
-
Clock3: Icons.Clock3,
|
|
77
|
-
History: Icons.History,
|
|
78
|
-
RefreshCw: Icons.RefreshCw,
|
|
79
|
-
RotateCcw: Icons.RotateCcw,
|
|
80
|
-
Download: Icons.Download,
|
|
81
|
-
Upload: Icons.Upload,
|
|
82
|
-
Eye: Icons.Eye,
|
|
83
|
-
EyeOff: Icons.EyeOff,
|
|
84
|
-
Copy: Icons.Copy,
|
|
85
|
-
Clipboard: Icons.Clipboard,
|
|
86
|
-
BadgeCheck: Icons.BadgeCheck,
|
|
87
|
-
Award: Icons.Award,
|
|
88
|
-
Star: Icons.Star,
|
|
89
|
-
Heart: Icons.Heart,
|
|
90
|
-
Flag: Icons.Flag,
|
|
91
|
-
Tags: Icons.Tags,
|
|
92
|
-
Tag: Icons.Tag,
|
|
93
|
-
Map: Icons.Map,
|
|
94
|
-
MapPin: Icons.MapPin,
|
|
95
|
-
Wallet: Icons.Wallet,
|
|
96
|
-
CreditCard: Icons.CreditCard,
|
|
97
|
-
Receipt: Icons.Receipt,
|
|
98
|
-
ShoppingCart: Icons.ShoppingCart,
|
|
99
|
-
Package: Icons.Package,
|
|
100
|
-
Truck: Icons.Truck,
|
|
101
|
-
PieChart: Icons.PieChart,
|
|
102
|
-
BarChart3: Icons.BarChart3,
|
|
103
|
-
LineChart: Icons.LineChart,
|
|
104
|
-
|
|
105
|
-
// 菜单 / 导航
|
|
106
|
-
MenuSquare: Icons.MenuSquare,
|
|
107
|
-
ListTree: Icons.ListTree,
|
|
108
|
-
PanelLeft: Icons.PanelLeft,
|
|
109
|
-
PanelRight: Icons.PanelRight,
|
|
110
|
-
|
|
111
|
-
// 业务规则 / 工作流
|
|
112
|
-
GitCompare: Icons.GitCompare,
|
|
113
|
-
Route: Icons.Route,
|
|
114
|
-
WorkflowIcon: Icons.Workflow,
|
|
115
|
-
GitMerge: Icons.GitMerge,
|
|
116
|
-
SplitSquareHorizontal: Icons.SplitSquareHorizontal,
|
|
117
|
-
|
|
118
|
-
// 反馈 / 审查
|
|
119
|
-
MessageCircleWarning: Icons.MessageCircleWarning,
|
|
120
|
-
AlertTriangle: Icons.AlertTriangle,
|
|
121
|
-
AlertCircle: Icons.AlertCircle,
|
|
122
|
-
ClipboardCheck: Icons.ClipboardCheck,
|
|
123
|
-
|
|
124
|
-
// 系统日志 / 监控
|
|
125
|
-
ScrollText: Icons.ScrollText,
|
|
126
|
-
FileSearch: Icons.FileSearch,
|
|
127
|
-
ActivitySquare: Icons.ActivitySquare,
|
|
128
|
-
ChartSpline: Icons.ChartSpline,
|
|
129
|
-
|
|
130
|
-
// 用户管理
|
|
131
|
-
UserPlus: Icons.UserPlus,
|
|
132
|
-
UserMinus: Icons.UserMinus,
|
|
133
|
-
UsersRound: Icons.UsersRound,
|
|
134
|
-
ContactRound: Icons.ContactRound,
|
|
135
|
-
IdCard: Icons.IdCard,
|
|
136
|
-
|
|
137
|
-
// 部门管理
|
|
138
|
-
Building: Icons.Building,
|
|
139
|
-
Trees: Icons.Trees,
|
|
140
|
-
NetworkIcon: Icons.Network,
|
|
141
|
-
GitFork: Icons.GitFork,
|
|
142
|
-
|
|
143
|
-
// 角色管理
|
|
144
|
-
Badge: Icons.Badge,
|
|
145
|
-
ShieldAlert: Icons.ShieldAlert,
|
|
146
|
-
ShieldQuestion: Icons.ShieldQuestion,
|
|
147
|
-
UserCog2: Icons.UserCog2,
|
|
148
|
-
|
|
149
|
-
// 权限管理
|
|
150
|
-
Key: Icons.Key,
|
|
151
|
-
LockKeyhole: Icons.LockKeyhole,
|
|
152
|
-
Fingerprint: Icons.Fingerprint,
|
|
153
|
-
ShieldHalf: Icons.ShieldHalf,
|
|
154
|
-
|
|
155
|
-
// 知识库管理
|
|
156
|
-
BookMarked: Icons.BookMarked,
|
|
157
|
-
BookDashed: Icons.BookDashed,
|
|
158
|
-
Library: Icons.Library,
|
|
159
|
-
Bookmark: Icons.Bookmark,
|
|
160
|
-
BookOpenCheck: Icons.BookOpenCheck,
|
|
161
|
-
GraduationCap: Icons.GraduationCap,
|
|
162
|
-
|
|
163
|
-
// 技能管理
|
|
164
|
-
Sparkles: Icons.Sparkles,
|
|
165
|
-
Wand2: Icons.Wand2,
|
|
166
|
-
Lightbulb: Icons.Lightbulb,
|
|
167
|
-
ZapOff: Icons.ZapOff,
|
|
168
|
-
Stars: Icons.Stars,
|
|
169
|
-
WrenchIcon: Icons.Wrench,
|
|
170
|
-
|
|
171
|
-
// 智能体配置
|
|
172
|
-
Bot: Icons.Bot,
|
|
173
|
-
BotMessageSquare: Icons.BotMessageSquare,
|
|
174
|
-
BrainCircuit: Icons.BrainCircuit,
|
|
175
|
-
BrainCog: Icons.BrainCog,
|
|
176
|
-
CpuIcon: Icons.Cpu,
|
|
177
|
-
Settings2: Icons.Settings2,
|
|
178
|
-
|
|
179
|
-
// 系统设置
|
|
180
|
-
Sliders: Icons.Sliders,
|
|
181
|
-
ToggleLeft: Icons.ToggleLeft,
|
|
182
|
-
ToggleRight: Icons.ToggleRight,
|
|
183
|
-
SwitchCamera: Icons.SwitchCamera,
|
|
184
|
-
Component: Icons.Component,
|
|
185
|
-
|
|
186
|
-
// 数据字典
|
|
187
|
-
BookType: Icons.BookType,
|
|
188
|
-
Type: Icons.Type,
|
|
189
|
-
Hash: Icons.Hash,
|
|
190
|
-
TableProperties: Icons.TableProperties,
|
|
191
|
-
|
|
192
|
-
// 模型元数据
|
|
193
|
-
DatabaseZap: Icons.DatabaseZap,
|
|
194
|
-
TableIcon: Icons.Table2,
|
|
195
|
-
Columns4: Icons.Columns4,
|
|
196
|
-
SquareCode: Icons.SquareCode,
|
|
197
|
-
Brackets: Icons.Brackets,
|
|
198
|
-
Variable: Icons.Variable,
|
|
199
|
-
|
|
200
|
-
// Web / 后台系统常用
|
|
201
|
-
Activity: Icons.Activity,
|
|
202
|
-
Antenna: Icons.Antenna,
|
|
203
|
-
Binary: Icons.Binary,
|
|
204
|
-
Box: Icons.Box,
|
|
205
|
-
Boxes: Icons.Boxes,
|
|
206
|
-
Braces: Icons.Braces,
|
|
207
|
-
ClipboardList: Icons.ClipboardList,
|
|
208
|
-
ExternalLink: Icons.ExternalLink,
|
|
209
|
-
GitBranch: Icons.GitBranch,
|
|
210
|
-
Kanban: Icons.Kanban,
|
|
211
|
-
Laptop: Icons.Laptop,
|
|
212
|
-
LayoutDashboard: Icons.LayoutDashboard,
|
|
213
|
-
LayoutGrid: Icons.LayoutGrid,
|
|
214
|
-
Layers: Icons.Layers,
|
|
215
|
-
Layers2: Icons.Layers2,
|
|
216
|
-
Link2: Icons.Link2,
|
|
217
|
-
Merge: Icons.Merge,
|
|
218
|
-
Monitor: Icons.Monitor,
|
|
219
|
-
MonitorCog: Icons.MonitorCog,
|
|
220
|
-
QrCode: Icons.QrCode,
|
|
221
|
-
Router: Icons.Router,
|
|
222
|
-
Rss: Icons.Rss,
|
|
223
|
-
ScanLine: Icons.ScanLine,
|
|
224
|
-
Share2: Icons.Share2,
|
|
225
|
-
Smartphone: Icons.Smartphone,
|
|
226
|
-
Split: Icons.Split,
|
|
227
|
-
Table2: Icons.Table2,
|
|
228
|
-
Tablet: Icons.Tablet,
|
|
229
|
-
Webhook: Icons.Webhook,
|
|
230
|
-
Wifi: Icons.Wifi,
|
|
231
|
-
WifiCog: Icons.WifiCog,
|
|
232
|
-
Workflow: Icons.Workflow,
|
|
233
|
-
|
|
234
|
-
// 工业 / 设备 / 能源
|
|
235
|
-
Anvil: Icons.Anvil,
|
|
236
|
-
Bolt: Icons.Bolt,
|
|
237
|
-
Cable: Icons.Cable,
|
|
238
|
-
CircleGauge: Icons.CircleGauge,
|
|
239
|
-
Cpu: Icons.Cpu,
|
|
240
|
-
Cylinder: Icons.Cylinder,
|
|
241
|
-
DatabaseBackup: Icons.DatabaseBackup,
|
|
242
|
-
Drill: Icons.Drill,
|
|
243
|
-
Droplets: Icons.Droplets,
|
|
244
|
-
Factory: Icons.Factory,
|
|
245
|
-
Fan: Icons.Fan,
|
|
246
|
-
Flame: Icons.Flame,
|
|
247
|
-
Gauge: Icons.Gauge,
|
|
248
|
-
HardDrive: Icons.HardDrive,
|
|
249
|
-
HardDriveDownload: Icons.HardDriveDownload,
|
|
250
|
-
HardDriveUpload: Icons.HardDriveUpload,
|
|
251
|
-
Heater: Icons.Heater,
|
|
252
|
-
Microscope: Icons.Microscope,
|
|
253
|
-
Nut: Icons.Nut,
|
|
254
|
-
Orbit: Icons.Orbit,
|
|
255
|
-
Plug: Icons.Plug,
|
|
256
|
-
Plug2: Icons.Plug2,
|
|
257
|
-
PlugZap: Icons.PlugZap,
|
|
258
|
-
Radar: Icons.Radar,
|
|
259
|
-
Radio: Icons.Radio,
|
|
260
|
-
RadioTower: Icons.RadioTower,
|
|
261
|
-
Satellite: Icons.Satellite,
|
|
262
|
-
SatelliteDish: Icons.SatelliteDish,
|
|
263
|
-
ServerCog: Icons.ServerCog,
|
|
264
|
-
TowerControl: Icons.TowerControl,
|
|
265
|
-
Warehouse: Icons.Warehouse,
|
|
266
|
-
Wind: Icons.Wind,
|
|
267
|
-
Zap: Icons.Zap,
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* 根据图标名称获取图标组件
|
|
272
|
-
*/
|
|
273
|
-
export const getIconComponent = (iconName?: string) => {
|
|
274
|
-
if (!iconName) return null;
|
|
275
|
-
return iconMap[iconName] || null;
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* 过滤菜单树(仅做展示层结构调整):
|
|
280
|
-
* - 后端已经按权限筛过,这里不再做权限判断
|
|
281
|
-
* - 跳过 hidden
|
|
282
|
-
* - 如果 only-child 且 alwaysShow=false,则提升子菜单到当前层级(不显示父级)
|
|
283
|
-
* - 多子菜单且 alwaysShow=false,只展示子菜单(不显示父级)
|
|
284
|
-
* - 其他情况保持父子结构
|
|
285
|
-
*/
|
|
286
|
-
export const filterMenuTree = (
|
|
287
|
-
menus: MenuTreeItem[],
|
|
288
|
-
_hasPermission: (permission: string) => boolean,
|
|
289
|
-
): MenuTreeItem[] => {
|
|
290
|
-
const walk = (nodes: MenuTreeItem[] | undefined): MenuTreeItem[] => {
|
|
291
|
-
if (!nodes?.length) return []
|
|
292
|
-
|
|
293
|
-
const result: MenuTreeItem[] = []
|
|
294
|
-
|
|
295
|
-
for (const menu of nodes) {
|
|
296
|
-
if (menu.hidden) continue
|
|
297
|
-
|
|
298
|
-
const children = walk(menu.children)
|
|
299
|
-
|
|
300
|
-
if (!children.length) {
|
|
301
|
-
// 叶子节点:直接保留
|
|
302
|
-
result.push({ ...menu, children: [] })
|
|
303
|
-
continue
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
if (menu.alwaysShow) {
|
|
307
|
-
// 显示父级 + 子级
|
|
308
|
-
result.push({ ...menu, children })
|
|
309
|
-
} else {
|
|
310
|
-
const shouldFullDisplay =
|
|
311
|
-
Boolean((menu as any).alwaysShow) || Number((menu as any).fullDisplay) === 1
|
|
312
|
-
if (children.length === 1) {
|
|
313
|
-
// 只有一个子菜单时,只展示子菜单
|
|
314
|
-
if (shouldFullDisplay) {
|
|
315
|
-
result.push({ ...menu, children })
|
|
316
|
-
} else {
|
|
317
|
-
result.push(children[0])
|
|
318
|
-
}
|
|
319
|
-
} else {
|
|
320
|
-
// 多个子菜单,只展示子菜单列表
|
|
321
|
-
if (shouldFullDisplay) {
|
|
322
|
-
result.push({ ...menu, children })
|
|
323
|
-
} else {
|
|
324
|
-
result.push(...children)
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return result
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
return walk(menus)
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* 展平菜单树为列表(用于生成路由)
|
|
338
|
-
*/
|
|
339
|
-
export const flattenMenuTree = (menus: MenuTreeItem[]): MenuTreeItem[] => {
|
|
340
|
-
const result: MenuTreeItem[] = [];
|
|
341
|
-
|
|
342
|
-
for (const menu of menus) {
|
|
343
|
-
result.push(menu);
|
|
344
|
-
if (menu.children && menu.children.length > 0) {
|
|
345
|
-
result.push(...flattenMenuTree(menu.children));
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
return result;
|
|
350
|
-
};
|
package/src/utils/storage.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import Cookies from 'js-cookie'
|
|
2
|
-
import aesUtil from '@utils/aesUtil'
|
|
3
|
-
|
|
4
|
-
export const STORAGE_PREFIX = 'apps-agent-'
|
|
5
|
-
|
|
6
|
-
function getReturnData(value: string | null): string {
|
|
7
|
-
if (!value) {
|
|
8
|
-
return ''
|
|
9
|
-
}
|
|
10
|
-
const result = aesUtil.decrypt(value)
|
|
11
|
-
if (typeof result === 'object' && result !== null) {
|
|
12
|
-
return JSON.stringify(result)
|
|
13
|
-
}
|
|
14
|
-
return typeof result === 'string' ? result : String(result)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 存储 localStorage(值会经 aesUtil 加密)
|
|
19
|
-
*/
|
|
20
|
-
export const setStore = (name: string, content: unknown): void => {
|
|
21
|
-
if (!name) return
|
|
22
|
-
const str =
|
|
23
|
-
typeof content === 'string' ? content : JSON.stringify(content)
|
|
24
|
-
window.localStorage.setItem(STORAGE_PREFIX + name, aesUtil.encrypt(str))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 获取 localStorage
|
|
29
|
-
*/
|
|
30
|
-
export const getStore = (name: string): string | undefined => {
|
|
31
|
-
if (!name) return undefined
|
|
32
|
-
const v = window.localStorage.getItem(STORAGE_PREFIX + name)
|
|
33
|
-
return getReturnData(v)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** 会话流式请求:是否开启联网搜索(与 ChatInput 一致) */
|
|
37
|
-
export const CHAT_ENABLE_NETWORK_STORE = 'chat-enable-network'
|
|
38
|
-
|
|
39
|
-
export function getChatEnableNetwork(): boolean {
|
|
40
|
-
const raw = getStore(CHAT_ENABLE_NETWORK_STORE)
|
|
41
|
-
if (raw === undefined || raw === '') return false
|
|
42
|
-
try {
|
|
43
|
-
return JSON.parse(raw) === true
|
|
44
|
-
} catch {
|
|
45
|
-
return raw === 'true'
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function setChatEnableNetwork(enabled: boolean): void {
|
|
50
|
-
setStore(CHAT_ENABLE_NETWORK_STORE, enabled)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** 会话流式请求:是否启用知识库检索 */
|
|
54
|
-
export const CHAT_ENABLE_KNOWLEDGE_BASE_STORE = 'chat-enable-knowledge-base'
|
|
55
|
-
|
|
56
|
-
export function getChatEnableKnowledgeBase(): boolean {
|
|
57
|
-
const raw = getStore(CHAT_ENABLE_KNOWLEDGE_BASE_STORE)
|
|
58
|
-
if (raw === undefined || raw === '') return false
|
|
59
|
-
try {
|
|
60
|
-
return JSON.parse(raw) === true
|
|
61
|
-
} catch {
|
|
62
|
-
return raw === 'true'
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function setChatEnableKnowledgeBase(enabled: boolean): void {
|
|
67
|
-
setStore(CHAT_ENABLE_KNOWLEDGE_BASE_STORE, enabled)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** 会话流式请求:是否启用数据分析 */
|
|
71
|
-
export const CHAT_ENABLE_DATA_ANALYSIS_STORE = 'chat-enable-data-analysis'
|
|
72
|
-
|
|
73
|
-
export function getChatEnableDataAnalysis(): boolean {
|
|
74
|
-
const raw = getStore(CHAT_ENABLE_DATA_ANALYSIS_STORE)
|
|
75
|
-
if (raw === undefined || raw === '') return false
|
|
76
|
-
try {
|
|
77
|
-
return JSON.parse(raw) === true
|
|
78
|
-
} catch {
|
|
79
|
-
return raw === 'true'
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function setChatEnableDataAnalysis(enabled: boolean): void {
|
|
84
|
-
setStore(CHAT_ENABLE_DATA_ANALYSIS_STORE, enabled)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* 删除 localStorage
|
|
89
|
-
*/
|
|
90
|
-
export const removeStore = (name: string): void => {
|
|
91
|
-
if (!name) return
|
|
92
|
-
window.localStorage.removeItem(STORAGE_PREFIX + name)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 删除本应用前缀下的 localStorage
|
|
97
|
-
*/
|
|
98
|
-
export const clearStore = (): void => {
|
|
99
|
-
Object.keys(window.localStorage).forEach((key) => {
|
|
100
|
-
if (key.startsWith(STORAGE_PREFIX)) {
|
|
101
|
-
window.localStorage.removeItem(key)
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export const setSessionStore = (name: string, content: unknown): void => {
|
|
107
|
-
if (!name) return
|
|
108
|
-
const str =
|
|
109
|
-
typeof content === 'string' ? content : JSON.stringify(content)
|
|
110
|
-
window.sessionStorage.setItem(STORAGE_PREFIX + name, aesUtil.encrypt(str))
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export const getSessionStore = (name: string): string | undefined => {
|
|
114
|
-
if (!name) return undefined
|
|
115
|
-
const v = window.sessionStorage.getItem(STORAGE_PREFIX + name)
|
|
116
|
-
return getReturnData(v)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export const removeSessionStore = (name: string): void => {
|
|
120
|
-
if (!name) return
|
|
121
|
-
window.sessionStorage.removeItem(STORAGE_PREFIX + name)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function getCookie(key: string): string {
|
|
125
|
-
const v = Cookies.get(STORAGE_PREFIX + key)
|
|
126
|
-
return getReturnData(v ?? null)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function setCookie(key: string, value: string): string | undefined {
|
|
130
|
-
return Cookies.set(STORAGE_PREFIX + key, aesUtil.encrypt(value))
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function removeCookie(key: string): void {
|
|
134
|
-
Cookies.remove(STORAGE_PREFIX + key)
|
|
135
|
-
}
|