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.
Files changed (404) hide show
  1. package/.cursor/rules/i18n-cn-gloss-comments.mdc +31 -0
  2. package/.cursor/rules/list-page-view-pageconfig.mdc +32 -0
  3. package/.cursor/rules/no-over-defensive-programming.mdc +90 -0
  4. package/.cursor/rules/requirement-description-for-agent.mdc +33 -0
  5. package/.cursor/rules/use-showToast-not-antd-message.mdc +28 -0
  6. package/.docker/Dockerfile +7 -0
  7. package/.env +9 -0
  8. package/.env.development +7 -0
  9. package/.env.production +7 -0
  10. package/.gitlab-ci/docker-build.yaml +28 -0
  11. package/.gitlab-ci/k8s-deploy-dev-master.yaml +42 -0
  12. package/.gitlab-ci/npm-build.yaml +17 -0
  13. package/.gitlab-ci.yml +8 -0
  14. package/.k8s/0-namespace.yaml +6 -0
  15. package/.k8s/1-configmap-web.yaml +7 -0
  16. package/.k8s/1-nginx-conf-dev.yaml +110 -0
  17. package/.k8s/2-deployment.yaml +27 -0
  18. package/.k8s/3-service.yaml +16 -0
  19. package/.k8s/4-ingress-dev.yaml +30 -0
  20. package/.lingma/rules/use-showToast-not-antd-message.md +34 -0
  21. package/.nginx/nginx.conf +52 -0
  22. package/.prettierrc +9 -0
  23. package/README.md +1 -0
  24. package/eslint.config.js +32 -0
  25. package/index.html +13 -0
  26. package/package.json +67 -0
  27. package/postcss.config.js +6 -0
  28. package/public/favicon.ico +0 -0
  29. package/public/vite.svg +1 -0
  30. package/src/App.tsx +96 -0
  31. package/src/_doc/0.docs-overview.md +28 -0
  32. package/src/_doc/cx-ui/0.docs-overview.md +30 -0
  33. package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +82 -0
  34. package/src/_doc/cx-ui/comp.2.cx-modal.md +82 -0
  35. package/src/_doc/cx-ui/comp.3.cx-button.md +89 -0
  36. package/src/_doc/cx-ui/comp.4.cx-form.md +72 -0
  37. package/src/_doc/cx-ui/comp.5.cx-fields.md +76 -0
  38. package/src/_doc/cx-ui/comp.6.cx-tag.md +57 -0
  39. package/src/_doc/cx-ui/comp.7.cx-empty-state.md +29 -0
  40. package/src/_doc/meta/0.docs-overview.md +24 -0
  41. package/src/_doc/meta/comp.1.enum-runtime.md +33 -0
  42. package/src/_doc/meta/comp.2.dict-runtime.md +39 -0
  43. package/src/_doc/router/0.docs-overview.md +14 -0
  44. package/src/_doc/router/guide.1.menu-component-config.md +181 -0
  45. package/src/_doc/router/guide.2.router-auto-registration.md +114 -0
  46. package/src/_doc/table-view/0.docs-overview.md +30 -0
  47. package/src/_doc/table-view/comp.1.table-view.md +542 -0
  48. package/src/_doc/table-view/props.1.create-table-view-config.md +193 -0
  49. package/src/_doc/table-view/props.2.table-view-search-fields.md +106 -0
  50. package/src/api/_mock/README.md +340 -0
  51. package/src/api/_mock/api.ts +1642 -0
  52. package/src/api/_mock/bundle-shim.ts +16 -0
  53. package/src/api/_mock/handler-shim.ts +6 -0
  54. package/src/api/_mock/handler.ts +458 -0
  55. package/src/api/_mock/index.ts +711 -0
  56. package/src/api/_mock/interceptor.ts +15 -0
  57. package/src/api/_mock/mod.ts +12 -0
  58. package/src/api/_mock/utils.ts +65 -0
  59. package/src/api/base/memory.js +24 -0
  60. package/src/api/chat.js +210 -0
  61. package/src/api/common/auth.js +70 -0
  62. package/src/api/menus/business-rules.js +76 -0
  63. package/src/api/menus/feedback.js +102 -0
  64. package/src/api/menus/knowledge.js +159 -0
  65. package/src/api/menus/model-metadata/manage.js +70 -0
  66. package/src/api/menus/model-metadata/role.js +50 -0
  67. package/src/api/menus/model-metadata/training-detail-mock-data.js +569 -0
  68. package/src/api/menus/model-metadata/training.js +28 -0
  69. package/src/api/menus/skill.js +40 -0
  70. package/src/api/system/agent-config.js +16 -0
  71. package/src/api/system/department.js +94 -0
  72. package/src/api/system/dict.js +86 -0
  73. package/src/api/system/menu.js +37 -0
  74. package/src/api/system/permission.js +26 -0
  75. package/src/api/system/role.js +34 -0
  76. package/src/api/system/sys-config.js +16 -0
  77. package/src/api/system/sys-log.js +17 -0
  78. package/src/api/system/user.js +75 -0
  79. package/src/api/upload.js +39 -0
  80. package/src/assets/react.svg +1 -0
  81. package/src/components/auth/current-user-avatar.tsx +77 -0
  82. package/src/components/common/code-view.tsx +149 -0
  83. package/src/components/common/detail-link.tsx +67 -0
  84. package/src/components/common/error-boundary.tsx +98 -0
  85. package/src/components/common/language-switcher.tsx +91 -0
  86. package/src/components/common/lite-table/index.tsx +135 -0
  87. package/src/components/common/md-editor.tsx +126 -0
  88. package/src/components/common/modal/confirm-dialog.tsx +113 -0
  89. package/src/components/common/modal/dep-user-select-multi.tsx +324 -0
  90. package/src/components/common/modal/dep-user-select.tsx +249 -0
  91. package/src/components/common/modal/user-select-multi.tsx +266 -0
  92. package/src/components/common/pagination.tsx +472 -0
  93. package/src/components/common/path.tsx +175 -0
  94. package/src/components/common/system-logo-mark.tsx +48 -0
  95. package/src/components/cx-ui/button/index.less +208 -0
  96. package/src/components/cx-ui/button/index.tsx +611 -0
  97. package/src/components/cx-ui/checkbox/index.tsx +78 -0
  98. package/src/components/cx-ui/date-picker/index.less +17 -0
  99. package/src/components/cx-ui/date-picker/index.tsx +193 -0
  100. package/src/components/cx-ui/drawer/index.tsx +47 -0
  101. package/src/components/cx-ui/empty-state/index.tsx +20 -0
  102. package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +89 -0
  103. package/src/components/cx-ui/floating-shell/cx-floating-shell.less +283 -0
  104. package/src/components/cx-ui/floating-shell/has-floating-value.ts +41 -0
  105. package/src/components/cx-ui/form/CxForm.tsx +15 -0
  106. package/src/components/cx-ui/form/index.tsx +20 -0
  107. package/src/components/cx-ui/form-item/index.less +26 -0
  108. package/src/components/cx-ui/form-item/index.tsx +36 -0
  109. package/src/components/cx-ui/index.ts +70 -0
  110. package/src/components/cx-ui/input/auto-complete.tsx +134 -0
  111. package/src/components/cx-ui/input/index.tsx +259 -0
  112. package/src/components/cx-ui/input-number/index.jsx +66 -0
  113. package/src/components/cx-ui/modal/index.jsx +212 -0
  114. package/src/components/cx-ui/modal/index.less +144 -0
  115. package/src/components/cx-ui/modal/useCxModal.ts +125 -0
  116. package/src/components/cx-ui/multi-select/index.jsx +74 -0
  117. package/src/components/cx-ui/multi-select/index.less +40 -0
  118. package/src/components/cx-ui/multi-select/index2.tsx +361 -0
  119. package/src/components/cx-ui/radio/index.tsx +33 -0
  120. package/src/components/cx-ui/range-picker/index.less +65 -0
  121. package/src/components/cx-ui/range-picker/index.tsx +219 -0
  122. package/src/components/cx-ui/select/index.less +34 -0
  123. package/src/components/cx-ui/select/index.tsx +196 -0
  124. package/src/components/cx-ui/skeleton/index.tsx +12 -0
  125. package/src/components/cx-ui/steps/index.tsx +14 -0
  126. package/src/components/cx-ui/styles/_tokens.less +79 -0
  127. package/src/components/cx-ui/styles/index.less +246 -0
  128. package/src/components/cx-ui/switch/index.less +106 -0
  129. package/src/components/cx-ui/switch/index.tsx +120 -0
  130. package/src/components/cx-ui/table/index.less +160 -0
  131. package/src/components/cx-ui/table/index.tsx +152 -0
  132. package/src/components/cx-ui/tabs/index.less +15 -0
  133. package/src/components/cx-ui/tabs/index.tsx +34 -0
  134. package/src/components/cx-ui/tag/index.less +51 -0
  135. package/src/components/cx-ui/tag/index.tsx +140 -0
  136. package/src/components/cx-ui/timeline/index.tsx +14 -0
  137. package/src/components/cx-ui/tooltip/index.tsx +67 -0
  138. package/src/components/cx-ui/tree/index.tsx +193 -0
  139. package/src/components/cx-ui/tree-select/index.jsx +91 -0
  140. package/src/components/cx-ui/tree-select/index.less +27 -0
  141. package/src/components/cx-ui/upload-file/index.less +223 -0
  142. package/src/components/cx-ui/upload-file/index.tsx +640 -0
  143. package/src/components/cx-ui/upload-img/index.tsx +291 -0
  144. package/src/components/layout/components/Header.tsx +216 -0
  145. package/src/components/layout/components/Sidebar.tsx +717 -0
  146. package/src/components/layout/index.tsx +95 -0
  147. package/src/components/table-view/components/search-area.tsx +411 -0
  148. package/src/components/table-view/components/table-view-config.tsx +528 -0
  149. package/src/components/table-view/components/table-view.types.ts +478 -0
  150. package/src/components/table-view/components/tree-api-normalize.ts +38 -0
  151. package/src/components/table-view/components/tree-data-annotate.ts +31 -0
  152. package/src/components/table-view/components/tree-sidebar.tsx +74 -0
  153. package/src/components/table-view/index.tsx +61 -0
  154. package/src/components/table-view/list-page-view.tsx +1049 -0
  155. package/src/components/table-view/select-table-view.tsx +1094 -0
  156. package/src/components/table-view/styles/select-table-view.less +51 -0
  157. package/src/config/default-system-name.ts +9 -0
  158. package/src/config/system.ts +165 -0
  159. package/src/constants/countryCodes.ts +3 -0
  160. package/src/contexts/AuthContext.tsx +256 -0
  161. package/src/contexts/ChatContext.tsx +839 -0
  162. package/src/contexts/MenuContext.tsx +62 -0
  163. package/src/contexts/ToastContext.tsx +181 -0
  164. package/src/hooks/useCopyToClipboard.ts +47 -0
  165. package/src/hooks/useModalSubmit.ts +104 -0
  166. package/src/hooks/useRouter.ts +240 -0
  167. package/src/hooks/useStepForm.ts +46 -0
  168. package/src/hooks/useStickyHeader.ts +42 -0
  169. package/src/hooks/useThreadActions.ts +105 -0
  170. package/src/hooks/useUserPreferences.ts +101 -0
  171. package/src/http/axios.js +372 -0
  172. package/src/http/mock.interceptor.ts +9 -0
  173. package/src/http/obfuscationKey.ts +41 -0
  174. package/src/i18n.ts +60 -0
  175. package/src/index.js +1 -0
  176. package/src/index.less +169 -0
  177. package/src/locales/en/auth.ts +70 -0
  178. package/src/locales/en/base/memory.ts +28 -0
  179. package/src/locales/en/base/settings.ts +41 -0
  180. package/src/locales/en/chat.ts +40 -0
  181. package/src/locales/en/common.ts +173 -0
  182. package/src/locales/en/enum.ts +27 -0
  183. package/src/locales/en/menus/business-rules.ts +48 -0
  184. package/src/locales/en/menus/feedback.ts +62 -0
  185. package/src/locales/en/menus/knowledge.ts +120 -0
  186. package/src/locales/en/menus/model-metadata/index.ts +10 -0
  187. package/src/locales/en/menus/model-metadata/manage.ts +151 -0
  188. package/src/locales/en/menus/model-metadata/role.ts +48 -0
  189. package/src/locales/en/menus/model-metadata/training.ts +65 -0
  190. package/src/locales/en/menus/skill.ts +34 -0
  191. package/src/locales/en/system/agent-config.ts +34 -0
  192. package/src/locales/en/system/department.ts +68 -0
  193. package/src/locales/en/system/dict.ts +44 -0
  194. package/src/locales/en/system/menu.ts +45 -0
  195. package/src/locales/en/system/permission.ts +89 -0
  196. package/src/locales/en/system/role.ts +25 -0
  197. package/src/locales/en/system/sys-config.ts +33 -0
  198. package/src/locales/en/system/sys-log.ts +38 -0
  199. package/src/locales/en/system/user.ts +113 -0
  200. package/src/locales/en.ts +68 -0
  201. package/src/locales/zh/auth.ts +70 -0
  202. package/src/locales/zh/base/memory.ts +29 -0
  203. package/src/locales/zh/base/settings.ts +41 -0
  204. package/src/locales/zh/chat.ts +47 -0
  205. package/src/locales/zh/common.ts +178 -0
  206. package/src/locales/zh/enum.ts +28 -0
  207. package/src/locales/zh/menus/business-rules.ts +47 -0
  208. package/src/locales/zh/menus/feedback.ts +62 -0
  209. package/src/locales/zh/menus/knowledge.ts +117 -0
  210. package/src/locales/zh/menus/model-metadata/index.ts +10 -0
  211. package/src/locales/zh/menus/model-metadata/manage.ts +151 -0
  212. package/src/locales/zh/menus/model-metadata/role.ts +47 -0
  213. package/src/locales/zh/menus/model-metadata/training.ts +64 -0
  214. package/src/locales/zh/menus/skill.ts +34 -0
  215. package/src/locales/zh/system/agent-config.ts +33 -0
  216. package/src/locales/zh/system/department.ts +69 -0
  217. package/src/locales/zh/system/dict.ts +44 -0
  218. package/src/locales/zh/system/menu.ts +47 -0
  219. package/src/locales/zh/system/permission.ts +94 -0
  220. package/src/locales/zh/system/role.ts +25 -0
  221. package/src/locales/zh/system/sys-config.ts +32 -0
  222. package/src/locales/zh/system/sys-log.ts +38 -0
  223. package/src/locales/zh/system/user.ts +114 -0
  224. package/src/locales/zh.ts +67 -0
  225. package/src/main.tsx +50 -0
  226. package/src/meta/const/index.ts +40 -0
  227. package/src/meta/index-dict.ts +56 -0
  228. package/src/meta/index-enum.ts +95 -0
  229. package/src/meta/index.ts +14 -0
  230. package/src/meta/module/dict-data/runtime.ts +199 -0
  231. package/src/meta/module/dict-data/types.ts +17 -0
  232. package/src/meta/module/enum-data/runtime.ts +75 -0
  233. package/src/meta/module/enum-data/types.ts +18 -0
  234. package/src/router/index.tsx +312 -0
  235. package/src/styles/AntdThemeProvider.tsx +40 -0
  236. package/src/styles/antd-theme.ts +20 -0
  237. package/src/styles/global.less +107 -0
  238. package/src/styles/variable.less +103 -0
  239. package/src/types/feedback.ts +43 -0
  240. package/src/types/index.ts +85 -0
  241. package/src/types/menu.ts +43 -0
  242. package/src/utils/aesUtil.ts +123 -0
  243. package/src/utils/chatUtils.ts +524 -0
  244. package/src/utils/cn.ts +6 -0
  245. package/src/utils/crypto.ts +164 -0
  246. package/src/utils/date.ts +72 -0
  247. package/src/utils/file-icons.tsx +79 -0
  248. package/src/utils/index.ts +168 -0
  249. package/src/utils/markdown-math-plugins.ts +21 -0
  250. package/src/utils/menuI18n.ts +305 -0
  251. package/src/utils/menuRouteRegistry.ts +78 -0
  252. package/src/utils/permission-crud.ts +147 -0
  253. package/src/utils/routeConfig.ts +350 -0
  254. package/src/utils/storage.ts +135 -0
  255. package/src/utils/toastBridge.ts +26 -0
  256. package/src/utils/url.ts +38 -0
  257. package/src/utils/validation.ts +16 -0
  258. package/src/views/auth/auth-code/index.less +169 -0
  259. package/src/views/auth/auth-code/index.module.less +174 -0
  260. package/src/views/auth/auth-code/index.tsx +233 -0
  261. package/src/views/auth/login.tsx +498 -0
  262. package/src/views/auth/register.tsx +388 -0
  263. package/src/views/base/memory/index.tsx +136 -0
  264. package/src/views/base/memory/modal/detail-modal.tsx +89 -0
  265. package/src/views/base/memory/modal/submit-modal.tsx +134 -0
  266. package/src/views/base/settings/index.tsx +657 -0
  267. package/src/views/chat/chat.less +323 -0
  268. package/src/views/chat/components/chat-input.tsx +298 -0
  269. package/src/views/chat/components/header-thread-title.tsx +210 -0
  270. package/src/views/chat/components/message-list/content-answer.tsx +100 -0
  271. package/src/views/chat/components/message-list/content-question.tsx +18 -0
  272. package/src/views/chat/components/message-list/index.tsx +520 -0
  273. package/src/views/chat/components/message-list/message-item.tsx +199 -0
  274. package/src/views/chat/components/message-list/preparation-demo-items.ts +147 -0
  275. package/src/views/chat/components/message-list/preparation-steps.tsx +506 -0
  276. package/src/views/chat/components/message-list/suggestion-list.tsx +36 -0
  277. package/src/views/chat/components/message-list/thinking-process.tsx +49 -0
  278. package/src/views/chat/components/message-list/toolbar.tsx +224 -0
  279. package/src/views/chat/components/message-list/use-message-list-scroll.ts +214 -0
  280. package/src/views/chat/components/references-knowledge/context.tsx +57 -0
  281. package/src/views/chat/components/references-knowledge/index.ts +9 -0
  282. package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +556 -0
  283. package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +529 -0
  284. package/src/views/chat/components/references-knowledge/panel.tsx +115 -0
  285. package/src/views/chat/hooks/use-chat-common.ts +19 -0
  286. package/src/views/chat/index-session.tsx +647 -0
  287. package/src/views/chat/index.tsx +127 -0
  288. package/src/views/page-error/401.tsx +56 -0
  289. package/src/views/page-error/404.tsx +56 -0
  290. package/src/views/page-menus/business-rules/index.tsx +376 -0
  291. package/src/views/page-menus/business-rules/modal/detail-modal.tsx +186 -0
  292. package/src/views/page-menus/business-rules/modal/scope-modal.tsx +272 -0
  293. package/src/views/page-menus/business-rules/modal/submit-modal.tsx +142 -0
  294. package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +471 -0
  295. package/src/views/page-menus/feedback/index.tsx +166 -0
  296. package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +367 -0
  297. package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +32 -0
  298. package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +330 -0
  299. package/src/views/page-menus/knowledge/detail.tsx +600 -0
  300. package/src/views/page-menus/knowledge/index.tsx +337 -0
  301. package/src/views/page-menus/knowledge/modal/detail-modal.tsx +618 -0
  302. package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +550 -0
  303. package/src/views/page-menus/knowledge/modal/doc-parse.ts +99 -0
  304. package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +349 -0
  305. package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +88 -0
  306. package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +283 -0
  307. package/src/views/page-menus/knowledge/modal/submit-modal.tsx +179 -0
  308. package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +114 -0
  309. package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +232 -0
  310. package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +316 -0
  311. package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +134 -0
  312. package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +134 -0
  313. package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +101 -0
  314. package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +338 -0
  315. package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +276 -0
  316. package/src/views/page-menus/model-metadata/manage/detail.tsx +298 -0
  317. package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +113 -0
  318. package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +20 -0
  319. package/src/views/page-menus/model-metadata/manage/index.tsx +304 -0
  320. package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +374 -0
  321. package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +151 -0
  322. package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +423 -0
  323. package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +218 -0
  324. package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +261 -0
  325. package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +196 -0
  326. package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +229 -0
  327. package/src/views/page-menus/model-metadata/manage/submit.tsx +31 -0
  328. package/src/views/page-menus/model-metadata/role/index.tsx +207 -0
  329. package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +97 -0
  330. package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +254 -0
  331. package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +393 -0
  332. package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +120 -0
  333. package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +698 -0
  334. package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +237 -0
  335. package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +135 -0
  336. package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +4 -0
  337. package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +72 -0
  338. package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +196 -0
  339. package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +153 -0
  340. package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +103 -0
  341. package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +82 -0
  342. package/src/views/page-menus/model-metadata/training/detail.tsx +159 -0
  343. package/src/views/page-menus/model-metadata/training/index.tsx +236 -0
  344. package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +154 -0
  345. package/src/views/page-menus/skill/index.tsx +201 -0
  346. package/src/views/page-menus/skill/modal/detail-modal.tsx +156 -0
  347. package/src/views/page-menus/skill/modal/submit-modal.tsx +214 -0
  348. package/src/views/page-system/agent-config/index.tsx +370 -0
  349. package/src/views/page-system/department/departmentFormShared.ts +36 -0
  350. package/src/views/page-system/department/index.tsx +541 -0
  351. package/src/views/page-system/department/modal/detail-modal.tsx +94 -0
  352. package/src/views/page-system/department/modal/member-role-modal.tsx +128 -0
  353. package/src/views/page-system/department/modal/submit-modal.tsx +265 -0
  354. package/src/views/page-system/dict/index.tsx +440 -0
  355. package/src/views/page-system/dict/modal/cate-submit-modal.tsx +315 -0
  356. package/src/views/page-system/dict/modal/submit-modal.tsx +184 -0
  357. package/src/views/page-system/logs/components/index.ts +3 -0
  358. package/src/views/page-system/logs/components/log-message-demo.tsx +30 -0
  359. package/src/views/page-system/logs/components/log-message-stream.ts +184 -0
  360. package/src/views/page-system/logs/components/message-list/content-answer.tsx +100 -0
  361. package/src/views/page-system/logs/components/message-list/content-question.tsx +18 -0
  362. package/src/views/page-system/logs/components/message-list/index.tsx +515 -0
  363. package/src/views/page-system/logs/components/message-list/message-item.tsx +193 -0
  364. package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +147 -0
  365. package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +506 -0
  366. package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +36 -0
  367. package/src/views/page-system/logs/components/message-list/thinking-process.tsx +49 -0
  368. package/src/views/page-system/logs/components/message-list/toolbar.tsx +134 -0
  369. package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +214 -0
  370. package/src/views/page-system/logs/components/message-modal.tsx +239 -0
  371. package/src/views/page-system/logs/index.tsx +132 -0
  372. package/src/views/page-system/logs/modal/detail-modal.tsx +157 -0
  373. package/src/views/page-system/menu/components/menuFormShared.ts +283 -0
  374. package/src/views/page-system/menu/index.less +12 -0
  375. package/src/views/page-system/menu/index.tsx +410 -0
  376. package/src/views/page-system/menu/modal/icon-modal.less +51 -0
  377. package/src/views/page-system/menu/modal/icon-modal.tsx +87 -0
  378. package/src/views/page-system/menu/modal/submit-modal.tsx +263 -0
  379. package/src/views/page-system/permission/index.tsx +562 -0
  380. package/src/views/page-system/permission/modal/detail-modal.tsx +179 -0
  381. package/src/views/page-system/permission/modal/submit-modal.less +146 -0
  382. package/src/views/page-system/permission/modal/submit-modal.tsx +650 -0
  383. package/src/views/page-system/role/index.tsx +163 -0
  384. package/src/views/page-system/role/modal/detail-modal.tsx +127 -0
  385. package/src/views/page-system/role/modal/permission-assign-group-rules.ts +86 -0
  386. package/src/views/page-system/role/modal/permission-modal.tsx +111 -0
  387. package/src/views/page-system/role/modal/role-modal-shell-styles.ts +21 -0
  388. package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +916 -0
  389. package/src/views/page-system/role/modal/role-permission-assign-shared.ts +1047 -0
  390. package/src/views/page-system/role/modal/submit-modal.tsx +193 -0
  391. package/src/views/page-system/sys-config/index.tsx +294 -0
  392. package/src/views/page-system/user/components/user-role-column.tsx +87 -0
  393. package/src/views/page-system/user/index.tsx +439 -0
  394. package/src/views/page-system/user/modal/assign-roles-modal.tsx +389 -0
  395. package/src/views/page-system/user/modal/detail-modal.tsx +72 -0
  396. package/src/views/page-system/user/modal/modal-style/submit-modal.less +40 -0
  397. package/src/views/page-system/user/modal/submit-modal.less +40 -0
  398. package/src/views/page-system/user/modal/submit-modal.tsx +287 -0
  399. package/src/views/page-system/user/userFormShared.ts +51 -0
  400. package/tailwind.config.js +17 -0
  401. package/tsconfig.app.json +48 -0
  402. package/tsconfig.json +11 -0
  403. package/tsconfig.node.json +26 -0
  404. package/vite.config.ts +264 -0
