cx-chat 0.0.2 → 0.0.4
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 +68257 -0
- package/dist/cx-chat.umd.js +492 -0
- package/package.json +27 -3
- 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,120 +0,0 @@
|
|
|
1
|
-
import type { SwitchProps } from 'antd'
|
|
2
|
-
import { Switch } from 'antd'
|
|
3
|
-
import type { ReactNode } from 'react'
|
|
4
|
-
import './index.less'
|
|
5
|
-
|
|
6
|
-
export type CxSwitchVariant = 'default' | 'text' | 'dual'
|
|
7
|
-
|
|
8
|
-
export type CxSwitchProps = SwitchProps & {
|
|
9
|
-
variant?: CxSwitchVariant
|
|
10
|
-
/** variant=text:选中态轨道内文案 */
|
|
11
|
-
checkedText?: ReactNode
|
|
12
|
-
/** variant=text:未选中态轨道内文案 */
|
|
13
|
-
uncheckedText?: ReactNode
|
|
14
|
-
/** variant=dual:左侧文案(对应 dualUncheckedValue) */
|
|
15
|
-
leftLabel?: ReactNode
|
|
16
|
-
/** variant=dual:右侧文案(对应 dualCheckedValue) */
|
|
17
|
-
rightLabel?: ReactNode
|
|
18
|
-
/** variant=dual:左侧对应取值 */
|
|
19
|
-
dualUncheckedValue?: string | number
|
|
20
|
-
/** variant=dual:右侧对应取值 */
|
|
21
|
-
dualCheckedValue?: string | number
|
|
22
|
-
/** variant=dual 时由 Form 注入 */
|
|
23
|
-
value?: string | number | boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 表单用开关;支持轨道内文案(text)、左右文案 + 双值(dual)。
|
|
28
|
-
*/
|
|
29
|
-
const CxSwitch = ({
|
|
30
|
-
className,
|
|
31
|
-
variant = 'default',
|
|
32
|
-
checkedText,
|
|
33
|
-
uncheckedText,
|
|
34
|
-
leftLabel,
|
|
35
|
-
rightLabel,
|
|
36
|
-
dualUncheckedValue = 1,
|
|
37
|
-
dualCheckedValue = 2,
|
|
38
|
-
value,
|
|
39
|
-
checked,
|
|
40
|
-
onChange,
|
|
41
|
-
disabled,
|
|
42
|
-
...rest
|
|
43
|
-
}: CxSwitchProps) => {
|
|
44
|
-
const baseClass = ['cx-switch', className].filter(Boolean).join(' ')
|
|
45
|
-
|
|
46
|
-
if (variant === 'dual') {
|
|
47
|
-
const raw =
|
|
48
|
-
value !== undefined && value !== null
|
|
49
|
-
? Number(value)
|
|
50
|
-
: Number(dualUncheckedValue)
|
|
51
|
-
const isRight = raw === Number(dualCheckedValue)
|
|
52
|
-
|
|
53
|
-
const emit = (next: string | number) => {
|
|
54
|
-
if (disabled) return
|
|
55
|
-
if (typeof onChange !== 'function') return
|
|
56
|
-
// Form 注入的 onChange 多为单参;antd Switch 为 (checked, e)。dual 只向外抛业务值。
|
|
57
|
-
;(onChange as unknown as (v: string | number) => void)(next)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div
|
|
62
|
-
className={['cx-switch-dual', disabled && 'cx-switch-dual--disabled']
|
|
63
|
-
.filter(Boolean)
|
|
64
|
-
.join(' ')}>
|
|
65
|
-
<button
|
|
66
|
-
type="button"
|
|
67
|
-
disabled={disabled}
|
|
68
|
-
className={`cx-switch-dual__side${!isRight ? ' cx-switch-dual__side--active' : ''}`}
|
|
69
|
-
onClick={() => emit(dualUncheckedValue)}>
|
|
70
|
-
{leftLabel}
|
|
71
|
-
</button>
|
|
72
|
-
<Switch
|
|
73
|
-
{...rest}
|
|
74
|
-
disabled={disabled}
|
|
75
|
-
className={`${baseClass} cx-switch--dual-track`}
|
|
76
|
-
checked={isRight}
|
|
77
|
-
onChange={(c) => emit(c ? dualCheckedValue : dualUncheckedValue)}
|
|
78
|
-
/>
|
|
79
|
-
<button
|
|
80
|
-
type="button"
|
|
81
|
-
disabled={disabled}
|
|
82
|
-
className={`cx-switch-dual__side${isRight ? ' cx-switch-dual__side--active' : ''}`}
|
|
83
|
-
onClick={() => emit(dualCheckedValue)}>
|
|
84
|
-
{rightLabel}
|
|
85
|
-
</button>
|
|
86
|
-
</div>
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (variant === 'text') {
|
|
91
|
-
const {
|
|
92
|
-
checkedChildren: rcCheckedChildren,
|
|
93
|
-
unCheckedChildren: rcUnCheckedChildren,
|
|
94
|
-
...textRest
|
|
95
|
-
} = rest
|
|
96
|
-
return (
|
|
97
|
-
<Switch
|
|
98
|
-
{...textRest}
|
|
99
|
-
disabled={disabled}
|
|
100
|
-
checked={checked}
|
|
101
|
-
onChange={onChange}
|
|
102
|
-
checkedChildren={checkedText ?? rcCheckedChildren}
|
|
103
|
-
unCheckedChildren={uncheckedText ?? rcUnCheckedChildren}
|
|
104
|
-
className={[baseClass, 'cx-switch--text'].filter(Boolean).join(' ')}
|
|
105
|
-
/>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<Switch
|
|
111
|
-
{...rest}
|
|
112
|
-
disabled={disabled}
|
|
113
|
-
checked={checked}
|
|
114
|
-
onChange={onChange}
|
|
115
|
-
className={baseClass}
|
|
116
|
-
/>
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export default CxSwitch
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
.cx-table {
|
|
2
|
-
height: 100%;
|
|
3
|
-
|
|
4
|
-
// 字体统一(与页面主 UI 字体一致)
|
|
5
|
-
// 字号对齐 LiteTable(table: text-sm)
|
|
6
|
-
font-size: 14px;
|
|
7
|
-
line-height: 20px;
|
|
8
|
-
.ant-table,
|
|
9
|
-
.ant-table * {
|
|
10
|
-
font-family: inherit;
|
|
11
|
-
font-size: inherit;
|
|
12
|
-
line-height: inherit;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// 表头样式对齐 `LiteTable`(原生 table):
|
|
16
|
-
// - bg-gray-50 / dark:bg-gray-700/50
|
|
17
|
-
// - text-gray-500 / dark:text-gray-400
|
|
18
|
-
// - th: px-3 py-4 font-medium
|
|
19
|
-
.ant-table-thead > tr > th {
|
|
20
|
-
background: #f9fafb; // gray-50
|
|
21
|
-
color: #6b7280; // gray-500
|
|
22
|
-
padding: 16px 12px; // py-4 px-3
|
|
23
|
-
border-bottom: none;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// antd 默认表头字重是 600,这里在 cx-table 范围内覆盖为正常字重
|
|
27
|
-
.ant-table-wrapper .ant-table-thead > tr > th,
|
|
28
|
-
.ant-table-wrapper .ant-table-thead > tr > td {
|
|
29
|
-
font-weight: 400 !important;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 内容单元格 padding 对齐 LiteTable(td: px-3 py-4)
|
|
33
|
-
.ant-table-tbody > tr > td {
|
|
34
|
-
padding: 16px 12px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// 选择列(checkbox/radio)对齐:去掉 th/td padding 并居中
|
|
38
|
-
.ant-table-thead > tr > th.cx-table__select-col,
|
|
39
|
-
.ant-table-tbody > tr > td.cx-table__select-col {
|
|
40
|
-
padding: 0 !important;
|
|
41
|
-
text-align: center;
|
|
42
|
-
line-height: 0;
|
|
43
|
-
vertical-align: middle;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&.cx-table--small {
|
|
47
|
-
.ant-table-thead > tr > th {
|
|
48
|
-
padding: 12px 12px;
|
|
49
|
-
}
|
|
50
|
-
.ant-table-tbody > tr > td {
|
|
51
|
-
padding: 12px 12px;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** 预留更紧凑的表格尺寸(用于选择弹框等空间有限场景) */
|
|
56
|
-
&.cx-table--mini {
|
|
57
|
-
font-size: 13px;
|
|
58
|
-
line-height: 18px;
|
|
59
|
-
.ant-table-thead > tr > th {
|
|
60
|
-
padding: 6px 6px;
|
|
61
|
-
}
|
|
62
|
-
.ant-table-tbody > tr > td {
|
|
63
|
-
padding: 6px 6px;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// antd 默认会在 th 之间加分隔线与 hover 背景,这里对齐 LiteTable 的干净表头
|
|
69
|
-
.ant-table-thead > tr > th::before {
|
|
70
|
-
display: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 深色模式:跟随项目的 dark class(Tailwind 方案)
|
|
74
|
-
.dark & {
|
|
75
|
-
.ant-table-thead > tr > th {
|
|
76
|
-
background: rgba(55, 65, 81, 0.5); // gray-700/50
|
|
77
|
-
color: #9ca3af; // gray-400
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.ant-table {
|
|
82
|
-
height: 100%;
|
|
83
|
-
.ant-table-container {
|
|
84
|
-
height: 100%;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
// antd Table 根节点:高度继承自外层容器
|
|
88
|
-
.ant-table-wrapper {
|
|
89
|
-
height: inherit;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Table 在有 loading 时会多一层 Spin 包裹,这些都要继承高度,否则内部撑不起来
|
|
93
|
-
.ant-spin-nested-loading,
|
|
94
|
-
.ant-spin,
|
|
95
|
-
.ant-spin-container {
|
|
96
|
-
height: inherit;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// 只允许 body 容器纵向滚动,避免出现“嵌套滚动/双滚动条”
|
|
100
|
-
.ant-table-container,
|
|
101
|
-
.ant-table-content {
|
|
102
|
-
overflow-y: hidden !important;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// body:数据少不显示滚动条(auto),数据多才滚动;顺便把滚动条调淡一点
|
|
106
|
-
.ant-table-body {
|
|
107
|
-
overflow-y: auto !important;
|
|
108
|
-
scrollbar-width: thin; // Firefox
|
|
109
|
-
scrollbar-color: rgba(0, 0, 0, 0.24) transparent;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// 未启用 scroll.x 时,彻底隐藏横向滚动条(避免 1px 溢出导致出现横条)
|
|
113
|
-
&.cx-table--no-scroll-x {
|
|
114
|
-
.ant-table-body {
|
|
115
|
-
overflow-x: hidden !important;
|
|
116
|
-
}
|
|
117
|
-
.ant-table-content {
|
|
118
|
-
overflow-x: hidden !important;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.ant-table-body::-webkit-scrollbar,
|
|
123
|
-
.ant-table-body *::-webkit-scrollbar {
|
|
124
|
-
width: 8px;
|
|
125
|
-
height: 8px;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.ant-table-body::-webkit-scrollbar-track,
|
|
129
|
-
.ant-table-body *::-webkit-scrollbar-track {
|
|
130
|
-
background: transparent;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.ant-table-body::-webkit-scrollbar-thumb,
|
|
134
|
-
.ant-table-body *::-webkit-scrollbar-thumb {
|
|
135
|
-
background: rgba(0, 0, 0, 0.24);
|
|
136
|
-
border-radius: 999px;
|
|
137
|
-
border: 2px solid transparent;
|
|
138
|
-
background-clip: content-box;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.ant-table-body:hover::-webkit-scrollbar-thumb,
|
|
142
|
-
.ant-table-body:hover *::-webkit-scrollbar-thumb {
|
|
143
|
-
background: rgba(0, 0, 0, 0.38);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.dark & {
|
|
147
|
-
.ant-table-body {
|
|
148
|
-
scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
|
|
149
|
-
}
|
|
150
|
-
.ant-table-body::-webkit-scrollbar-thumb,
|
|
151
|
-
.ant-table-body *::-webkit-scrollbar-thumb {
|
|
152
|
-
background: rgba(255, 255, 255, 0.24);
|
|
153
|
-
}
|
|
154
|
-
.ant-table-body:hover::-webkit-scrollbar-thumb,
|
|
155
|
-
.ant-table-body:hover *::-webkit-scrollbar-thumb {
|
|
156
|
-
background: rgba(255, 255, 255, 0.38);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import type { TableProps } from 'antd'
|
|
2
|
-
import { Table } from 'antd'
|
|
3
|
-
import clsx from 'clsx'
|
|
4
|
-
import { useEffect, useMemo, useRef, useState } from 'react'
|
|
5
|
-
import { useTranslation } from 'react-i18next'
|
|
6
|
-
import { CxEmptyState } from '../empty-state'
|
|
7
|
-
import './index.less'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 基于 antd Table 的封装:
|
|
11
|
-
* - 强制挂载 `cx-table` class,便于在 `.cx-table { ... }` 里做定向样式覆盖
|
|
12
|
-
* - 不修改 antd 全局样式
|
|
13
|
-
*/
|
|
14
|
-
export type CxTableOwnProps<RecordType extends object = any> = Omit<TableProps<RecordType>, 'size'> & {
|
|
15
|
-
/**
|
|
16
|
-
* 表头固定 + 内容区内部滚动:
|
|
17
|
-
* 开启后会自动计算 scroll.y(基于父容器高度),并把结果合并进 `props.scroll`。
|
|
18
|
-
*/
|
|
19
|
-
autoScrollY?: boolean
|
|
20
|
-
/** 自动计算 scroll.y 的最小高度(px),默认 120 */
|
|
21
|
-
minScrollY?: number
|
|
22
|
-
/** 表格尺寸:影响行高/间距(默认 default);须 Omit antd Table `size`,否则与 large|middle|small 求交只剩 small */
|
|
23
|
-
size?: 'default' | 'small' | 'mini'
|
|
24
|
-
/** 自定义空状态文案,不传则使用 `common.no_data` */
|
|
25
|
-
emptyText?: string
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default function CxTable<RecordType extends object = any>(props: CxTableOwnProps<RecordType>) {
|
|
29
|
-
const { t } = useTranslation()
|
|
30
|
-
const {
|
|
31
|
-
className,
|
|
32
|
-
autoScrollY,
|
|
33
|
-
minScrollY = 120,
|
|
34
|
-
size = 'default',
|
|
35
|
-
scroll,
|
|
36
|
-
pagination,
|
|
37
|
-
tableLayout,
|
|
38
|
-
columns,
|
|
39
|
-
emptyText,
|
|
40
|
-
...rest
|
|
41
|
-
} = props
|
|
42
|
-
const wrapRef = useRef<HTMLDivElement | null>(null)
|
|
43
|
-
const [autoY, setAutoY] = useState<number | undefined>(undefined)
|
|
44
|
-
const [wrapW, setWrapW] = useState<number | undefined>(undefined)
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!autoScrollY) {
|
|
48
|
-
setAutoY(undefined)
|
|
49
|
-
return
|
|
50
|
-
}
|
|
51
|
-
const wrap = wrapRef.current
|
|
52
|
-
if (!wrap) return
|
|
53
|
-
|
|
54
|
-
const calc = () => {
|
|
55
|
-
const h = wrap.getBoundingClientRect().height
|
|
56
|
-
if (!Number.isFinite(h) || h <= 0) return
|
|
57
|
-
const headerEl = wrap.querySelector(
|
|
58
|
-
'.ant-table-header',
|
|
59
|
-
) as HTMLElement | null
|
|
60
|
-
const headerH = headerEl ? headerEl.getBoundingClientRect().height : 0
|
|
61
|
-
setAutoY(Math.max(minScrollY, Math.floor(h - headerH)))
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
calc()
|
|
65
|
-
const ro = new ResizeObserver(() => calc())
|
|
66
|
-
ro.observe(wrap)
|
|
67
|
-
return () => ro.disconnect()
|
|
68
|
-
}, [autoScrollY, minScrollY])
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
const wrap = wrapRef.current
|
|
72
|
-
if (!wrap) return
|
|
73
|
-
const calc = () => {
|
|
74
|
-
const w = wrap.getBoundingClientRect().width
|
|
75
|
-
if (!Number.isFinite(w) || w <= 0) return
|
|
76
|
-
setWrapW(Math.floor(w))
|
|
77
|
-
}
|
|
78
|
-
calc()
|
|
79
|
-
const ro = new ResizeObserver(() => calc())
|
|
80
|
-
ro.observe(wrap)
|
|
81
|
-
return () => ro.disconnect()
|
|
82
|
-
}, [])
|
|
83
|
-
|
|
84
|
-
const mergedScroll = useMemo(() => {
|
|
85
|
-
if (!autoScrollY || autoY == null) return scroll
|
|
86
|
-
return { ...(scroll as any), y: autoY } as any
|
|
87
|
-
}, [autoScrollY, autoY, scroll])
|
|
88
|
-
|
|
89
|
-
const mergedColumns = useMemo(() => {
|
|
90
|
-
if (!Array.isArray(columns)) return columns
|
|
91
|
-
const base = columns.map((c: any) => ({
|
|
92
|
-
...c,
|
|
93
|
-
dataIndex: c?.dataIndex ?? c?.key,
|
|
94
|
-
}))
|
|
95
|
-
|
|
96
|
-
// 关闭横向滚动时(scroll.x 未设置)在 fixed 布局下把“未设置 width 的列”平分剩余宽度
|
|
97
|
-
const noScrollX = scroll == null || (scroll as any).x == null
|
|
98
|
-
const isFixed = tableLayout === 'fixed'
|
|
99
|
-
if (!noScrollX || !isFixed || wrapW == null) return base
|
|
100
|
-
|
|
101
|
-
let fixedW = 0
|
|
102
|
-
const flexCols: any[] = []
|
|
103
|
-
for (const c of base as any[]) {
|
|
104
|
-
const w = c?.width
|
|
105
|
-
if (typeof w === 'number' && Number.isFinite(w)) {
|
|
106
|
-
fixedW += w
|
|
107
|
-
} else if (w == null) {
|
|
108
|
-
flexCols.push(c)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (flexCols.length === 0) return base
|
|
112
|
-
|
|
113
|
-
const remain = wrapW - fixedW
|
|
114
|
-
const each = Math.floor(remain / flexCols.length)
|
|
115
|
-
return (base as any[]).map((c) => {
|
|
116
|
-
if (c?.width != null) return c
|
|
117
|
-
const mw = typeof c?.minWidth === 'number' ? c.minWidth : undefined
|
|
118
|
-
const nextW = mw != null ? Math.max(mw, each) : each
|
|
119
|
-
return { ...c, width: nextW }
|
|
120
|
-
})
|
|
121
|
-
}, [columns, scroll, tableLayout, wrapW])
|
|
122
|
-
|
|
123
|
-
const mergedPagination = pagination === undefined ? false : pagination
|
|
124
|
-
const mergedTableLayout = tableLayout ?? 'fixed'
|
|
125
|
-
const noScrollX = scroll == null || (scroll as any).x == null
|
|
126
|
-
|
|
127
|
-
const emptyTextValue = emptyText ?? t('common.no_data')
|
|
128
|
-
|
|
129
|
-
return (
|
|
130
|
-
<div
|
|
131
|
-
ref={wrapRef}
|
|
132
|
-
className={clsx(
|
|
133
|
-
'cx-table',
|
|
134
|
-
`cx-table--${size}`,
|
|
135
|
-
noScrollX && 'cx-table--no-scroll-x',
|
|
136
|
-
className,
|
|
137
|
-
)}
|
|
138
|
-
>
|
|
139
|
-
<Table<RecordType>
|
|
140
|
-
{...rest}
|
|
141
|
-
columns={mergedColumns as any}
|
|
142
|
-
pagination={mergedPagination}
|
|
143
|
-
tableLayout={mergedTableLayout}
|
|
144
|
-
scroll={mergedScroll}
|
|
145
|
-
locale={{ emptyText: <CxEmptyState message={emptyTextValue} /> }}
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export type { CxTableOwnProps as CxTableProps }
|
|
152
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
.cx-tabs {
|
|
2
|
-
& > .ant-tabs-content-holder {
|
|
3
|
-
flex: 1;
|
|
4
|
-
min-height: 0;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
& > .ant-tabs-content-holder > .ant-tabs-content {
|
|
9
|
-
height: 100%;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
& > .ant-tabs-content-holder > .ant-tabs-content > .ant-tabs-tabpane {
|
|
13
|
-
height: 100%;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { TabsProps } from 'antd'
|
|
2
|
-
import { Tabs } from 'antd'
|
|
3
|
-
import clsx from 'clsx'
|
|
4
|
-
import type { Ref } from 'react'
|
|
5
|
-
import { forwardRef } from 'react'
|
|
6
|
-
import './index.less'
|
|
7
|
-
|
|
8
|
-
export type CxTabsProps = TabsProps & {
|
|
9
|
-
/** 自定义类名 */
|
|
10
|
-
className?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const CxTabsInner = forwardRef<any, CxTabsProps>(
|
|
14
|
-
({ className, ...rest }, ref) => {
|
|
15
|
-
return (
|
|
16
|
-
<Tabs
|
|
17
|
-
ref={ref as Ref<any>}
|
|
18
|
-
{...rest}
|
|
19
|
-
className={clsx('cx-tabs', className)}
|
|
20
|
-
style={{
|
|
21
|
-
display: 'flex',
|
|
22
|
-
flexDirection: 'column',
|
|
23
|
-
flex: 1,
|
|
24
|
-
minHeight: 0,
|
|
25
|
-
...rest.style,
|
|
26
|
-
}}
|
|
27
|
-
/>
|
|
28
|
-
)
|
|
29
|
-
},
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
CxTabsInner.displayName = 'CxTabs'
|
|
33
|
-
|
|
34
|
-
export const CxTabs = CxTabsInner
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/* CxTag:仅作用于同时带 .cx-tag 的 antd Tag */
|
|
2
|
-
|
|
3
|
-
span.cx-tag.ant-tag {
|
|
4
|
-
margin-inline-end: 0;
|
|
5
|
-
/* 与 antd 主题圆角对齐(无 CSS 变量时退回 6px) */
|
|
6
|
-
border-radius: var(--ant-border-radius-sm, 6px);
|
|
7
|
-
font-size: 12px;
|
|
8
|
-
line-height: 1.25;
|
|
9
|
-
font-weight: 500;
|
|
10
|
-
|
|
11
|
-
/* CxTag 内部所有内容字号统一 12px */
|
|
12
|
-
* {
|
|
13
|
-
font-size: 12px;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* 胶囊:与用户管理状态列(rounded-full + text-xs + px-2.5 py-1)一致 */
|
|
18
|
-
span.cx-tag.ant-tag.cx-tag--pill {
|
|
19
|
-
border-radius: 9999px;
|
|
20
|
-
padding-block: 4px;
|
|
21
|
-
padding-inline: 10px;
|
|
22
|
-
font-size: 12px;
|
|
23
|
-
font-weight: 500;
|
|
24
|
-
line-height: 1.25;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* filled + 状态色:覆盖 antd 默认 success/error,与用户管理启用/禁用对齐 */
|
|
28
|
-
span.cx-tag.ant-tag.ant-tag-filled.ant-tag-success {
|
|
29
|
-
background: #dcfce7;
|
|
30
|
-
color: #166534;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
span.cx-tag.ant-tag.ant-tag-filled.ant-tag-error {
|
|
34
|
-
background: #fee2e2;
|
|
35
|
-
color: #991b1b;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.dark span.cx-tag.ant-tag.ant-tag-filled.ant-tag-success {
|
|
39
|
-
background: rgba(22, 101, 52, 0.35);
|
|
40
|
-
color: #bbf7d0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.dark span.cx-tag.ant-tag.ant-tag-filled.ant-tag-error {
|
|
44
|
-
background: rgba(153, 27, 27, 0.35);
|
|
45
|
-
color: #fecaca;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
span.cx-tag.ant-tag .ant-tag-close-icon {
|
|
49
|
-
margin-inline-start: 4px;
|
|
50
|
-
font-size: 12px;
|
|
51
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { ENUM_DATA, getEnumLabelKey } from '@/meta'
|
|
2
|
-
import { getIconComponent } from '@/utils/routeConfig'
|
|
3
|
-
import type { TagProps } from 'antd'
|
|
4
|
-
import { Tag } from 'antd'
|
|
5
|
-
import clsx from 'clsx'
|
|
6
|
-
import { forwardRef, memo } from 'react'
|
|
7
|
-
import { useTranslation } from 'react-i18next'
|
|
8
|
-
|
|
9
|
-
export type CxTagProps = TagProps & {
|
|
10
|
-
/**
|
|
11
|
-
* 胶囊全圆角 + 与用户管理状态列一致的字号/字重/内边距。
|
|
12
|
-
* 不设时圆角跟随 antd 主题(`--ant-border-radius-sm` 等)。
|
|
13
|
-
*/
|
|
14
|
-
pill?: boolean
|
|
15
|
-
/** 固定宽度(不传则按内容自适应) */
|
|
16
|
-
width?: number | string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** YesNo Tag:显示「是/否」,基于 commonYesNo 枚举 */
|
|
20
|
-
export type CxTagYesNoProps = Omit<CxTagProps, 'children'> & {
|
|
21
|
-
value: unknown
|
|
22
|
-
/** 枚举 key,预留扩展,默认 'commonYesNo' */
|
|
23
|
-
enumKey?: string
|
|
24
|
-
/** 是否反转:true 时 0=是,1=否;适用于「需要认证」等反向语义 */
|
|
25
|
-
reverse?: boolean
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Enabled Tag:显示「启用/禁用」,基于 commonStatus 枚举 */
|
|
29
|
-
export type CxTagEnabledProps = Omit<CxTagProps, 'children'> & {
|
|
30
|
-
value: unknown
|
|
31
|
-
/** 枚举 key,预留扩展,默认 'commonStatus' */
|
|
32
|
-
enumKey?: string
|
|
33
|
-
/** 是否反转:true 时 0/1 与文案、颜色对调(与 YesNo 一致) */
|
|
34
|
-
reverse?: boolean
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Enum Tag:通用枚举 Tag,根据 enumKey 和 value 自动获取 label */
|
|
38
|
-
export type CxTagEnumProps = Omit<CxTagProps, 'children'> & {
|
|
39
|
-
value: unknown
|
|
40
|
-
/** 枚举 key,如 'commonStatus'、'commonYesNo'、'permissionApiType' 等 */
|
|
41
|
-
enumKey: string
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const CxTagInner = forwardRef<HTMLSpanElement, CxTagProps>(
|
|
45
|
-
(
|
|
46
|
-
{ className, pill = true, width, style, variant = 'filled', children, ...rest },
|
|
47
|
-
ref,
|
|
48
|
-
) => {
|
|
49
|
-
return (
|
|
50
|
-
<Tag
|
|
51
|
-
ref={ref}
|
|
52
|
-
{...rest}
|
|
53
|
-
variant={variant}
|
|
54
|
-
style={width == null ? style : { ...style, width }}
|
|
55
|
-
className={clsx('cx-tag', pill && 'cx-tag--pill', className)}
|
|
56
|
-
>
|
|
57
|
-
{children}
|
|
58
|
-
</Tag>
|
|
59
|
-
)
|
|
60
|
-
},
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
CxTagInner.displayName = 'CxTag'
|
|
64
|
-
|
|
65
|
-
/** YesNo Tag 组件 */
|
|
66
|
-
function CxTagYesNoInner({ value, enumKey = 'commonYesNo', reverse = false, ...rest }: CxTagYesNoProps) {
|
|
67
|
-
const { t } = useTranslation()
|
|
68
|
-
// 如果反转,则交换 0 和 1 的映射
|
|
69
|
-
const normalizedValue = reverse ? (Number(value) === 0 ? 1 : Number(value) === 1 ? 0 : value) : value
|
|
70
|
-
const labelKey = getEnumLabelKey(enumKey, normalizedValue)
|
|
71
|
-
|
|
72
|
-
// 如果没有自定义 color,根据标准化后的值自动设置颜色
|
|
73
|
-
if (!rest.color) {
|
|
74
|
-
rest.color = Number(normalizedValue) === 1 ? 'success' : 'default'
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return <CxTagInner {...rest}>{labelKey ? t(labelKey) : undefined}</CxTagInner>
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** Enabled Tag 组件 */
|
|
81
|
-
function CxTagEnabledInner({
|
|
82
|
-
value,
|
|
83
|
-
enumKey = 'commonStatus',
|
|
84
|
-
reverse = false,
|
|
85
|
-
...rest
|
|
86
|
-
}: CxTagEnabledProps) {
|
|
87
|
-
const { t } = useTranslation()
|
|
88
|
-
const normalizedValue = reverse
|
|
89
|
-
? Number(value) === 0
|
|
90
|
-
? 1
|
|
91
|
-
: Number(value) === 1
|
|
92
|
-
? 0
|
|
93
|
-
: value
|
|
94
|
-
: value
|
|
95
|
-
const labelKey = getEnumLabelKey(enumKey, normalizedValue)
|
|
96
|
-
const n = Number(normalizedValue)
|
|
97
|
-
// 如果没有自定义 color,则根据状态自动设置颜色
|
|
98
|
-
if (!rest.color) {
|
|
99
|
-
rest.color = n === 1 ? 'success' : 'error'
|
|
100
|
-
}
|
|
101
|
-
return <CxTagInner {...rest}>{labelKey ? t(labelKey) : undefined}</CxTagInner>
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** Enum Tag 组件 */
|
|
105
|
-
function CxTagEnumInner({ value, enumKey, ...rest }: CxTagEnumProps) {
|
|
106
|
-
const { t } = useTranslation()
|
|
107
|
-
const labelKey = getEnumLabelKey(enumKey, value)
|
|
108
|
-
const item = ENUM_DATA[enumKey]?.dataMap?.[`${value}`]
|
|
109
|
-
const iconName = typeof item?.icon === 'string' ? item.icon : undefined
|
|
110
|
-
const Icon = getIconComponent(iconName)
|
|
111
|
-
// 如果没有自定义 color,则从枚举配置中读取颜色
|
|
112
|
-
if (!rest.color) {
|
|
113
|
-
const colorMap = ENUM_DATA[enumKey]?.tagColorMap
|
|
114
|
-
if (colorMap) {
|
|
115
|
-
const colorValue = colorMap[`${value}`]
|
|
116
|
-
if (colorValue) {
|
|
117
|
-
rest.color = colorValue
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return (
|
|
122
|
-
<CxTagInner {...rest}>
|
|
123
|
-
<span className="inline-flex items-center gap-1">
|
|
124
|
-
{Icon ? <Icon size={14} /> : null}
|
|
125
|
-
{labelKey ? t(labelKey) : undefined}
|
|
126
|
-
</span>
|
|
127
|
-
</CxTagInner>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
CxTagYesNoInner.displayName = 'CxTag.YesNo'
|
|
132
|
-
CxTagEnabledInner.displayName = 'CxTag.Enabled'
|
|
133
|
-
CxTagEnumInner.displayName = 'CxTag.Enum'
|
|
134
|
-
|
|
135
|
-
/** 基于 antd Tag;`color` 与官方一致(如 success / error 或 `#xxx`);列表纯展示可受益于 `memo`。 */
|
|
136
|
-
export const CxTag = Object.assign(memo(CxTagInner), {
|
|
137
|
-
YesNo: memo(CxTagYesNoInner),
|
|
138
|
-
Enabled: memo(CxTagEnabledInner),
|
|
139
|
-
Enum: memo(CxTagEnumInner),
|
|
140
|
-
})
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { TimelineProps } from 'antd'
|
|
2
|
-
import { Timeline } from 'antd'
|
|
3
|
-
import type { CSSProperties } from 'react'
|
|
4
|
-
|
|
5
|
-
export type CxTimelineProps = Omit<TimelineProps, 'className' | 'style'> & {
|
|
6
|
-
className?: string
|
|
7
|
-
style?: CSSProperties
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function CxTimeline(props: CxTimelineProps) {
|
|
11
|
-
const { className, style, ...restProps } = props
|
|
12
|
-
|
|
13
|
-
return <Timeline className={className} style={style} {...restProps} />
|
|
14
|
-
}
|