cx-chat 0.0.1
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/.cursor/rules/i18n-cn-gloss-comments.mdc +31 -0
- package/.cursor/rules/list-page-view-pageconfig.mdc +32 -0
- package/.cursor/rules/no-over-defensive-programming.mdc +90 -0
- package/.cursor/rules/requirement-description-for-agent.mdc +33 -0
- package/.cursor/rules/use-showToast-not-antd-message.mdc +28 -0
- package/.docker/Dockerfile +7 -0
- package/.env +9 -0
- package/.env.development +7 -0
- package/.env.production +7 -0
- package/.gitlab-ci/docker-build.yaml +28 -0
- package/.gitlab-ci/k8s-deploy-dev-master.yaml +42 -0
- package/.gitlab-ci/npm-build.yaml +17 -0
- package/.gitlab-ci.yml +8 -0
- package/.k8s/0-namespace.yaml +6 -0
- package/.k8s/1-configmap-web.yaml +7 -0
- package/.k8s/1-nginx-conf-dev.yaml +110 -0
- package/.k8s/2-deployment.yaml +27 -0
- package/.k8s/3-service.yaml +16 -0
- package/.k8s/4-ingress-dev.yaml +30 -0
- package/.lingma/rules/use-showToast-not-antd-message.md +34 -0
- package/.nginx/nginx.conf +52 -0
- package/.prettierrc +9 -0
- package/README.md +1 -0
- package/eslint.config.js +32 -0
- package/index.html +13 -0
- package/package.json +67 -0
- package/postcss.config.js +6 -0
- package/public/favicon.ico +0 -0
- package/public/vite.svg +1 -0
- package/src/App.tsx +96 -0
- package/src/_doc/0.docs-overview.md +28 -0
- package/src/_doc/cx-ui/0.docs-overview.md +30 -0
- package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +82 -0
- package/src/_doc/cx-ui/comp.2.cx-modal.md +82 -0
- package/src/_doc/cx-ui/comp.3.cx-button.md +89 -0
- package/src/_doc/cx-ui/comp.4.cx-form.md +72 -0
- package/src/_doc/cx-ui/comp.5.cx-fields.md +76 -0
- package/src/_doc/cx-ui/comp.6.cx-tag.md +57 -0
- package/src/_doc/cx-ui/comp.7.cx-empty-state.md +29 -0
- package/src/_doc/meta/0.docs-overview.md +24 -0
- package/src/_doc/meta/comp.1.enum-runtime.md +33 -0
- package/src/_doc/meta/comp.2.dict-runtime.md +39 -0
- package/src/_doc/router/0.docs-overview.md +14 -0
- package/src/_doc/router/guide.1.menu-component-config.md +181 -0
- package/src/_doc/router/guide.2.router-auto-registration.md +114 -0
- package/src/_doc/table-view/0.docs-overview.md +30 -0
- package/src/_doc/table-view/comp.1.table-view.md +542 -0
- package/src/_doc/table-view/props.1.create-table-view-config.md +193 -0
- package/src/_doc/table-view/props.2.table-view-search-fields.md +106 -0
- package/src/api/_mock/README.md +340 -0
- package/src/api/_mock/api.ts +1642 -0
- package/src/api/_mock/bundle-shim.ts +16 -0
- package/src/api/_mock/handler-shim.ts +6 -0
- package/src/api/_mock/handler.ts +458 -0
- package/src/api/_mock/index.ts +711 -0
- package/src/api/_mock/interceptor.ts +15 -0
- package/src/api/_mock/mod.ts +12 -0
- package/src/api/_mock/utils.ts +65 -0
- package/src/api/base/memory.js +24 -0
- package/src/api/chat.js +210 -0
- package/src/api/common/auth.js +70 -0
- package/src/api/menus/business-rules.js +76 -0
- package/src/api/menus/feedback.js +102 -0
- package/src/api/menus/knowledge.js +159 -0
- package/src/api/menus/model-metadata/manage.js +70 -0
- package/src/api/menus/model-metadata/role.js +50 -0
- package/src/api/menus/model-metadata/training-detail-mock-data.js +569 -0
- package/src/api/menus/model-metadata/training.js +28 -0
- package/src/api/menus/skill.js +40 -0
- package/src/api/system/agent-config.js +16 -0
- package/src/api/system/department.js +94 -0
- package/src/api/system/dict.js +86 -0
- package/src/api/system/menu.js +37 -0
- package/src/api/system/permission.js +26 -0
- package/src/api/system/role.js +34 -0
- package/src/api/system/sys-config.js +16 -0
- package/src/api/system/sys-log.js +17 -0
- package/src/api/system/user.js +75 -0
- package/src/api/upload.js +39 -0
- package/src/assets/react.svg +1 -0
- package/src/components/auth/current-user-avatar.tsx +77 -0
- package/src/components/common/code-view.tsx +149 -0
- package/src/components/common/detail-link.tsx +67 -0
- package/src/components/common/error-boundary.tsx +98 -0
- package/src/components/common/language-switcher.tsx +91 -0
- package/src/components/common/lite-table/index.tsx +135 -0
- package/src/components/common/md-editor.tsx +126 -0
- package/src/components/common/modal/confirm-dialog.tsx +113 -0
- package/src/components/common/modal/dep-user-select-multi.tsx +324 -0
- package/src/components/common/modal/dep-user-select.tsx +249 -0
- package/src/components/common/modal/user-select-multi.tsx +266 -0
- package/src/components/common/pagination.tsx +472 -0
- package/src/components/common/path.tsx +175 -0
- package/src/components/common/system-logo-mark.tsx +48 -0
- package/src/components/cx-ui/button/index.less +208 -0
- package/src/components/cx-ui/button/index.tsx +611 -0
- package/src/components/cx-ui/checkbox/index.tsx +78 -0
- package/src/components/cx-ui/date-picker/index.less +17 -0
- package/src/components/cx-ui/date-picker/index.tsx +193 -0
- package/src/components/cx-ui/drawer/index.tsx +47 -0
- package/src/components/cx-ui/empty-state/index.tsx +20 -0
- package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +89 -0
- package/src/components/cx-ui/floating-shell/cx-floating-shell.less +283 -0
- package/src/components/cx-ui/floating-shell/has-floating-value.ts +41 -0
- package/src/components/cx-ui/form/CxForm.tsx +15 -0
- package/src/components/cx-ui/form/index.tsx +20 -0
- package/src/components/cx-ui/form-item/index.less +26 -0
- package/src/components/cx-ui/form-item/index.tsx +36 -0
- package/src/components/cx-ui/index.ts +70 -0
- package/src/components/cx-ui/input/auto-complete.tsx +134 -0
- package/src/components/cx-ui/input/index.tsx +259 -0
- package/src/components/cx-ui/input-number/index.jsx +66 -0
- package/src/components/cx-ui/modal/index.jsx +212 -0
- package/src/components/cx-ui/modal/index.less +144 -0
- package/src/components/cx-ui/modal/useCxModal.ts +125 -0
- package/src/components/cx-ui/multi-select/index.jsx +74 -0
- package/src/components/cx-ui/multi-select/index.less +40 -0
- package/src/components/cx-ui/multi-select/index2.tsx +361 -0
- package/src/components/cx-ui/radio/index.tsx +33 -0
- package/src/components/cx-ui/range-picker/index.less +65 -0
- package/src/components/cx-ui/range-picker/index.tsx +219 -0
- package/src/components/cx-ui/select/index.less +34 -0
- package/src/components/cx-ui/select/index.tsx +196 -0
- package/src/components/cx-ui/skeleton/index.tsx +12 -0
- package/src/components/cx-ui/steps/index.tsx +14 -0
- package/src/components/cx-ui/styles/_tokens.less +79 -0
- package/src/components/cx-ui/styles/index.less +246 -0
- package/src/components/cx-ui/switch/index.less +106 -0
- package/src/components/cx-ui/switch/index.tsx +120 -0
- package/src/components/cx-ui/table/index.less +160 -0
- package/src/components/cx-ui/table/index.tsx +152 -0
- package/src/components/cx-ui/tabs/index.less +15 -0
- package/src/components/cx-ui/tabs/index.tsx +34 -0
- package/src/components/cx-ui/tag/index.less +51 -0
- package/src/components/cx-ui/tag/index.tsx +140 -0
- package/src/components/cx-ui/timeline/index.tsx +14 -0
- package/src/components/cx-ui/tooltip/index.tsx +67 -0
- package/src/components/cx-ui/tree/index.tsx +193 -0
- package/src/components/cx-ui/tree-select/index.jsx +91 -0
- package/src/components/cx-ui/tree-select/index.less +27 -0
- package/src/components/cx-ui/upload-file/index.less +223 -0
- package/src/components/cx-ui/upload-file/index.tsx +640 -0
- package/src/components/cx-ui/upload-img/index.tsx +291 -0
- package/src/components/layout/components/Header.tsx +216 -0
- package/src/components/layout/components/Sidebar.tsx +717 -0
- package/src/components/layout/index.tsx +95 -0
- package/src/components/table-view/components/search-area.tsx +411 -0
- package/src/components/table-view/components/table-view-config.tsx +528 -0
- package/src/components/table-view/components/table-view.types.ts +478 -0
- package/src/components/table-view/components/tree-api-normalize.ts +38 -0
- package/src/components/table-view/components/tree-data-annotate.ts +31 -0
- package/src/components/table-view/components/tree-sidebar.tsx +74 -0
- package/src/components/table-view/index.tsx +61 -0
- package/src/components/table-view/list-page-view.tsx +1049 -0
- package/src/components/table-view/select-table-view.tsx +1094 -0
- package/src/components/table-view/styles/select-table-view.less +51 -0
- package/src/config/default-system-name.ts +9 -0
- package/src/config/system.ts +165 -0
- package/src/constants/countryCodes.ts +3 -0
- package/src/contexts/AuthContext.tsx +256 -0
- package/src/contexts/ChatContext.tsx +839 -0
- package/src/contexts/MenuContext.tsx +62 -0
- package/src/contexts/ToastContext.tsx +181 -0
- package/src/hooks/useCopyToClipboard.ts +47 -0
- package/src/hooks/useModalSubmit.ts +104 -0
- package/src/hooks/useRouter.ts +240 -0
- package/src/hooks/useStepForm.ts +46 -0
- package/src/hooks/useStickyHeader.ts +42 -0
- package/src/hooks/useThreadActions.ts +105 -0
- package/src/hooks/useUserPreferences.ts +101 -0
- package/src/http/axios.js +372 -0
- package/src/http/mock.interceptor.ts +9 -0
- package/src/http/obfuscationKey.ts +41 -0
- package/src/i18n.ts +60 -0
- package/src/index.js +1 -0
- package/src/index.less +169 -0
- package/src/locales/en/auth.ts +70 -0
- package/src/locales/en/base/memory.ts +28 -0
- package/src/locales/en/base/settings.ts +41 -0
- package/src/locales/en/chat.ts +40 -0
- package/src/locales/en/common.ts +173 -0
- package/src/locales/en/enum.ts +27 -0
- package/src/locales/en/menus/business-rules.ts +48 -0
- package/src/locales/en/menus/feedback.ts +62 -0
- package/src/locales/en/menus/knowledge.ts +120 -0
- package/src/locales/en/menus/model-metadata/index.ts +10 -0
- package/src/locales/en/menus/model-metadata/manage.ts +151 -0
- package/src/locales/en/menus/model-metadata/role.ts +48 -0
- package/src/locales/en/menus/model-metadata/training.ts +65 -0
- package/src/locales/en/menus/skill.ts +34 -0
- package/src/locales/en/system/agent-config.ts +34 -0
- package/src/locales/en/system/department.ts +68 -0
- package/src/locales/en/system/dict.ts +44 -0
- package/src/locales/en/system/menu.ts +45 -0
- package/src/locales/en/system/permission.ts +89 -0
- package/src/locales/en/system/role.ts +25 -0
- package/src/locales/en/system/sys-config.ts +33 -0
- package/src/locales/en/system/sys-log.ts +38 -0
- package/src/locales/en/system/user.ts +113 -0
- package/src/locales/en.ts +68 -0
- package/src/locales/zh/auth.ts +70 -0
- package/src/locales/zh/base/memory.ts +29 -0
- package/src/locales/zh/base/settings.ts +41 -0
- package/src/locales/zh/chat.ts +47 -0
- package/src/locales/zh/common.ts +178 -0
- package/src/locales/zh/enum.ts +28 -0
- package/src/locales/zh/menus/business-rules.ts +47 -0
- package/src/locales/zh/menus/feedback.ts +62 -0
- package/src/locales/zh/menus/knowledge.ts +117 -0
- package/src/locales/zh/menus/model-metadata/index.ts +10 -0
- package/src/locales/zh/menus/model-metadata/manage.ts +151 -0
- package/src/locales/zh/menus/model-metadata/role.ts +47 -0
- package/src/locales/zh/menus/model-metadata/training.ts +64 -0
- package/src/locales/zh/menus/skill.ts +34 -0
- package/src/locales/zh/system/agent-config.ts +33 -0
- package/src/locales/zh/system/department.ts +69 -0
- package/src/locales/zh/system/dict.ts +44 -0
- package/src/locales/zh/system/menu.ts +47 -0
- package/src/locales/zh/system/permission.ts +94 -0
- package/src/locales/zh/system/role.ts +25 -0
- package/src/locales/zh/system/sys-config.ts +32 -0
- package/src/locales/zh/system/sys-log.ts +38 -0
- package/src/locales/zh/system/user.ts +114 -0
- package/src/locales/zh.ts +67 -0
- package/src/main.tsx +50 -0
- package/src/meta/const/index.ts +40 -0
- package/src/meta/index-dict.ts +56 -0
- package/src/meta/index-enum.ts +95 -0
- package/src/meta/index.ts +14 -0
- package/src/meta/module/dict-data/runtime.ts +199 -0
- package/src/meta/module/dict-data/types.ts +17 -0
- package/src/meta/module/enum-data/runtime.ts +75 -0
- package/src/meta/module/enum-data/types.ts +18 -0
- package/src/router/index.tsx +312 -0
- package/src/styles/AntdThemeProvider.tsx +40 -0
- package/src/styles/antd-theme.ts +20 -0
- package/src/styles/global.less +107 -0
- package/src/styles/variable.less +103 -0
- package/src/types/feedback.ts +43 -0
- package/src/types/index.ts +85 -0
- package/src/types/menu.ts +43 -0
- package/src/utils/aesUtil.ts +123 -0
- package/src/utils/chatUtils.ts +524 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/crypto.ts +164 -0
- package/src/utils/date.ts +72 -0
- package/src/utils/file-icons.tsx +79 -0
- package/src/utils/index.ts +168 -0
- package/src/utils/markdown-math-plugins.ts +21 -0
- package/src/utils/menuI18n.ts +305 -0
- package/src/utils/menuRouteRegistry.ts +78 -0
- package/src/utils/permission-crud.ts +147 -0
- package/src/utils/routeConfig.ts +350 -0
- package/src/utils/storage.ts +135 -0
- package/src/utils/toastBridge.ts +26 -0
- package/src/utils/url.ts +38 -0
- package/src/utils/validation.ts +16 -0
- package/src/views/auth/auth-code/index.less +169 -0
- package/src/views/auth/auth-code/index.module.less +174 -0
- package/src/views/auth/auth-code/index.tsx +233 -0
- package/src/views/auth/login.tsx +498 -0
- package/src/views/auth/register.tsx +388 -0
- package/src/views/base/memory/index.tsx +136 -0
- package/src/views/base/memory/modal/detail-modal.tsx +89 -0
- package/src/views/base/memory/modal/submit-modal.tsx +134 -0
- package/src/views/base/settings/index.tsx +657 -0
- package/src/views/chat/chat.less +323 -0
- package/src/views/chat/components/chat-input.tsx +298 -0
- package/src/views/chat/components/header-thread-title.tsx +210 -0
- package/src/views/chat/components/message-list/content-answer.tsx +100 -0
- package/src/views/chat/components/message-list/content-question.tsx +18 -0
- package/src/views/chat/components/message-list/index.tsx +520 -0
- package/src/views/chat/components/message-list/message-item.tsx +199 -0
- package/src/views/chat/components/message-list/preparation-demo-items.ts +147 -0
- package/src/views/chat/components/message-list/preparation-steps.tsx +506 -0
- package/src/views/chat/components/message-list/suggestion-list.tsx +36 -0
- package/src/views/chat/components/message-list/thinking-process.tsx +49 -0
- package/src/views/chat/components/message-list/toolbar.tsx +224 -0
- package/src/views/chat/components/message-list/use-message-list-scroll.ts +214 -0
- package/src/views/chat/components/references-knowledge/context.tsx +57 -0
- package/src/views/chat/components/references-knowledge/index.ts +9 -0
- package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +556 -0
- package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +529 -0
- package/src/views/chat/components/references-knowledge/panel.tsx +115 -0
- package/src/views/chat/hooks/use-chat-common.ts +19 -0
- package/src/views/chat/index-session.tsx +647 -0
- package/src/views/chat/index.tsx +127 -0
- package/src/views/page-error/401.tsx +56 -0
- package/src/views/page-error/404.tsx +56 -0
- package/src/views/page-menus/business-rules/index.tsx +376 -0
- package/src/views/page-menus/business-rules/modal/detail-modal.tsx +186 -0
- package/src/views/page-menus/business-rules/modal/scope-modal.tsx +272 -0
- package/src/views/page-menus/business-rules/modal/submit-modal.tsx +142 -0
- package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +471 -0
- package/src/views/page-menus/feedback/index.tsx +166 -0
- package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +367 -0
- package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +32 -0
- package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +330 -0
- package/src/views/page-menus/knowledge/detail.tsx +600 -0
- package/src/views/page-menus/knowledge/index.tsx +337 -0
- package/src/views/page-menus/knowledge/modal/detail-modal.tsx +618 -0
- package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +550 -0
- package/src/views/page-menus/knowledge/modal/doc-parse.ts +99 -0
- package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +349 -0
- package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +88 -0
- package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +283 -0
- package/src/views/page-menus/knowledge/modal/submit-modal.tsx +179 -0
- package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +114 -0
- package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +232 -0
- package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +316 -0
- package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +134 -0
- package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +134 -0
- package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +101 -0
- package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +338 -0
- package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +276 -0
- package/src/views/page-menus/model-metadata/manage/detail.tsx +298 -0
- package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +113 -0
- package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +20 -0
- package/src/views/page-menus/model-metadata/manage/index.tsx +304 -0
- package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +374 -0
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +151 -0
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +423 -0
- package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +218 -0
- package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +261 -0
- package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +196 -0
- package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +229 -0
- package/src/views/page-menus/model-metadata/manage/submit.tsx +31 -0
- package/src/views/page-menus/model-metadata/role/index.tsx +207 -0
- package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +97 -0
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +254 -0
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +393 -0
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +120 -0
- package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +698 -0
- package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +237 -0
- package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +135 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +4 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +72 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +196 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +153 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +103 -0
- package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +82 -0
- package/src/views/page-menus/model-metadata/training/detail.tsx +159 -0
- package/src/views/page-menus/model-metadata/training/index.tsx +236 -0
- package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +154 -0
- package/src/views/page-menus/skill/index.tsx +201 -0
- package/src/views/page-menus/skill/modal/detail-modal.tsx +156 -0
- package/src/views/page-menus/skill/modal/submit-modal.tsx +214 -0
- package/src/views/page-system/agent-config/index.tsx +370 -0
- package/src/views/page-system/department/departmentFormShared.ts +36 -0
- package/src/views/page-system/department/index.tsx +541 -0
- package/src/views/page-system/department/modal/detail-modal.tsx +94 -0
- package/src/views/page-system/department/modal/member-role-modal.tsx +128 -0
- package/src/views/page-system/department/modal/submit-modal.tsx +265 -0
- package/src/views/page-system/dict/index.tsx +440 -0
- package/src/views/page-system/dict/modal/cate-submit-modal.tsx +315 -0
- package/src/views/page-system/dict/modal/submit-modal.tsx +184 -0
- package/src/views/page-system/logs/components/index.ts +3 -0
- package/src/views/page-system/logs/components/log-message-demo.tsx +30 -0
- package/src/views/page-system/logs/components/log-message-stream.ts +184 -0
- package/src/views/page-system/logs/components/message-list/content-answer.tsx +100 -0
- package/src/views/page-system/logs/components/message-list/content-question.tsx +18 -0
- package/src/views/page-system/logs/components/message-list/index.tsx +515 -0
- package/src/views/page-system/logs/components/message-list/message-item.tsx +193 -0
- package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +147 -0
- package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +506 -0
- package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +36 -0
- package/src/views/page-system/logs/components/message-list/thinking-process.tsx +49 -0
- package/src/views/page-system/logs/components/message-list/toolbar.tsx +134 -0
- package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +214 -0
- package/src/views/page-system/logs/components/message-modal.tsx +239 -0
- package/src/views/page-system/logs/index.tsx +132 -0
- package/src/views/page-system/logs/modal/detail-modal.tsx +157 -0
- package/src/views/page-system/menu/components/menuFormShared.ts +283 -0
- package/src/views/page-system/menu/index.less +12 -0
- package/src/views/page-system/menu/index.tsx +410 -0
- package/src/views/page-system/menu/modal/icon-modal.less +51 -0
- package/src/views/page-system/menu/modal/icon-modal.tsx +87 -0
- package/src/views/page-system/menu/modal/submit-modal.tsx +263 -0
- package/src/views/page-system/permission/index.tsx +562 -0
- package/src/views/page-system/permission/modal/detail-modal.tsx +179 -0
- package/src/views/page-system/permission/modal/submit-modal.less +146 -0
- package/src/views/page-system/permission/modal/submit-modal.tsx +650 -0
- package/src/views/page-system/role/index.tsx +163 -0
- package/src/views/page-system/role/modal/detail-modal.tsx +127 -0
- package/src/views/page-system/role/modal/permission-assign-group-rules.ts +86 -0
- package/src/views/page-system/role/modal/permission-modal.tsx +111 -0
- package/src/views/page-system/role/modal/role-modal-shell-styles.ts +21 -0
- package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +916 -0
- package/src/views/page-system/role/modal/role-permission-assign-shared.ts +1047 -0
- package/src/views/page-system/role/modal/submit-modal.tsx +193 -0
- package/src/views/page-system/sys-config/index.tsx +294 -0
- package/src/views/page-system/user/components/user-role-column.tsx +87 -0
- package/src/views/page-system/user/index.tsx +439 -0
- package/src/views/page-system/user/modal/assign-roles-modal.tsx +389 -0
- package/src/views/page-system/user/modal/detail-modal.tsx +72 -0
- package/src/views/page-system/user/modal/modal-style/submit-modal.less +40 -0
- package/src/views/page-system/user/modal/submit-modal.less +40 -0
- package/src/views/page-system/user/modal/submit-modal.tsx +287 -0
- package/src/views/page-system/user/userFormShared.ts +51 -0
- package/tailwind.config.js +17 -0
- package/tsconfig.app.json +48 -0
- package/tsconfig.json +11 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +264 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
5
|
+
|
|
6
|
+
import { useAuth } from '../../contexts/AuthContext';
|
|
7
|
+
import { useMenu } from '../../contexts/MenuContext';
|
|
8
|
+
import Header from './components/Header';
|
|
9
|
+
import Sidebar from './components/Sidebar';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const MainLayout: React.FC = () => {
|
|
13
|
+
const { user, logout, hasPermission } = useAuth();
|
|
14
|
+
const { menus, isLoading: isLoadingMenus } = useMenu();
|
|
15
|
+
const navigate = useNavigate();
|
|
16
|
+
const location = useLocation();
|
|
17
|
+
const queryClient = useQueryClient();
|
|
18
|
+
useTranslation();
|
|
19
|
+
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
20
|
+
const [isAdminMenuOpen, setIsAdminMenuOpen] = useState(false);
|
|
21
|
+
const [headerTitle, setHeaderTitle] = useState<React.ReactNode | null>(null);
|
|
22
|
+
const [isUserMenuOpen, setIsUserMenuOpen] = useState(false);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const handleClickOutside = () => setIsUserMenuOpen(false);
|
|
26
|
+
if (isUserMenuOpen) {
|
|
27
|
+
window.addEventListener('click', handleClickOutside);
|
|
28
|
+
}
|
|
29
|
+
return () => window.removeEventListener('click', handleClickOutside);
|
|
30
|
+
}, [isUserMenuOpen]);
|
|
31
|
+
|
|
32
|
+
/** 路由变化时收起侧栏管理菜单(避免仅依赖 window click 时被 Header stopPropagation 拦住) */
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setIsAdminMenuOpen(false);
|
|
35
|
+
}, [location.pathname]);
|
|
36
|
+
|
|
37
|
+
/** 打开右上角用户菜单时收起管理菜单,避免叠两层 */
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (isUserMenuOpen) setIsAdminMenuOpen(false);
|
|
40
|
+
}, [isUserMenuOpen]);
|
|
41
|
+
|
|
42
|
+
/** 退出登录:先取消/清理会话相关请求与缓存,再跳转登录页 */
|
|
43
|
+
const handleLogout = async () => {
|
|
44
|
+
setIsUserMenuOpen(false);
|
|
45
|
+
// 主动退出:短时间内屏蔽“登录过期”全局提示(避免登出过程中残留请求触发 1803)
|
|
46
|
+
sessionStorage.setItem('suppress_unauthorized_toast_until', `${Date.now() + 2000}`);
|
|
47
|
+
try {
|
|
48
|
+
await queryClient.cancelQueries();
|
|
49
|
+
queryClient.removeQueries({ queryKey: ['threads'] });
|
|
50
|
+
queryClient.removeQueries({ queryKey: ['messages'] });
|
|
51
|
+
queryClient.removeQueries({ queryKey: ['chatSessionPrompt'] });
|
|
52
|
+
queryClient.removeQueries({ queryKey: ['chat', 'deletingSessionId'] });
|
|
53
|
+
} catch (e) {
|
|
54
|
+
// 取消查询失败不影响登出主流程
|
|
55
|
+
}
|
|
56
|
+
await logout();
|
|
57
|
+
navigate('/login', { replace: true });
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className="flex h-screen bg-white dark:bg-[#131314]">
|
|
62
|
+
<Sidebar
|
|
63
|
+
user={user}
|
|
64
|
+
hasPermission={hasPermission}
|
|
65
|
+
menus={menus}
|
|
66
|
+
isLoadingMenus={isLoadingMenus}
|
|
67
|
+
isCollapsed={isCollapsed}
|
|
68
|
+
setIsCollapsed={setIsCollapsed}
|
|
69
|
+
isAdminMenuOpen={isAdminMenuOpen}
|
|
70
|
+
setIsAdminMenuOpen={setIsAdminMenuOpen}
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
{/* Main Content Wrapper (includes Header + Content) */}
|
|
74
|
+
<div className="flex-1 flex flex-col min-w-0 min-h-0">
|
|
75
|
+
<Header
|
|
76
|
+
user={user}
|
|
77
|
+
hasPermission={hasPermission}
|
|
78
|
+
headerTitle={headerTitle}
|
|
79
|
+
isUserMenuOpen={isUserMenuOpen}
|
|
80
|
+
setIsUserMenuOpen={setIsUserMenuOpen}
|
|
81
|
+
onLogout={handleLogout}
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
{/* Content Area */}
|
|
85
|
+
<main className="flex-1 overflow-auto min-h-0">
|
|
86
|
+
<Outlet context={useMemo(() => ({ setHeaderTitle }), [setHeaderTitle])} />
|
|
87
|
+
</main>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default MainLayout;
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CxButton,
|
|
3
|
+
CxDatePicker,
|
|
4
|
+
CxInput,
|
|
5
|
+
CxRangePicker,
|
|
6
|
+
CxSelect,
|
|
7
|
+
} from '@cx-ui'
|
|
8
|
+
import { Form } from 'antd'
|
|
9
|
+
import dayjs from 'dayjs'
|
|
10
|
+
import { RotateCcw, Search, Users } from 'lucide-react'
|
|
11
|
+
import { useLayoutEffect, type ReactNode } from 'react'
|
|
12
|
+
import { useTranslation } from 'react-i18next'
|
|
13
|
+
import {
|
|
14
|
+
toCxSearchButtonSize,
|
|
15
|
+
type SearchButtonSize,
|
|
16
|
+
type SearchField,
|
|
17
|
+
} from './table-view.types'
|
|
18
|
+
|
|
19
|
+
/** setFieldsValue 为合并更新,必须对每个筛选项显式赋值才能清空(重置) */
|
|
20
|
+
function buildValuesForSearchFields(
|
|
21
|
+
searchFields: SearchField[],
|
|
22
|
+
searchFormData: Record<string, any>,
|
|
23
|
+
): Record<string, unknown> {
|
|
24
|
+
const out: Record<string, unknown> = {}
|
|
25
|
+
for (const f of searchFields) {
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(searchFormData, f.prop)) {
|
|
27
|
+
out[f.prop] = searchFormData[f.prop]
|
|
28
|
+
} else {
|
|
29
|
+
if (f.multiple) {
|
|
30
|
+
out[f.prop] = []
|
|
31
|
+
} else if (f.type === 'select' || f.type === 'date' || f.type === 'dateRange') {
|
|
32
|
+
// Select/Date 需要 undefined 才会展示 placeholder
|
|
33
|
+
out[f.prop] = undefined
|
|
34
|
+
} else {
|
|
35
|
+
out[f.prop] = ''
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return out
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface SearchAreaProps {
|
|
43
|
+
extra?: ReactNode
|
|
44
|
+
forceHorizontal?: boolean
|
|
45
|
+
form: any
|
|
46
|
+
/**
|
|
47
|
+
* 为 true(默认)时筛选项使用 Cx 浮动标签:常态显示 label,聚焦/展开时显示 placeholder。
|
|
48
|
+
* 设为 false 时恢复为仅 placeholder 的旧交互。
|
|
49
|
+
*/
|
|
50
|
+
floatingLabels?: boolean
|
|
51
|
+
listTitle?: string
|
|
52
|
+
onReset: () => void
|
|
53
|
+
onSearch: () => void
|
|
54
|
+
searchButtonSize?: SearchButtonSize
|
|
55
|
+
searchFields: SearchField[]
|
|
56
|
+
searchFormData: Record<string, any>
|
|
57
|
+
total: number
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function SearchArea({
|
|
61
|
+
extra,
|
|
62
|
+
forceHorizontal = false,
|
|
63
|
+
floatingLabels = true,
|
|
64
|
+
form,
|
|
65
|
+
listTitle,
|
|
66
|
+
onReset,
|
|
67
|
+
onSearch,
|
|
68
|
+
searchButtonSize = 'default',
|
|
69
|
+
searchFields,
|
|
70
|
+
searchFormData,
|
|
71
|
+
total,
|
|
72
|
+
}: SearchAreaProps) {
|
|
73
|
+
const { t } = useTranslation()
|
|
74
|
+
const iconPx = 14
|
|
75
|
+
const cxBtnSize = toCxSearchButtonSize(searchButtonSize)
|
|
76
|
+
|
|
77
|
+
/** 构造日期/时间范围的预设范围(用于搜索区 RangePicker 的快捷选择)。 */
|
|
78
|
+
const buildRangePresets = (opts: { showTime?: boolean }) => {
|
|
79
|
+
const now = dayjs()
|
|
80
|
+
if (opts.showTime) {
|
|
81
|
+
return [
|
|
82
|
+
{
|
|
83
|
+
label: t('common.table_search_preset_last_10_minutes'),
|
|
84
|
+
value: [now.subtract(10, 'minute'), now] as any,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: t('common.table_search_preset_last_30_minutes'),
|
|
88
|
+
value: [now.subtract(30, 'minute'), now] as any,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: t('common.table_search_preset_last_1_hour'),
|
|
92
|
+
value: [now.subtract(1, 'hour'), now] as any,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: t('common.table_search_preset_last_2_hours'),
|
|
96
|
+
value: [now.subtract(2, 'hour'), now] as any,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: t('common.table_search_preset_last_6_hours'),
|
|
100
|
+
value: [now.subtract(6, 'hour'), now] as any,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: t('common.table_search_preset_last_12_hours'),
|
|
104
|
+
value: [now.subtract(12, 'hour'), now] as any,
|
|
105
|
+
},
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return [
|
|
110
|
+
{
|
|
111
|
+
label: t('common.table_search_preset_today'),
|
|
112
|
+
value: [now.startOf('day'), now.endOf('day')] as any,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: t('common.table_search_preset_last_3_days'),
|
|
116
|
+
value: [now.subtract(2, 'day').startOf('day'), now.endOf('day')] as any,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
label: t('common.table_search_preset_last_1_week'),
|
|
120
|
+
value: [now.subtract(6, 'day').startOf('day'), now.endOf('day')] as any,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
label: t('common.table_search_preset_last_1_month'),
|
|
124
|
+
value: [now.subtract(1, 'month').startOf('day'), now.endOf('day')] as any,
|
|
125
|
+
},
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 与列表请求的 searchFormData 对齐;重置后 data 可能为 {},合并式 setFieldsValue 无法清字段,须按 prop 逐项写入
|
|
130
|
+
useLayoutEffect(() => {
|
|
131
|
+
form.setFieldsValue(
|
|
132
|
+
buildValuesForSearchFields(searchFields, searchFormData),
|
|
133
|
+
)
|
|
134
|
+
}, [form, searchFields, searchFormData])
|
|
135
|
+
|
|
136
|
+
const renderSearchField = (field: SearchField) => {
|
|
137
|
+
const labelText = field.labelKey
|
|
138
|
+
? t(field.labelKey)
|
|
139
|
+
: field.label
|
|
140
|
+
? t(field.label)
|
|
141
|
+
: ''
|
|
142
|
+
let placeholder: any
|
|
143
|
+
|
|
144
|
+
if (typeof field.placeholder === 'string') {
|
|
145
|
+
placeholder =
|
|
146
|
+
field.placeholder === '' ? '' : t(field.placeholder)
|
|
147
|
+
} else if (Array.isArray(field.placeholder)) {
|
|
148
|
+
placeholder = field.placeholder.map(item => t(item))
|
|
149
|
+
} else {
|
|
150
|
+
// 默认占位:保留提示,但不使用「请输入 / 请选择」类用语(避免与 Ant Design 中文默认冲突)
|
|
151
|
+
switch (field.type) {
|
|
152
|
+
case 'select':
|
|
153
|
+
placeholder = t('common.table_search_select_placeholder')
|
|
154
|
+
break
|
|
155
|
+
case 'date':
|
|
156
|
+
placeholder = t('common.table_search_date_placeholder')
|
|
157
|
+
break
|
|
158
|
+
case 'dateRange':
|
|
159
|
+
placeholder = [
|
|
160
|
+
t('common.table_search_date_range_start'),
|
|
161
|
+
t('common.table_search_date_range_end'),
|
|
162
|
+
]
|
|
163
|
+
break
|
|
164
|
+
default:
|
|
165
|
+
placeholder = labelText
|
|
166
|
+
break
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const widthStyle = { width: field.width || '100%', minWidth: 100 }
|
|
171
|
+
const allowClear = field.clearable !== false
|
|
172
|
+
const useFloat =
|
|
173
|
+
floatingLabels !== false &&
|
|
174
|
+
labelText != null &&
|
|
175
|
+
!(typeof labelText === 'string' && labelText.trim() === '')
|
|
176
|
+
|
|
177
|
+
switch (field.type) {
|
|
178
|
+
case 'select':
|
|
179
|
+
const selectOptions = (field.options ?? []).map((item) => ({
|
|
180
|
+
...item,
|
|
181
|
+
label: item.label.indexOf('.') > 0 ? t(item.label) : item.label,
|
|
182
|
+
}))
|
|
183
|
+
const selectFocusPlaceholder = (() => {
|
|
184
|
+
if (!useFloat) return undefined
|
|
185
|
+
if (Array.isArray(placeholder)) {
|
|
186
|
+
const p0 = placeholder[0]
|
|
187
|
+
return typeof p0 === 'string' ? p0 : undefined
|
|
188
|
+
}
|
|
189
|
+
return typeof placeholder === 'string' ? placeholder : undefined
|
|
190
|
+
})()
|
|
191
|
+
return useFloat ? (
|
|
192
|
+
<CxSelect.Large
|
|
193
|
+
allowClear={allowClear}
|
|
194
|
+
cxFloatingLabel={labelText}
|
|
195
|
+
cxFocusPlaceholder={selectFocusPlaceholder}
|
|
196
|
+
mode={field.multiple ? 'multiple' : undefined}
|
|
197
|
+
options={selectOptions}
|
|
198
|
+
placeholder={undefined}
|
|
199
|
+
style={{ ...widthStyle, maxWidth: '100%' }}
|
|
200
|
+
onChange={() => {}}
|
|
201
|
+
/>
|
|
202
|
+
) : (
|
|
203
|
+
<CxSelect.Large
|
|
204
|
+
allowClear={allowClear}
|
|
205
|
+
mode={field.multiple ? 'multiple' : undefined}
|
|
206
|
+
options={selectOptions}
|
|
207
|
+
placeholder={placeholder}
|
|
208
|
+
style={{ ...widthStyle, maxWidth: '100%' }}
|
|
209
|
+
onChange={() => {}}
|
|
210
|
+
/>
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
case 'date':
|
|
214
|
+
const dateFocusPlaceholder = (() => {
|
|
215
|
+
if (!useFloat) return undefined
|
|
216
|
+
if (Array.isArray(placeholder)) {
|
|
217
|
+
const p0 = placeholder[0]
|
|
218
|
+
return typeof p0 === 'string' ? p0 : undefined
|
|
219
|
+
}
|
|
220
|
+
return typeof placeholder === 'string' ? placeholder : undefined
|
|
221
|
+
})()
|
|
222
|
+
return useFloat ? (
|
|
223
|
+
<CxDatePicker.Large
|
|
224
|
+
allowClear={allowClear}
|
|
225
|
+
cxFloatingLabel={labelText}
|
|
226
|
+
cxFocusPlaceholder={dateFocusPlaceholder}
|
|
227
|
+
placeholder={undefined}
|
|
228
|
+
style={widthStyle}
|
|
229
|
+
onChange={() => {}}
|
|
230
|
+
onOpenChange={(open) => {
|
|
231
|
+
if (!open) {
|
|
232
|
+
onSearch()
|
|
233
|
+
}
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
) : (
|
|
237
|
+
<CxDatePicker.Large
|
|
238
|
+
allowClear={allowClear}
|
|
239
|
+
placeholder={placeholder}
|
|
240
|
+
style={widthStyle}
|
|
241
|
+
onChange={() => {}}
|
|
242
|
+
onOpenChange={(open) => {
|
|
243
|
+
if (!open) {
|
|
244
|
+
onSearch()
|
|
245
|
+
}
|
|
246
|
+
}}
|
|
247
|
+
/>
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
case 'dateRange':
|
|
251
|
+
const rangeFocusPlaceholder = (() => {
|
|
252
|
+
if (!useFloat) return undefined
|
|
253
|
+
if (Array.isArray(placeholder) && placeholder.length >= 2) {
|
|
254
|
+
const p0 = placeholder[0]
|
|
255
|
+
const p1 = placeholder[1]
|
|
256
|
+
if (typeof p0 === 'string' && typeof p1 === 'string') return [p0, p1] as [string, string]
|
|
257
|
+
return undefined
|
|
258
|
+
}
|
|
259
|
+
if (typeof placeholder === 'string') return [placeholder, placeholder] as [string, string]
|
|
260
|
+
return undefined
|
|
261
|
+
})()
|
|
262
|
+
return useFloat ? (
|
|
263
|
+
<CxRangePicker.Large
|
|
264
|
+
showTime={field.showTime}
|
|
265
|
+
allowClear={allowClear}
|
|
266
|
+
cxFloatingLabel={labelText}
|
|
267
|
+
cxFocusPlaceholder={rangeFocusPlaceholder}
|
|
268
|
+
format={field.format}
|
|
269
|
+
presets={buildRangePresets({ showTime: field.showTime })}
|
|
270
|
+
placeholder={undefined}
|
|
271
|
+
style={{ ...widthStyle, minWidth: 200 }}
|
|
272
|
+
onPressEnter={() => onSearch()}
|
|
273
|
+
onChange={() => {}}
|
|
274
|
+
onOpenChange={(open) => {
|
|
275
|
+
if (!open) {
|
|
276
|
+
onSearch()
|
|
277
|
+
}
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
280
|
+
) : (
|
|
281
|
+
<CxRangePicker.Large
|
|
282
|
+
showTime={field.showTime}
|
|
283
|
+
allowClear={allowClear}
|
|
284
|
+
format={field.format}
|
|
285
|
+
presets={buildRangePresets({ showTime: field.showTime })}
|
|
286
|
+
placeholder={placeholder}
|
|
287
|
+
style={{ ...widthStyle, minWidth: 200 }}
|
|
288
|
+
onPressEnter={() => onSearch()}
|
|
289
|
+
onChange={() => {}}
|
|
290
|
+
onOpenChange={(open) => {
|
|
291
|
+
if (!open) {
|
|
292
|
+
onSearch()
|
|
293
|
+
}
|
|
294
|
+
}}
|
|
295
|
+
/>
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
default:
|
|
299
|
+
return useFloat ? (
|
|
300
|
+
(() => {
|
|
301
|
+
const inputFocusPlaceholder = (() => {
|
|
302
|
+
if (Array.isArray(placeholder)) {
|
|
303
|
+
const p0 = placeholder[0]
|
|
304
|
+
return typeof p0 === 'string' ? p0 : undefined
|
|
305
|
+
}
|
|
306
|
+
return typeof placeholder === 'string' ? placeholder : undefined
|
|
307
|
+
})()
|
|
308
|
+
return (
|
|
309
|
+
<CxInput.Float
|
|
310
|
+
allowClear={allowClear}
|
|
311
|
+
cxFloatingLabel={labelText}
|
|
312
|
+
cxFocusPlaceholder={inputFocusPlaceholder}
|
|
313
|
+
placeholder={undefined}
|
|
314
|
+
style={widthStyle}
|
|
315
|
+
onPressEnter={() => onSearch()}
|
|
316
|
+
onChange={(e) => {
|
|
317
|
+
const next = e?.target?.value
|
|
318
|
+
if (next === '') onSearch()
|
|
319
|
+
}}
|
|
320
|
+
/>
|
|
321
|
+
)
|
|
322
|
+
})()
|
|
323
|
+
) : (
|
|
324
|
+
<CxInput.Large
|
|
325
|
+
allowClear={allowClear}
|
|
326
|
+
placeholder={placeholder}
|
|
327
|
+
style={widthStyle}
|
|
328
|
+
onPressEnter={() => onSearch()}
|
|
329
|
+
onChange={(e) => {
|
|
330
|
+
const next = e?.target?.value
|
|
331
|
+
if (next === '') onSearch()
|
|
332
|
+
}}
|
|
333
|
+
/>
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return (
|
|
339
|
+
<div className="px-3 pt-4 pb-2 border-b border-gray-200 dark:border-gray-700">
|
|
340
|
+
<div
|
|
341
|
+
className={
|
|
342
|
+
forceHorizontal
|
|
343
|
+
? 'flex items-center gap-3 flex-nowrap overflow-x-auto'
|
|
344
|
+
: 'flex items-center gap-3 flex-wrap'
|
|
345
|
+
}>
|
|
346
|
+
{listTitle && (
|
|
347
|
+
<h3 className="font-semibold text-lg text-gray-800 dark:text-white flex items-center gap-2">
|
|
348
|
+
<Users size={18} className="text-gray-500 dark:text-gray-400" />
|
|
349
|
+
{t(listTitle)}
|
|
350
|
+
{total > 0 && (
|
|
351
|
+
<span className="text-sm font-normal text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded-full">
|
|
352
|
+
{total}
|
|
353
|
+
</span>
|
|
354
|
+
)}
|
|
355
|
+
</h3>
|
|
356
|
+
)}
|
|
357
|
+
|
|
358
|
+
<Form
|
|
359
|
+
form={form}
|
|
360
|
+
layout="inline"
|
|
361
|
+
preserve={false}
|
|
362
|
+
className={forceHorizontal ? 'shrink-0' : undefined}
|
|
363
|
+
style={
|
|
364
|
+
forceHorizontal
|
|
365
|
+
? {
|
|
366
|
+
display: 'flex',
|
|
367
|
+
flexDirection: 'row',
|
|
368
|
+
flexWrap: 'nowrap',
|
|
369
|
+
alignItems: 'center',
|
|
370
|
+
columnGap: 8,
|
|
371
|
+
}
|
|
372
|
+
: undefined
|
|
373
|
+
}>
|
|
374
|
+
{searchFields.map((field) => (
|
|
375
|
+
<Form.Item
|
|
376
|
+
key={field.prop}
|
|
377
|
+
name={field.prop}
|
|
378
|
+
className="mb-0"
|
|
379
|
+
style={
|
|
380
|
+
forceHorizontal
|
|
381
|
+
? { marginBottom: 0, flex: '0 0 auto' }
|
|
382
|
+
: undefined
|
|
383
|
+
}>
|
|
384
|
+
{renderSearchField(field)}
|
|
385
|
+
</Form.Item>
|
|
386
|
+
))}
|
|
387
|
+
</Form>
|
|
388
|
+
|
|
389
|
+
<div className="flex gap-2 ml-auto flex-shrink-0 items-center flex-wrap">
|
|
390
|
+
<CxButton
|
|
391
|
+
size={cxBtnSize}
|
|
392
|
+
icon={<RotateCcw size={iconPx} />}
|
|
393
|
+
onClick={onReset}
|
|
394
|
+
className="border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-200">
|
|
395
|
+
{t('common.reset_filters')}
|
|
396
|
+
</CxButton>
|
|
397
|
+
<CxButton
|
|
398
|
+
size={cxBtnSize}
|
|
399
|
+
type="primary"
|
|
400
|
+
icon={<Search size={iconPx} />}
|
|
401
|
+
onClick={onSearch}>
|
|
402
|
+
{t('common.search')}
|
|
403
|
+
</CxButton>
|
|
404
|
+
{extra != null && extra !== false ? (
|
|
405
|
+
<div className="flex items-center gap-2">{extra}</div>
|
|
406
|
+
) : null}
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
</div>
|
|
410
|
+
)
|
|
411
|
+
}
|