@@ -0,0 +1,193 @@
1
+ import type { GetProps } from 'antd'
2
+ import { ConfigProvider, DatePicker } from 'antd'
3
+ import zhCN from 'antd/locale/zh_CN'
4
+ import enUS from 'antd/locale/en_US'
5
+ import clsx from 'clsx'
6
+ import dayjs from 'dayjs'
7
+ import 'dayjs/locale/zh-cn'
8
+ import 'dayjs/locale/en'
9
+ import React, { useEffect, useMemo, useState } from 'react'
10
+
11
+ import { CxFloatingShell } from '../floating-shell/CxFloatingShell'
12
+ import { hasCxFloatingValue } from '../floating-shell/has-floating-value'
13
+ import './index.less'
14
+
15
+ const LOCALE_ENUM: Record<
16
+ string,
17
+ { antd: typeof zhCN; dayjs: string }
18
+ > = {
19
+ 'zh-CN': { antd: zhCN, dayjs: 'zh-cn' },
20
+ 'en-US': { antd: enUS, dayjs: 'en' },
21
+ zh: { antd: zhCN, dayjs: 'zh-cn' },
22
+ en: { antd: enUS, dayjs: 'en' },
23
+ }
24
+
25
+ type AntDatePickerProps = GetProps<typeof DatePicker>
26
+
27
+ type CxDatePickerOwn = {
28
+ cxFloatingLabel?: React.ReactNode
29
+ cxFocusPlaceholder?: string
30
+ }
31
+
32
+ export type CxDatePickerProps = Omit<AntDatePickerProps, 'variant'> & CxDatePickerOwn
33
+
34
+ type CxDatePickerBaseProps = Omit<AntDatePickerProps, 'variant'> & CxDatePickerOwn
35
+
36
+ /** 判断浮动标签是否有效(避免 String() / Number() 这类强转)。 */
37
+ const hasNonEmptyFloatingLabel = (label: React.ReactNode): boolean => {
38
+ if (label == null || label === false) return false
39
+ if (typeof label === 'string') return label.trim().length > 0
40
+ return true
41
+ }
42
+
43
+ /** 获取浮动壳聚焦占位:优先 cxFocusPlaceholder,其次仅接受 string placeholder。 */
44
+ const resolveFocusPlaceholder = (
45
+ cxFocusPlaceholder: string | undefined,
46
+ placeholder: AntDatePickerProps['placeholder'] | undefined,
47
+ ): string | undefined => {
48
+ if (cxFocusPlaceholder) return cxFocusPlaceholder
49
+ if (typeof placeholder === 'string') return placeholder
50
+ return undefined
51
+ }
52
+
53
+ /** 解析页面语言:优先 html lang,其次回退 zh-CN。 */
54
+ const resolveDocumentLang = (): string => {
55
+ if (typeof document === 'undefined') return 'zh-CN'
56
+ const lang = document.documentElement.lang
57
+ return lang ? lang : 'zh-CN'
58
+ }
59
+
60
+ /** CxDatePicker 基础组件:统一 DatePicker 与浮动标签能力。 */
61
+ const CxDatePickerPrimitive: React.FC<CxDatePickerProps> = (props) => {
62
+ const {
63
+ className,
64
+ style = undefined,
65
+ cxFloatingLabel,
66
+ cxFocusPlaceholder,
67
+ placeholder,
68
+ value,
69
+ onOpenChange,
70
+ disabled,
71
+ ...rest
72
+ } = props
73
+
74
+ /** 解析高度:默认 42,可通过 style.height 覆盖(数值)。 */
75
+ const resolveHeight = () => {
76
+ const h = style && typeof style === 'object' ? (style as { height?: unknown }).height : undefined
77
+ return typeof h === 'number' ? h : 42
78
+ }
79
+
80
+ /** 根据高度推导浮动壳的布局类型:40 及以下按搜索区,其他按表单区。 */
81
+ const shellVariant: 'cxForm' | 'cxSearch' = resolveHeight() <= 40 ? 'cxSearch' : 'cxForm'
82
+
83
+ const localeLang = resolveDocumentLang()
84
+ const localeConfig = LOCALE_ENUM[localeLang] || LOCALE_ENUM['zh-CN']
85
+
86
+ useEffect(() => {
87
+ dayjs.locale(localeConfig.dayjs)
88
+ }, [localeConfig.dayjs])
89
+
90
+ const useFloat = hasNonEmptyFloatingLabel(cxFloatingLabel)
91
+ const [panelOpen, setPanelOpen] = useState(false)
92
+
93
+ const hasValue = useMemo(() => hasCxFloatingValue(value, 'date'), [value])
94
+
95
+ const pickerClass = clsx(
96
+ 'cx-datepicker',
97
+ 'cx-date-picker',
98
+ shellVariant === 'cxSearch' ? 'cx-date-picker--cxSearch' : 'cx-date-picker--cxForm',
99
+ className,
100
+ )
101
+
102
+ const pickerStyle: React.CSSProperties = {
103
+ boxSizing: 'border-box',
104
+ ...(style && typeof style === 'object' ? style : {}),
105
+ width: '100%',
106
+ }
107
+
108
+ const pickerEl = (
109
+ <DatePicker
110
+ {...(rest as AntDatePickerProps)}
111
+ disabled={disabled}
112
+ value={value}
113
+ className={pickerClass}
114
+ style={pickerStyle}
115
+ placeholder={useFloat ? '' : placeholder}
116
+ onOpenChange={(open) => {
117
+ setPanelOpen(open)
118
+ onOpenChange?.(open)
119
+ }}
120
+ />
121
+ )
122
+
123
+ const inner = useFloat ? (
124
+ <CxFloatingShell
125
+ disabled={disabled}
126
+ focusPlaceholder={resolveFocusPlaceholder(cxFocusPlaceholder, placeholder)}
127
+ hasValue={hasValue}
128
+ label={cxFloatingLabel}
129
+ overlayOpen={panelOpen}
130
+ variant={shellVariant}
131
+ >
132
+ {pickerEl}
133
+ </CxFloatingShell>
134
+ ) : (
135
+ pickerEl
136
+ )
137
+
138
+ return <ConfigProvider locale={localeConfig.antd}>{inner}</ConfigProvider>
139
+ }
140
+
141
+ /** Large:42px,高度偏表单主输入。 */
142
+ export function CxDatePickerLarge(props: CxDatePickerBaseProps): React.ReactElement
143
+ export function CxDatePickerLarge(props: CxDatePickerProps) {
144
+ return (
145
+ <CxDatePickerPrimitive
146
+ {...(props as any)}
147
+ style={{ ...(props as any)?.style, height: 42, minHeight: 42 }}
148
+ />
149
+ )
150
+ }
151
+
152
+ /** Medium:40px,高度偏搜索区输入。 */
153
+ export function CxDatePickerMedium(props: CxDatePickerBaseProps): React.ReactElement
154
+ export function CxDatePickerMedium(props: CxDatePickerProps) {
155
+ return (
156
+ <CxDatePickerPrimitive
157
+ {...(props as any)}
158
+ style={{ ...(props as any)?.style, height: 40, minHeight: 40 }}
159
+ />
160
+ )
161
+ }
162
+
163
+ /** Small:32px,更紧凑。 */
164
+ export function CxDatePickerSmall(props: CxDatePickerBaseProps): React.ReactElement
165
+ export function CxDatePickerSmall(props: CxDatePickerProps) {
166
+ return (
167
+ <CxDatePickerPrimitive
168
+ {...(props as any)}
169
+ style={{ ...(props as any)?.style, height: 32, minHeight: 32 }}
170
+ />
171
+ )
172
+ }
173
+
174
+ /** Float:第 4 种类型,浮动标签日期选择(使用 CxFloatingShell)。 */
175
+ export function CxDatePickerFloat(props: CxDatePickerBaseProps): React.ReactElement
176
+ export function CxDatePickerFloat(props: CxDatePickerBaseProps) {
177
+ const hasLabel = hasNonEmptyFloatingLabel((props as any)?.cxFloatingLabel)
178
+ return (
179
+ <CxDatePickerPrimitive
180
+ {...(props as any)}
181
+ cxFloatingLabel={hasLabel ? (props as any)?.cxFloatingLabel : (props as any)?.placeholder}
182
+ />
183
+ )
184
+ }
185
+
186
+ const ExportedCxDatePicker = Object.assign(CxDatePickerPrimitive, {
187
+ Large: CxDatePickerLarge,
188
+ Medium: CxDatePickerMedium,
189
+ Small: CxDatePickerSmall,
190
+ Float: CxDatePickerFloat,
191
+ })
192
+
193
+ export default ExportedCxDatePicker
@@ -0,0 +1,47 @@
1
+ import React, { useMemo } from 'react'
2
+ import type { DrawerProps } from 'antd'
3
+ import { Drawer } from 'antd'
4
+
5
+ export type CxDrawerProps = {
6
+ isOpen: boolean
7
+ title?: React.ReactNode
8
+ onClose: () => void
9
+ children: React.ReactNode
10
+ drawerConfig?: DrawerProps
11
+ }
12
+
13
+ /**
14
+ * 右侧抽屉封装:与 `CxModal` 一样统一入口与默认样式,
15
+ * 并可配合 `useCxModal` 复用 open/close 状态控制逻辑。
16
+ */
17
+ export default function CxDrawer({
18
+ isOpen,
19
+ title,
20
+ onClose,
21
+ children,
22
+ drawerConfig = {},
23
+ }: CxDrawerProps) {
24
+ const mergedConfig = useMemo<DrawerProps>(
25
+ () => ({
26
+ placement: drawerConfig.placement ?? 'right',
27
+ width: drawerConfig.width ?? 520,
28
+ maskClosable: drawerConfig.maskClosable ?? true,
29
+ destroyOnClose: drawerConfig.destroyOnClose ?? false,
30
+ // antd Drawer 的 `styles` 在不同版本类型差异较大,这里不做细粒度 merge,直接透传由调用方控制。
31
+ ...drawerConfig,
32
+ }),
33
+ [drawerConfig],
34
+ )
35
+
36
+ return (
37
+ <Drawer
38
+ open={isOpen}
39
+ title={title}
40
+ onClose={onClose}
41
+ {...mergedConfig}
42
+ >
43
+ {children}
44
+ </Drawer>
45
+ )
46
+ }
47
+
@@ -0,0 +1,20 @@
1
+ import { FolderOpen } from 'lucide-react'
2
+ import { memo } from 'react'
3
+
4
+ interface CxEmptyStateProps {
5
+ message: string
6
+ }
7
+
8
+ function CxEmptyStateInner({ message }: CxEmptyStateProps) {
9
+ return (
10
+ <div className="h-full flex flex-col items-center justify-center py-8 text-gray-400 dark:text-gray-500">
11
+ <div className="w-16 h-16 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center mb-4">
12
+ <FolderOpen size={32} className="text-gray-300 dark:text-gray-600" />
13
+ </div>
14
+ <p>{message}</p>
15
+ </div>
16
+ )
17
+ }
18
+
19
+ export type { CxEmptyStateProps }
20
+ export const CxEmptyState = memo(CxEmptyStateInner)
@@ -0,0 +1,89 @@
1
+ import clsx from 'clsx'
2
+ import React, { useMemo, useState } from 'react'
3
+
4
+ export type CxFloatingShellProps = {
5
+ children: React.ReactElement
6
+ /** 有焦点或下拉/面板展开时,传给子控件的 placeholder */
7
+ focusPlaceholder?: React.ReactNode | string[]
8
+ hasValue: boolean
9
+ label: React.ReactNode
10
+ /** 下拉、日期面板展开时视为「类聚焦」,保持 label 上浮与占位显示 */
11
+ overlayOpen?: boolean
12
+ variant?: 'cxForm' | 'cxSearch'
13
+ className?: string
14
+ disabled?: boolean | [boolean, boolean]
15
+ style?: React.CSSProperties
16
+ }
17
+
18
+ function mergePlaceholder(
19
+ focused: boolean,
20
+ overlayOpen: boolean,
21
+ focusPlaceholder: React.ReactNode | string[] | undefined,
22
+ prevPlaceholder: React.ReactNode | string[] | undefined,
23
+ ): React.ReactNode | string[] | undefined {
24
+ if (focused || overlayOpen) {
25
+ if (focusPlaceholder !== undefined) return focusPlaceholder
26
+ return prevPlaceholder
27
+ }
28
+ // 保留子组件初始 placeholder(如 RangePicker 用 ['',''] 避免 antd 回退到 locale 与 label 重叠)
29
+ return prevPlaceholder
30
+ }
31
+
32
+ export function CxFloatingShell({
33
+ children,
34
+ className,
35
+ disabled,
36
+ focusPlaceholder,
37
+ hasValue,
38
+ label,
39
+ overlayOpen = false,
40
+ style,
41
+ variant = 'cxForm',
42
+ }: CxFloatingShellProps) {
43
+ const [focused, setFocused] = useState(false)
44
+ const floated = focused || hasValue || overlayOpen
45
+
46
+ const mergedChild = useMemo(() => {
47
+ const p = children.props as {
48
+ onBlur?: (ev: React.FocusEvent) => void
49
+ onFocus?: (ev: React.FocusEvent) => void
50
+ placeholder?: React.ReactNode | string[]
51
+ }
52
+ const nextPlaceholder = mergePlaceholder(
53
+ focused,
54
+ overlayOpen,
55
+ focusPlaceholder,
56
+ p.placeholder,
57
+ )
58
+ return React.cloneElement(children, {
59
+ onBlur: (e: React.FocusEvent) => {
60
+ setFocused(false)
61
+ p.onBlur?.(e)
62
+ },
63
+ onFocus: (e: React.FocusEvent) => {
64
+ setFocused(true)
65
+ p.onFocus?.(e)
66
+ },
67
+ placeholder: nextPlaceholder,
68
+ } as Record<string, unknown>)
69
+ }, [children, focusPlaceholder, focused, overlayOpen])
70
+
71
+ const disabledShell = Array.isArray(disabled)
72
+ ? disabled.some(Boolean)
73
+ : Boolean(disabled)
74
+
75
+ return (
76
+ <div
77
+ className={clsx(
78
+ 'cx-floating-shell',
79
+ `cx-floating-shell--${variant}`,
80
+ floated && 'cx-floating-shell--floated',
81
+ disabledShell && 'cx-floating-shell--disabled',
82
+ className,
83
+ )}
84
+ style={style}>
85
+ <div className="cx-floating-shell__control">{mergedChild}</div>
86
+ <span className="cx-floating-shell__label">{label}</span>
87
+ </div>
88
+ )
89
+ }
@@ -0,0 +1,283 @@
1
+ /* Vuetify / Material 风格:空且失焦时 label 在输入区中部;有值或聚焦/展开时缩小至左上角 */
2
+
3
+ .cx-floating-shell {
4
+ position: relative;
5
+ display: inline-block;
6
+ width: 100%;
7
+ vertical-align: top;
8
+ }
9
+
10
+ .cx-floating-shell__label {
11
+ position: absolute;
12
+ left: 11px;
13
+ right: 22px;
14
+ top: 50%;
15
+ transform: translateY(-50%);
16
+ transform-origin: left center;
17
+ pointer-events: none;
18
+ z-index: 2;
19
+ font-size: var(--cx-floating-label-font-size);
20
+ line-height: 1.25;
21
+ color: #6b7280;
22
+ white-space: nowrap;
23
+ overflow: hidden;
24
+ text-overflow: ellipsis;
25
+ transition:
26
+ transform 0.2s ease,
27
+ top 0.2s ease,
28
+ font-size 0.2s ease,
29
+ color 0.2s ease;
30
+ }
31
+
32
+ .dark .cx-floating-shell__label,
33
+ html.dark .cx-floating-shell__label {
34
+ color: #9ca3af;
35
+ }
36
+
37
+ .cx-floating-shell--floated .cx-floating-shell__label {
38
+ top: 5px;
39
+ transform: translateY(0) scale(0.78);
40
+ font-size: var(--cx-floating-label-font-size);
41
+ line-height: 1.25;
42
+ color: #4b5563;
43
+ }
44
+
45
+ .dark .cx-floating-shell--floated .cx-floating-shell__label,
46
+ html.dark .cx-floating-shell--floated .cx-floating-shell__label {
47
+ color: #d1d5db;
48
+ }
49
+
50
+ .cx-floating-shell__control {
51
+ position: relative;
52
+ z-index: 1;
53
+ }
54
+
55
+ /* 浮动区内:输入/选中文字比 label 更小(label 仍为 14px) */
56
+ .cx-floating-shell__control .cx-input.ant-input,
57
+ .cx-floating-shell__control .ant-select .ant-select-selector,
58
+ .cx-floating-shell__control .ant-select .ant-select-selection-item,
59
+ .cx-floating-shell__control .ant-select .ant-select-selection-placeholder,
60
+ .cx-floating-shell__control .ant-select .ant-select-selection-search-input,
61
+ .cx-floating-shell__control .ant-select .ant-select-selection-wrap,
62
+ .cx-floating-shell__control .cx-datepicker.ant-picker .ant-picker-input > input,
63
+ .cx-floating-shell__control .cx-date-picker.ant-picker .ant-picker-input > input,
64
+ .cx-floating-shell__control .cx-range-picker .ant-picker-input > input {
65
+ font-size: var(--cx-floating-control-font-size);
66
+ line-height: 1.5;
67
+ font-weight: 400;
68
+ }
69
+
70
+ /* 非浮动用 large 时 antd 会放大字号,压回与浮动区一致 */
71
+ .cx-floating-shell__control .ant-select.ant-select-lg .ant-select-selector {
72
+ font-size: var(--cx-floating-control-font-size);
73
+ }
74
+
75
+ /*
76
+ * 浮动壳内控件尺寸(不挂在 --floated 上):空且失焦时也与聚焦/有值时同一套高度与 padding,
77
+ * 避免点击瞬间切换两套样式造成「先跳高再回落」。仅 label 位置仍由 --floated 控制。
78
+ *
79
+ * - antd 6 Select:垂直 padding 在 .ant-select-content,根 .ant-select 去掉 padding-block。
80
+ * - 若仍存在内层 .ant-select-selector(旧结构),同套数值写在对应条目中。
81
+ */
82
+ .cx-floating-shell.cx-floating-shell--cxSearch
83
+ .cx-floating-shell__control
84
+ .ant-select.cx-select {
85
+ display: inline-flex !important;
86
+ align-items: center !important;
87
+ padding-top: 0 !important;
88
+ padding-bottom: 0 !important;
89
+ min-height: 49px !important;
90
+ height: 49px !important;
91
+ box-sizing: border-box !important;
92
+ }
93
+
94
+ .cx-floating-shell.cx-floating-shell--cxSearch
95
+ .cx-floating-shell__control
96
+ .ant-select.cx-select
97
+ .ant-select-content {
98
+ padding-top: 19px !important;
99
+ padding-bottom: 4px !important;
100
+ display: flex !important;
101
+ align-items: center !important;
102
+ box-sizing: border-box !important;
103
+ }
104
+
105
+ .cx-floating-shell.cx-floating-shell--cxSearch
106
+ .cx-floating-shell__control
107
+ .ant-select
108
+ .ant-select-selector {
109
+ display: flex !important;
110
+ align-items: center !important;
111
+ padding-top: 0 !important;
112
+ padding-bottom: 0 !important;
113
+ min-height: 49px !important;
114
+ height: 49px !important;
115
+ box-sizing: border-box !important;
116
+ }
117
+
118
+ .cx-floating-shell.cx-floating-shell--cxSearch
119
+ .cx-floating-shell__control
120
+ .ant-select
121
+ .ant-select-selector
122
+ .ant-select-content {
123
+ padding-top: 19px !important;
124
+ padding-bottom: 4px !important;
125
+ display: flex !important;
126
+ align-items: center !important;
127
+ box-sizing: border-box !important;
128
+ }
129
+
130
+ .cx-floating-shell.cx-floating-shell--cxSearch span.cx-input.ant-input-affix-wrapper {
131
+ display: inline-flex !important;
132
+ align-items: center !important;
133
+ padding-top: 20px !important;
134
+ padding-bottom: 5px !important;
135
+ min-height: 49px !important;
136
+ height: 49px !important;
137
+ box-sizing: border-box !important;
138
+ }
139
+
140
+ .cx-floating-shell.cx-floating-shell--cxSearch
141
+ span.cx-input.ant-input-affix-wrapper
142
+ > input.ant-input {
143
+ padding-top: 0 !important;
144
+ padding-bottom: 0 !important;
145
+ }
146
+
147
+ .cx-floating-shell.cx-floating-shell--cxSearch input.cx-input.ant-input {
148
+ padding-top: 20px !important;
149
+ padding-bottom: 5px !important;
150
+ min-height: 49px !important;
151
+ height: 49px !important;
152
+ box-sizing: border-box !important;
153
+ }
154
+
155
+ .cx-floating-shell.cx-floating-shell--cxSearch .ant-select .ant-select-selection-wrap {
156
+ align-self: center;
157
+ width: 100%;
158
+ }
159
+
160
+ .cx-floating-shell.cx-floating-shell--cxSearch .ant-select .ant-select-selection-item,
161
+ .cx-floating-shell.cx-floating-shell--cxSearch .ant-select .ant-select-selection-placeholder {
162
+ line-height: 1.35 !important;
163
+ }
164
+
165
+ .cx-floating-shell.cx-floating-shell--cxSearch .cx-datepicker.ant-picker,
166
+ .cx-floating-shell.cx-floating-shell--cxSearch .cx-date-picker.ant-picker,
167
+ .cx-floating-shell.cx-floating-shell--cxSearch .cx-range-picker.ant-picker {
168
+ padding-top: 19px !important;
169
+ padding-bottom: 4px !important;
170
+ min-height: 49px !important;
171
+ height: 49px !important;
172
+ box-sizing: border-box !important;
173
+ }
174
+
175
+ .cx-floating-shell.cx-floating-shell--cxSearch .cx-datepicker.ant-picker .ant-picker-input > input,
176
+ .cx-floating-shell.cx-floating-shell--cxSearch .cx-date-picker.ant-picker .ant-picker-input > input,
177
+ .cx-floating-shell.cx-floating-shell--cxSearch .cx-range-picker.ant-picker .ant-picker-input > input {
178
+ transform: none;
179
+ }
180
+
181
+ /* cxForm:比 Search 略高一点 */
182
+ .cx-floating-shell.cx-floating-shell--cxForm
183
+ .cx-floating-shell__control
184
+ .ant-select.cx-select {
185
+ display: inline-flex !important;
186
+ align-items: center !important;
187
+ padding-top: 0 !important;
188
+ padding-bottom: 0 !important;
189
+ min-height: 49px !important;
190
+ height: 49px !important;
191
+ box-sizing: border-box !important;
192
+ }
193
+
194
+ .cx-floating-shell.cx-floating-shell--cxForm
195
+ .cx-floating-shell__control
196
+ .ant-select.cx-select
197
+ .ant-select-content {
198
+ padding-top: 20px !important;
199
+ padding-bottom: 5px !important;
200
+ display: flex !important;
201
+ align-items: center !important;
202
+ box-sizing: border-box !important;
203
+ }
204
+
205
+ .cx-floating-shell.cx-floating-shell--cxForm
206
+ .cx-floating-shell__control
207
+ .ant-select
208
+ .ant-select-selector {
209
+ display: flex !important;
210
+ align-items: center !important;
211
+ padding-top: 0 !important;
212
+ padding-bottom: 0 !important;
213
+ min-height: 49px !important;
214
+ height: 49px !important;
215
+ box-sizing: border-box !important;
216
+ }
217
+
218
+ .cx-floating-shell.cx-floating-shell--cxForm
219
+ .cx-floating-shell__control
220
+ .ant-select
221
+ .ant-select-selector
222
+ .ant-select-content {
223
+ padding-top: 20px !important;
224
+ padding-bottom: 5px !important;
225
+ display: flex !important;
226
+ align-items: center !important;
227
+ box-sizing: border-box !important;
228
+ }
229
+
230
+ .cx-floating-shell.cx-floating-shell--cxForm span.cx-input.ant-input-affix-wrapper {
231
+ display: inline-flex !important;
232
+ align-items: center !important;
233
+ padding-top: 21px !important;
234
+ padding-bottom: 6px !important;
235
+ min-height: 49px !important;
236
+ height: 49px !important;
237
+ box-sizing: border-box !important;
238
+ }
239
+
240
+ .cx-floating-shell.cx-floating-shell--cxForm
241
+ span.cx-input.ant-input-affix-wrapper
242
+ > input.ant-input {
243
+ padding-top: 0 !important;
244
+ padding-bottom: 0 !important;
245
+ }
246
+
247
+ .cx-floating-shell.cx-floating-shell--cxForm input.cx-input.ant-input {
248
+ padding-top: 21px !important;
249
+ padding-bottom: 6px !important;
250
+ min-height: 49px !important;
251
+ height: 49px !important;
252
+ box-sizing: border-box !important;
253
+ }
254
+
255
+ .cx-floating-shell.cx-floating-shell--cxForm .ant-select .ant-select-selection-wrap {
256
+ align-self: center;
257
+ width: 100%;
258
+ }
259
+
260
+ .cx-floating-shell.cx-floating-shell--cxForm .ant-select .ant-select-selection-item,
261
+ .cx-floating-shell.cx-floating-shell--cxForm .ant-select .ant-select-selection-placeholder {
262
+ line-height: 1.35 !important;
263
+ }
264
+
265
+ .cx-floating-shell.cx-floating-shell--cxForm .cx-datepicker.ant-picker,
266
+ .cx-floating-shell.cx-floating-shell--cxForm .cx-date-picker.ant-picker,
267
+ .cx-floating-shell.cx-floating-shell--cxForm .cx-range-picker.ant-picker {
268
+ padding-top: 20px !important;
269
+ padding-bottom: 5px !important;
270
+ min-height: 49px !important;
271
+ height: 49px !important;
272
+ box-sizing: border-box !important;
273
+ }
274
+
275
+ .cx-floating-shell.cx-floating-shell--cxForm .cx-datepicker.ant-picker .ant-picker-input > input,
276
+ .cx-floating-shell.cx-floating-shell--cxForm .cx-date-picker.ant-picker .ant-picker-input > input,
277
+ .cx-floating-shell.cx-floating-shell--cxForm .cx-range-picker.ant-picker .ant-picker-input > input {
278
+ transform: none;
279
+ }
280
+
281
+ .cx-floating-shell--disabled .cx-floating-shell__label {
282
+ opacity: 0.55;
283
+ }
@@ -0,0 +1,41 @@
1
+ /** 判断 Cx 浮动标签模式下是否视为「有值」(用于抬高 label) */
2
+ export function hasCxFloatingValue(
3
+ value: unknown,
4
+ kind: 'default' | 'date' | 'range' | 'select',
5
+ ): boolean {
6
+ if (value === undefined || value === null) return false
7
+
8
+ if (kind === 'range') {
9
+ if (!Array.isArray(value)) return false
10
+ const [a, b] = value
11
+ return !!(a || b)
12
+ }
13
+
14
+ if (kind === 'date') {
15
+ if (typeof value === 'object' && value !== null) {
16
+ const d = value as { isValid?: () => boolean; format?: unknown }
17
+ if (typeof d.isValid === 'function') return d.isValid()
18
+ if (typeof d.format === 'function') return true
19
+ }
20
+ return false
21
+ }
22
+
23
+ if (kind === 'select') {
24
+ if (Array.isArray(value)) return value.length > 0
25
+ if (typeof value === 'object' && value !== null) {
26
+ const o = value as { value?: unknown; key?: unknown }
27
+ const v = o.value ?? o.key
28
+ if (v === undefined || v === null || v === '') return false
29
+ if (Array.isArray(v)) return v.length > 0
30
+ return true
31
+ }
32
+ if (typeof value === 'string') return value.trim().length > 0
33
+ if (typeof value === 'number') return !Number.isNaN(value)
34
+ return true
35
+ }
36
+
37
+ if (Array.isArray(value)) return value.length > 0
38
+ if (typeof value === 'string') return value.trim().length > 0
39
+ if (typeof value === 'number') return !Number.isNaN(value)
40
+ return true
41
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import type { Rule } from 'antd/es/form'
3
+
4
+ export type CxFormRulesMap = Record<string, Rule[]>
5
+
6
+ type CxFormContextValue = {
7
+ rules?: CxFormRulesMap
8
+ }
9
+
10
+ export const CxFormContext = React.createContext<CxFormContextValue>({})
11
+
12
+ export function useCxFormRules() {
13
+ return React.useContext(CxFormContext).rules
14
+ }
15
+