@_tc/template-core 0.4.0 → 0.4.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 (297) hide show
  1. package/.skills/tc-component-usage-skills/reference/component-api.md +27 -0
  2. package/.skills/tc-generator/SKILL.md +1 -1
  3. package/.skills/tc-generator/reference/project-template/ssr/apps/hello/hello.entry.tsx +6 -1
  4. package/.skills/tc-generator/reference/runtime-extensions.md +10 -0
  5. package/AGENT_README.md +8 -2
  6. package/CHANGE.md +27 -0
  7. package/README.md +157 -8
  8. package/cjs/app/ai/agent/agent-scanner.service.js +1 -1
  9. package/cjs/app/ai/agent/agent.module.js +1 -1
  10. package/cjs/app/ai/ai-config.module.js +1 -1
  11. package/cjs/app/ai/ai-config.service.js +1 -1
  12. package/cjs/app/ai/ai.controller.js +1 -1
  13. package/cjs/app/ai/ai.module.js +1 -1
  14. package/cjs/app/ai/guardrail/guardrail.module.js +1 -1
  15. package/cjs/app/ai/guardrail/guardrail.service.js +1 -1
  16. package/cjs/app/ai/index.js +1 -0
  17. package/cjs/app/ai/mcp/internal/read-sse-response.js +2 -0
  18. package/cjs/app/ai/mcp/internal/stdio-process.js +1 -0
  19. package/cjs/app/ai/mcp/mcp-registry.service.js +2 -2
  20. package/cjs/app/ai/mcp/mcp.client.js +2 -3
  21. package/cjs/app/ai/mcp/mcp.loader.js +1 -1
  22. package/cjs/app/ai/mcp/mcp.module.js +1 -1
  23. package/cjs/app/ai/memory/checkpoint.service.js +1 -1
  24. package/cjs/app/ai/memory/memory.module.js +1 -1
  25. package/cjs/app/ai/memory/thread.service.js +1 -1
  26. package/cjs/app/ai/models/chat-sse.js +4 -0
  27. package/cjs/app/ai/models/chat.js +1 -0
  28. package/cjs/app/ai/models/http.js +1 -0
  29. package/cjs/app/ai/models/image.js +1 -0
  30. package/cjs/app/ai/models/video.js +1 -0
  31. package/cjs/app/ai/nest-service-provider.js +1 -0
  32. package/cjs/app/ai/rag/rag.module.js +1 -1
  33. package/cjs/app/ai/rag/retriever.service.js +1 -1
  34. package/cjs/app/ai/retention/conversation-retention.service.js +1 -1
  35. package/cjs/app/ai/runtime/ai-runtime-startup.validator.js +1 -1
  36. package/cjs/app/ai/runtime/ai-runtime.js +1 -0
  37. package/cjs/app/ai/runtime/internal/context-compaction.service.js +3 -3
  38. package/cjs/app/ai/runtime/internal/declaration-snapshot.js +1 -0
  39. package/cjs/app/ai/runtime/internal/owned-runtime-resources.js +1 -0
  40. package/cjs/app/ai/runtime/langchain/langchain-planner.service.js +1 -1
  41. package/cjs/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +1 -1
  42. package/cjs/app/ai/runtime/runtime.module.js +1 -1
  43. package/cjs/app/ai/skill/skill-scanner.service.js +1 -1
  44. package/cjs/app/ai/skill/skill.module.js +1 -1
  45. package/cjs/app/ai/snapshot-data.js +1 -0
  46. package/cjs/app/ai/store/internal/create-vector-store.js +1 -0
  47. package/cjs/app/ai/store/store.module.js +1 -1
  48. package/cjs/app/ai/tool/builtin/index.js +1 -1
  49. package/cjs/app/ai/tool/builtin/invoke-agent.tool.js +1 -1
  50. package/cjs/app/ai/tool/builtin/retrieve.tool.js +1 -1
  51. package/cjs/app/ai/tool/executor.service.js +1 -1
  52. package/cjs/app/ai/tool/tool-registry.service.js +1 -1
  53. package/cjs/app/ai/tool/tool.module.js +1 -1
  54. package/cjs/app/ai/trace/trace.service.js +1 -1
  55. package/cjs/app/csr/controller.js +1 -1
  56. package/cjs/app/csr/types.js +0 -0
  57. package/cjs/app/html/browser-options.js +1 -1
  58. package/cjs/app/html/shell.js +31 -16
  59. package/cjs/app/http/api-signing.js +1 -0
  60. package/cjs/app/http/body-parser.middleware.js +1 -1
  61. package/cjs/app/http/csp-nonce.js +1 -0
  62. package/cjs/app/http/error-response.js +1 -1
  63. package/cjs/app/http/exception-filter.js +1 -1
  64. package/cjs/app/http/request-body-parser-policy.js +1 -0
  65. package/cjs/app/http/security.guard.js +1 -1
  66. package/cjs/app/project/controller.js +1 -1
  67. package/cjs/app/project/service.js +1 -1
  68. package/cjs/app/providers/foundation.js +1 -1
  69. package/cjs/app/ssr/artifacts.js +1 -1
  70. package/cjs/app/ssr/controller.js +1 -1
  71. package/cjs/app/ssr/html.js +17 -17
  72. package/cjs/app/ssr/stream.js +1 -1
  73. package/cjs/app/static-assets.middleware.js +1 -1
  74. package/cjs/app/template-core.module.js +1 -1
  75. package/cjs/app/view/entry.tpl +2 -2
  76. package/cjs/bundler/buildSSR.js +1 -1
  77. package/cjs/bundler/entryCollect.js +1 -1
  78. package/cjs/bundler/feSharedConfig.js +1 -1
  79. package/cjs/bundler/utils.js +3 -3
  80. package/cjs/config/config.default.js +1 -1
  81. package/cjs/packages/common/index.js +1 -1
  82. package/cjs/packages/core/bootstrap.js +1 -1
  83. package/cjs/packages/core/startup.js +1 -1
  84. package/esm/app/ai/agent/agent-scanner.service.js +33 -36
  85. package/esm/app/ai/agent/agent.module.js +9 -7
  86. package/esm/app/ai/ai-config.module.js +14 -7
  87. package/esm/app/ai/ai-config.service.js +24 -20
  88. package/esm/app/ai/ai.controller.js +41 -41
  89. package/esm/app/ai/ai.module.js +15 -15
  90. package/esm/app/ai/guardrail/guardrail.module.js +11 -9
  91. package/esm/app/ai/guardrail/guardrail.service.js +5 -10
  92. package/esm/app/ai/index.js +2 -0
  93. package/esm/app/ai/mcp/internal/read-sse-response.js +35 -0
  94. package/esm/app/ai/mcp/internal/stdio-process.js +59 -0
  95. package/esm/app/ai/mcp/mcp-registry.service.js +10 -15
  96. package/esm/app/ai/mcp/mcp.client.js +77 -78
  97. package/esm/app/ai/mcp/mcp.loader.js +64 -42
  98. package/esm/app/ai/mcp/mcp.module.js +62 -22
  99. package/esm/app/ai/memory/checkpoint.service.js +18 -28
  100. package/esm/app/ai/memory/memory.module.js +15 -12
  101. package/esm/app/ai/memory/thread.service.js +21 -26
  102. package/esm/app/ai/models/chat-sse.js +44 -0
  103. package/esm/app/ai/models/chat.js +60 -0
  104. package/esm/app/ai/models/http.js +52 -0
  105. package/esm/app/ai/models/image.js +37 -0
  106. package/esm/app/ai/models/video.js +32 -0
  107. package/esm/app/ai/nest-service-provider.js +10 -0
  108. package/esm/app/ai/rag/rag.module.js +24 -15
  109. package/esm/app/ai/rag/retriever.service.js +37 -54
  110. package/esm/app/ai/retention/conversation-retention.service.js +16 -34
  111. package/esm/app/ai/runtime/ai-runtime-startup.validator.js +2 -19
  112. package/esm/app/ai/runtime/ai-runtime.js +104 -0
  113. package/esm/app/ai/runtime/internal/context-compaction.service.js +139 -145
  114. package/esm/app/ai/runtime/internal/declaration-snapshot.js +32 -0
  115. package/esm/app/ai/runtime/internal/owned-runtime-resources.js +21 -0
  116. package/esm/app/ai/runtime/langchain/langchain-planner.service.js +43 -49
  117. package/esm/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +273 -225
  118. package/esm/app/ai/runtime/runtime.module.js +56 -35
  119. package/esm/app/ai/skill/skill-scanner.service.js +11 -16
  120. package/esm/app/ai/skill/skill.module.js +11 -9
  121. package/esm/app/ai/snapshot-data.js +24 -0
  122. package/esm/app/ai/store/internal/create-vector-store.js +10 -0
  123. package/esm/app/ai/store/store.module.js +9 -13
  124. package/esm/app/ai/tool/builtin/index.js +16 -4
  125. package/esm/app/ai/tool/builtin/invoke-agent.tool.js +30 -34
  126. package/esm/app/ai/tool/builtin/retrieve.tool.js +9 -13
  127. package/esm/app/ai/tool/executor.service.js +22 -29
  128. package/esm/app/ai/tool/tool-registry.service.js +6 -16
  129. package/esm/app/ai/tool/tool.module.js +26 -12
  130. package/esm/app/ai/trace/trace.service.js +15 -28
  131. package/esm/app/csr/controller.js +114 -63
  132. package/esm/app/csr/types.js +0 -0
  133. package/esm/app/html/browser-options.js +2 -2
  134. package/esm/app/html/shell.js +173 -32
  135. package/esm/app/http/api-signing.js +13 -0
  136. package/esm/app/http/body-parser.middleware.js +47 -27
  137. package/esm/app/http/csp-nonce.js +13 -0
  138. package/esm/app/http/error-response.js +8 -5
  139. package/esm/app/http/exception-filter.js +4 -4
  140. package/esm/app/http/request-body-parser-policy.js +46 -0
  141. package/esm/app/http/security.guard.js +23 -21
  142. package/esm/app/project/controller.js +15 -15
  143. package/esm/app/project/service.js +3 -3
  144. package/esm/app/providers/foundation.js +5 -5
  145. package/esm/app/ssr/artifacts.js +25 -21
  146. package/esm/app/ssr/controller.js +148 -75
  147. package/esm/app/ssr/html.js +49 -44
  148. package/esm/app/ssr/stream.js +25 -24
  149. package/esm/app/static-assets.middleware.js +4 -4
  150. package/esm/app/template-core.module.js +57 -52
  151. package/esm/app/view/entry.tpl +2 -2
  152. package/esm/bundler/buildSSR.js +1 -1
  153. package/esm/bundler/entryCollect.js +9 -9
  154. package/esm/bundler/feSharedConfig.js +42 -42
  155. package/esm/bundler/utils.js +78 -90
  156. package/esm/config/config.default.js +4 -3
  157. package/esm/packages/common/index.js +6 -6
  158. package/esm/packages/core/bootstrap.js +5 -5
  159. package/esm/packages/core/startup.js +69 -46
  160. package/fe/frontend/src/common/request.js +5 -2
  161. package/fe/frontend/src/hooks/useRouterParams.d.ts +4 -2
  162. package/fe/packages/common/ssr/hydration.d.ts +9 -0
  163. package/fe/packages/react/core/Label/Label.d.ts +1 -0
  164. package/fe/packages/react/core/Label/Label.js +3 -1
  165. package/fe/packages/react/core/internal/i18n/default.d.ts +13 -0
  166. package/fe/packages/react/core/internal/i18n/default.js +16 -1
  167. package/fe/packages/react/core/internal/i18n/en-US.d.ts +13 -0
  168. package/fe/packages/react/core/internal/i18n/en-US.js +16 -1
  169. package/fe/packages/react/forms/DataTable/index.d.ts +2 -0
  170. package/fe/packages/react/forms/DataTable/index.js +43 -29
  171. package/fe/packages/react/forms/Form/FormItem.js +39 -12
  172. package/fe/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
  173. package/fe/packages/react/forms/MultiSelect/MultiSelect.js +218 -0
  174. package/fe/packages/react/forms/MultiSelect/index.d.ts +1 -0
  175. package/fe/packages/react/forms/MultiSelect/index.js +2 -0
  176. package/fe/packages/react/forms/Pagination/Pagination.d.ts +6 -1
  177. package/fe/packages/react/forms/Pagination/Pagination.js +13 -4
  178. package/fe/packages/react/forms/Select/Select.d.ts +11 -0
  179. package/fe/packages/react/forms/Select/Select.js +20 -7
  180. package/fe/packages/react/forms/index.d.ts +1 -0
  181. package/fe/packages/react/forms/index.js +3 -1
  182. package/fe/packages/react/i18n/getUiReactLocale.d.ts +26 -0
  183. package/fe/packages/react/index.js +2 -1
  184. package/fe/packages/react/overlays/Drawer/Drawer.d.ts +3 -2
  185. package/fe/packages/react/overlays/Drawer/Drawer.js +16 -2
  186. package/fe/packages/react/overlays/Dropdown/Dropdown.d.ts +12 -2
  187. package/fe/packages/react/overlays/Dropdown/Dropdown.js +27 -14
  188. package/fe/packages/react/overlays/Modal/Modal.d.ts +11 -3
  189. package/fe/packages/react/overlays/Modal/Modal.js +26 -2
  190. package/fe/packages/react/overlays/Modal/ModalManager.d.ts +13 -12
  191. package/fe/packages/react/overlays/Modal/ModalManager.js +15 -5
  192. package/fe/packages/react/overlays/Modal/index.d.ts +1 -0
  193. package/fe/packages/react/overlays/Overlay/Overlay.d.ts +6 -2
  194. package/fe/packages/react/overlays/Overlay/Overlay.js +31 -14
  195. package/fe/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
  196. package/fe/packages/react/overlays/Overlay/focusTypes.js +0 -0
  197. package/fe/packages/react/overlays/Overlay/index.d.ts +1 -0
  198. package/fe/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
  199. package/fe/packages/react/overlays/Overlay/overlayStack.js +290 -0
  200. package/fe/packages/react/overlays/Popup/Popup.d.ts +5 -4
  201. package/fe/packages/react/overlays/Popup/Popup.js +28 -11
  202. package/fe/packages/react/ui/components/index.js +2 -1
  203. package/fe/packages/react/ui/index.js +2 -1
  204. package/fe/ssr/components/StreamingRender/StreamingCache.d.ts +1 -0
  205. package/fe/ssr/components/StreamingRender/StreamingCache.js +5 -1
  206. package/fe/ssr/components/StreamingRender/StreamingRender.js +1 -1
  207. package/fe/ssr/components/StreamingRender/StreamingScript.d.ts +1 -0
  208. package/fe/ssr/components/StreamingRender/StreamingScript.js +9 -1
  209. package/fe/ssr/createSSREntry.d.ts +9 -3
  210. package/fe/ssr/createSSREntry.js +43 -19
  211. package/fe/ssr/index.d.ts +4 -1
  212. package/fe/ssr/index.js +2 -1
  213. package/fe/ssr/router.d.ts +76 -0
  214. package/fe/ssr/router.js +349 -0
  215. package/fe/ssr/types.d.ts +1 -1
  216. package/models/packages/common/ssr/hydration.d.ts +9 -0
  217. package/models/packages/react/core/Label/Label.d.ts +1 -0
  218. package/models/packages/react/core/internal/i18n/default.d.ts +13 -0
  219. package/models/packages/react/core/internal/i18n/en-US.d.ts +13 -0
  220. package/models/packages/react/forms/DataTable/index.d.ts +2 -0
  221. package/models/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
  222. package/models/packages/react/forms/MultiSelect/index.d.ts +1 -0
  223. package/models/packages/react/forms/Pagination/Pagination.d.ts +6 -1
  224. package/models/packages/react/forms/Select/Select.d.ts +11 -0
  225. package/models/packages/react/forms/index.d.ts +1 -0
  226. package/models/packages/react/i18n/getUiReactLocale.d.ts +26 -0
  227. package/models/packages/react/overlays/Drawer/Drawer.d.ts +3 -2
  228. package/models/packages/react/overlays/Dropdown/Dropdown.d.ts +12 -2
  229. package/models/packages/react/overlays/Modal/Modal.d.ts +11 -3
  230. package/models/packages/react/overlays/Modal/ModalManager.d.ts +13 -12
  231. package/models/packages/react/overlays/Modal/index.d.ts +1 -0
  232. package/models/packages/react/overlays/Overlay/Overlay.d.ts +6 -2
  233. package/models/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
  234. package/models/packages/react/overlays/Overlay/index.d.ts +1 -0
  235. package/models/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
  236. package/models/packages/react/overlays/Popup/Popup.d.ts +5 -4
  237. package/package.json +26 -1
  238. package/types/app/ai/agent/agent-scanner.service.d.ts +4 -4
  239. package/types/app/ai/ai-config.service.d.ts +7 -3
  240. package/types/app/ai/guardrail/guardrail.service.d.ts +2 -2
  241. package/types/app/ai/index.d.ts +9 -0
  242. package/types/app/ai/mcp/internal/load-mcp-config.d.ts +2 -2
  243. package/types/app/ai/mcp/internal/read-sse-response.d.ts +2 -0
  244. package/types/app/ai/mcp/internal/stdio-process.d.ts +5 -0
  245. package/types/app/ai/mcp/mcp-registry.service.d.ts +5 -3
  246. package/types/app/ai/mcp/mcp.client.d.ts +7 -4
  247. package/types/app/ai/mcp/mcp.loader.d.ts +11 -11
  248. package/types/app/ai/mcp/mcp.module.d.ts +5 -5
  249. package/types/app/ai/memory/thread.service.d.ts +3 -3
  250. package/types/app/ai/models/chat-sse.d.ts +5 -0
  251. package/types/app/ai/models/chat.d.ts +22 -0
  252. package/types/app/ai/models/http.d.ts +20 -0
  253. package/types/app/ai/models/image.d.ts +69 -0
  254. package/types/app/ai/models/video.d.ts +99 -0
  255. package/types/app/ai/nest-service-provider.d.ts +6 -0
  256. package/types/app/ai/retention/conversation-retention.service.d.ts +3 -4
  257. package/types/app/ai/runtime/ai-runtime-startup.validator.d.ts +2 -3
  258. package/types/app/ai/runtime/ai-runtime.d.ts +46 -0
  259. package/types/app/ai/runtime/internal/agent-run-context.d.ts +4 -0
  260. package/types/app/ai/runtime/internal/context-compaction.service.d.ts +2 -2
  261. package/types/app/ai/runtime/internal/declaration-snapshot.d.ts +8 -0
  262. package/types/app/ai/runtime/internal/owned-runtime-resources.d.ts +5 -0
  263. package/types/app/ai/runtime/langchain/langchain-planner.service.d.ts +1 -1
  264. package/types/app/ai/runtime/langgraph/langgraph-orchestrator.service.d.ts +33 -16
  265. package/types/app/ai/skill/skill-scanner.service.d.ts +3 -4
  266. package/types/app/ai/snapshot-data.d.ts +1 -0
  267. package/types/app/ai/store/internal/create-vector-store.d.ts +4 -0
  268. package/types/app/ai/tool/builtin/index.d.ts +1 -1
  269. package/types/app/ai/tool/builtin/invoke-agent.tool.d.ts +10 -3
  270. package/types/app/ai/tool/builtin/retrieve.tool.d.ts +4 -3
  271. package/types/app/ai/tool/executor.service.d.ts +3 -3
  272. package/types/app/ai/tool/tool-registry.service.d.ts +2 -7
  273. package/types/app/ai/tool/tool.interface.d.ts +1 -1
  274. package/types/app/ai/tool/tool.module.d.ts +8 -1
  275. package/types/app/ai/trace/trace.service.d.ts +4 -5
  276. package/types/app/csr/types.d.ts +10 -0
  277. package/types/app/html/browser-options.d.ts +1 -1
  278. package/types/app/html/shell.d.ts +37 -10
  279. package/types/app/http/api-signing.d.ts +16 -0
  280. package/types/app/http/body-parser.middleware.d.ts +6 -2
  281. package/types/app/http/csp-nonce.d.ts +3 -0
  282. package/types/app/http/error-response.d.ts +1 -0
  283. package/types/app/http/request-body-parser-policy.d.ts +8 -0
  284. package/types/app/http/security.guard.d.ts +1 -0
  285. package/types/app/ssr/artifacts.d.ts +6 -3
  286. package/types/app/ssr/html.d.ts +7 -0
  287. package/types/app/ssr/stream.d.ts +1 -1
  288. package/types/app/ssr/types.d.ts +56 -0
  289. package/types/bundler/buildSSR.d.ts +2 -1
  290. package/types/bundler/index.d.ts +1 -1
  291. package/types/bundler/state.d.ts +13 -0
  292. package/types/bundler/utils.d.ts +3 -14
  293. package/types/config/config.default.d.ts +9 -3
  294. package/types/index.d.ts +4 -1
  295. package/types/packages/common/ssr/hydration.d.ts +13 -0
  296. package/types/packages/core/index.d.ts +1 -1
  297. package/types/packages/core/startup.d.ts +41 -0
@@ -6,16 +6,35 @@ import { assertRouteBasePathNotConflict as i, normalizeRouteBasePath as a } from
6
6
  import { findLegacyFactoryFiles as o } from "./legacy-factory-diagnostics.js";
7
7
  import { ResourceLifecycle as s } from "./resource-lifecycle.js";
8
8
  import { TC_CRYPTO as c, TC_DATABASE as l, TC_HTML_ETAG_CACHE as u, TC_HTTP_CLIENT as d, TC_LOGGER as f, TC_TEMPLATE_ENV as p, TC_VIEW_RENDERER as m } from "./tokens.js";
9
- import { Injectable as h, Scope as g } from "@nestjs/common";
10
- import _ from "node:path";
11
- import v from "@oxc-project/runtime/helpers/decorateMetadata";
12
- import y from "@oxc-project/runtime/helpers/decorate";
9
+ import h from "node:path";
10
+ import { Injectable as g, Scope as _ } from "@nestjs/common";
11
+ import v from "@oxc-project/runtime/helpers/decorate";
12
+ import y from "@oxc-project/runtime/helpers/decorateMetadata";
13
13
  //#region packages/core/startup.ts
14
- var b, x, S = [
14
+ var b, x;
15
+ function S(e) {
16
+ return !!e && typeof e == "object" && !Array.isArray(e);
17
+ }
18
+ function C(e) {
19
+ if (!S(e)) return;
20
+ let t = {};
21
+ if (typeof e.lang == "string" && e.lang.trim() && (t.lang = e.lang.trim()), S(e.theme)) {
22
+ let n = {};
23
+ (e.theme.default === "light" || e.theme.default === "dark" || e.theme.default === "system") && (n.default = e.theme.default), typeof e.theme.storageKey == "string" && e.theme.storageKey.trim() && (n.storageKey = e.theme.storageKey), typeof e.theme.storageValuePath == "string" && e.theme.storageValuePath.trim() && (n.storageValuePath = e.theme.storageValuePath.trim()), Object.keys(n).length && (t.theme = n);
24
+ }
25
+ typeof e.viewportContent == "string" && e.viewportContent.trim() && (t.viewportContent = e.viewportContent);
26
+ for (let n of ["meta", "link"]) Array.isArray(e[n]) && (t[n] = e[n].filter(S).map((e) => ({ ...e })));
27
+ if (S(e.body)) {
28
+ let n = {};
29
+ typeof e.body.class == "string" && (n.class = e.body.class), typeof e.body.style == "string" && (n.style = e.body.style), Object.keys(n).length && (t.body = n);
30
+ }
31
+ return Object.keys(t).length ? t : void 0;
32
+ }
33
+ var w = [
15
34
  "onModuleDestroy",
16
35
  "beforeApplicationShutdown",
17
36
  "onApplicationShutdown"
18
- ], C = class {
37
+ ], T = class {
19
38
  lifecycle = new s();
20
39
  resources = /* @__PURE__ */ new Set();
21
40
  closed = /* @__PURE__ */ new Set();
@@ -68,11 +87,11 @@ var b, x, S = [
68
87
  async release(e) {
69
88
  if (this.closed.has(e)) return;
70
89
  let t = this.lifecycle.manage(e);
71
- if (S.some((e) => typeof t[e] == "function")) {
90
+ if (w.some((e) => typeof t[e] == "function")) {
72
91
  if (!this.includeNestLifecycle) return;
73
92
  this.closed.add(e);
74
93
  let n = [];
75
- for (let e of S) {
94
+ for (let e of w) {
76
95
  let r = t[e];
77
96
  if (typeof r == "function") try {
78
97
  await r.call(t);
@@ -87,49 +106,49 @@ var b, x, S = [
87
106
  let n = typeof t.closeDB == "function" ? t.closeDB : t.close;
88
107
  n && (this.closed.add(e), await n.call(t));
89
108
  }
90
- }, w = /* @__PURE__ */ new WeakMap();
91
- function T(e, t) {
92
- let n = w.get(e);
109
+ }, E = /* @__PURE__ */ new WeakMap();
110
+ function D(e, t) {
111
+ let n = E.get(e);
93
112
  if (!n) throw Error("[core] Startup resources cannot be tracked before configuration is initialized");
94
113
  return n.track(t);
95
114
  }
96
- function E(e, t) {
97
- let n = w.get(e);
115
+ function O(e, t) {
116
+ let n = E.get(e);
98
117
  if (!n) throw Error("[core] Startup resources cannot be tracked before configuration is initialized");
99
118
  return n.trackPromise(t);
100
119
  }
101
- function D(e) {
102
- let t = w.get(e);
120
+ function k(e) {
121
+ let t = E.get(e);
103
122
  if (!t) throw Error("[core] Startup resources cannot be tracked before configuration is initialized");
104
123
  t.assertOpen();
105
124
  }
106
- function O(e, t) {
107
- D(e);
125
+ function A(e, t) {
126
+ k(e);
108
127
  let n = t();
109
- return n && typeof n == "object" && "then" in n && typeof n.then == "function" ? E(e, Promise.resolve(n)) : T(e, n);
128
+ return n && typeof n == "object" && "then" in n && typeof n.then == "function" ? O(e, Promise.resolve(n)) : D(e, n);
110
129
  }
111
- function k(e, t = !1) {
112
- return w.get(e)?.close(t) ?? Promise.resolve();
130
+ function j(e, t = !1) {
131
+ return E.get(e)?.close(t) ?? Promise.resolve();
113
132
  }
114
- var A = class {
133
+ var M = class {
115
134
  application;
116
135
  constructor(e, t, n, r, i) {
117
- this.options = e, this.environment = t, this.config = n, this.port = r, this.host = i, w.set(this, new C());
136
+ this.options = e, this.environment = t, this.config = n, this.port = r, this.host = i, E.set(this, new T());
118
137
  }
119
- }, j = class {
138
+ }, N = class {
120
139
  businessAppPath;
121
140
  frameAppPath;
122
141
  publicPaths;
123
142
  constructor(e) {
124
- this.startup = e, this.businessAppPath = _.join(e.options.baseDir, "app"), this.frameAppPath = _.join(e.options.frameBaseDir, "app"), this.publicPaths = [
125
- _.join(this.businessAppPath, "public"),
126
- _.join(this.frameAppPath, "public"),
143
+ this.startup = e, this.businessAppPath = h.join(e.options.baseDir, "app"), this.frameAppPath = h.join(e.options.frameBaseDir, "app"), this.publicPaths = [
144
+ h.join(this.businessAppPath, "public"),
145
+ h.join(this.frameAppPath, "public"),
127
146
  ...e.options.additionalPublicPaths
128
147
  ];
129
148
  }
130
149
  };
131
- j = y([h(), v("design:paramtypes", [typeof (b = A !== void 0 && A) == "function" ? b : Object])], j);
132
- var M = class {
150
+ N = v([g(), y("design:paramtypes", [typeof (b = M !== void 0 && M) == "function" ? b : Object])], N);
151
+ var P = class {
133
152
  constructor(e) {
134
153
  this.paths = e;
135
154
  }
@@ -148,17 +167,18 @@ var M = class {
148
167
  return e;
149
168
  }
150
169
  };
151
- M = y([h(), v("design:paramtypes", [typeof (x = j !== void 0 && j) == "function" ? x : Object])], M);
152
- var N = Symbol.for("tc:runtime-constructor"), P = globalThis, F = P[N] ??= M;
153
- function I(e) {
170
+ P = v([g(), y("design:paramtypes", [typeof (x = N !== void 0 && N) == "function" ? x : Object])], P);
171
+ var F = Symbol.for("tc:runtime-constructor"), I = globalThis, L = I[F] ??= P;
172
+ function R(e) {
154
173
  let t = e.businessModules ?? [];
155
- if (!Array.isArray(t) || t.some((e) => !R(e))) throw Error("[core] businessModules must contain Nest Module classes or DynamicModule declarations");
156
- let n = L(e.providerOverrides ?? []), r = e.additionalPublicPaths ?? [], s = Array.isArray(r) ? [...r] : [r];
157
- if (s.some((e) => typeof e != "string" || !_.isAbsolute(e))) throw Error("[core] additionalPublicPaths must contain absolute directory paths");
174
+ if (!Array.isArray(t) || t.some((e) => !B(e))) throw Error("[core] businessModules must contain Nest Module classes or DynamicModule declarations");
175
+ let n = z(e.providerOverrides ?? []), r = e.additionalPublicPaths ?? [], s = Array.isArray(r) ? [...r] : [r];
176
+ if (s.some((e) => typeof e != "string" || !h.isAbsolute(e))) throw Error("[core] additionalPublicPaths must contain absolute directory paths");
158
177
  let c = {
159
178
  ...e,
160
- baseDir: _.resolve(e.baseDir ?? process.cwd()),
161
- frameBaseDir: _.resolve(e.frameBaseDir ?? process.cwd()),
179
+ html: C(e.html),
180
+ baseDir: h.resolve(e.baseDir ?? process.cwd()),
181
+ frameBaseDir: h.resolve(e.frameBaseDir ?? process.cwd()),
162
182
  apiPrefix: a(e.apiPrefix || "/api"),
163
183
  pageBasePath: a(e.pageBasePath, "/"),
164
184
  ssrPageBasePath: a(e.ssrPageBasePath, "/fessr"),
@@ -169,14 +189,17 @@ function I(e) {
169
189
  i(c.pageBasePath, c.ssrPageBasePath);
170
190
  let l = o(c.baseDir);
171
191
  if (l.length) {
172
- let e = l.map((e) => _.relative(c.baseDir, e)).join(", ");
192
+ let e = l.map((e) => h.relative(c.baseDir, e)).join(", ");
173
193
  throw Error(`[core] Legacy factory files are not executed by Nest: ${e}. Register native Nest modules through businessModules.`);
174
194
  }
175
- let u = process.env._ENV ?? "local", d = z(c, u), f = Number.parseInt(String(d.port ?? (process.env.PORT || "8080")), 10);
176
- if (!Number.isInteger(f) || f < 0 || f > 65535) throw Error(`[core] Invalid port: ${f}`);
177
- return new A(c, u, d, f, process.env.IP || "0.0.0.0");
195
+ let u = process.env._ENV ?? "local", d = V(c, u), f = Object.prototype.hasOwnProperty.call(d, "html") ? {
196
+ ...d,
197
+ html: C(d.html)
198
+ } : d, p = Number.parseInt(String(f.port ?? (process.env.PORT || "8080")), 10);
199
+ if (!Number.isInteger(p) || p < 0 || p > 65535) throw Error(`[core] Invalid port: ${p}`);
200
+ return new M(c, u, f, p, process.env.IP || "0.0.0.0");
178
201
  }
179
- function L(e) {
202
+ function z(e) {
180
203
  if (!Array.isArray(e)) throw Error("[core] providerOverrides must be an array");
181
204
  let t = new Set([
182
205
  l,
@@ -211,16 +234,16 @@ function L(e) {
211
234
  "function"
212
235
  ].includes(typeof t) || t === i) throw Error(`[core] Provider override ${i} useExisting must reference a different Nest injection token`);
213
236
  }
214
- if ("scope" in e && e.scope !== void 0 && e.scope !== g.DEFAULT) throw Error(`[core] Provider override ${i} must use the application default scope`);
237
+ if ("scope" in e && e.scope !== void 0 && e.scope !== _.DEFAULT) throw Error(`[core] Provider override ${i} must use the application default scope`);
215
238
  }
216
239
  return [...e];
217
240
  }
218
- function R(e) {
241
+ function B(e) {
219
242
  return typeof e == "function" || !!e && typeof e == "object" && "module" in e && typeof e.module == "function";
220
243
  }
221
- function z(i, a) {
244
+ function V(i, a) {
222
245
  let o = [i.frameBaseDir, i.baseDir].map((e) => n(e, "config")), s = {}, c = /* @__PURE__ */ new Set();
223
- for (let e of ["default", a]) for (let n of o) for (let i of n.filter((t) => [`config.${e}.js`, `config.${e}.ts`].includes(_.basename(t)))) try {
246
+ for (let e of ["default", a]) for (let n of o) for (let i of n.filter((t) => [`config.${e}.js`, `config.${e}.ts`].includes(h.basename(t)))) try {
224
247
  let n = r(i);
225
248
  if (!n || typeof n != "object" || Array.isArray(n)) throw Error("Expected an exported configuration object");
226
249
  s = t(s, n), c.add(e);
@@ -230,4 +253,4 @@ function z(i, a) {
230
253
  return c.has("default") || console.error(`[core] Missing default configuration in ${i.frameBaseDir} and ${i.baseDir}`), c.has(a) || console.error(`[core] Missing ${a} configuration in ${i.frameBaseDir} and ${i.baseDir}`), e(s);
231
254
  }
232
255
  //#endregion
233
- export { j as RuntimePaths, A as StartupConfiguration, F as TemplateCoreRuntime, D as assertStartupResourcesOpen, k as closeStartupResources, I as resolveStartupOptions, O as runStartupFactory, E as trackStartupPromise, T as trackStartupResource };
256
+ export { N as RuntimePaths, M as StartupConfiguration, L as TemplateCoreRuntime, k as assertStartupResourcesOpen, j as closeStartupResources, R as resolveStartupOptions, A as runStartupFactory, O as trackStartupPromise, D as trackStartupResource };
@@ -100,12 +100,15 @@ api.interceptors.request.use(async (config) => {
100
100
  const token = getAuthToken();
101
101
  const aauto = getApiAuth();
102
102
  const time = (/* @__PURE__ */ new Date()).getTime();
103
+ const signKey = window["_signKey"];
103
104
  config.headers = {
104
105
  "Content-Type": "application/json",
105
106
  ...config.headers,
106
107
  [LANGUAGE_HEADER_KEY]: getCurrentLanguage(),
107
- s_t: time + "",
108
- s_sign: md5(`${window["_signKey"]}_${time}`),
108
+ ...signKey ? {
109
+ s_t: time + "",
110
+ s_sign: md5(`${signKey}_${time}`)
111
+ } : {},
109
112
  [API_AUTH_HEADER_KEY]: aauto
110
113
  };
111
114
  if (token) config.headers = {
@@ -1,4 +1,6 @@
1
- declare const useRouterParams: <T extends Record<string, string>>() => Readonly<[T] extends [string] ? import("react-router-dom").Params<T> : Partial<T>> & {
2
- custk?: string | undefined;
1
+ import { QK } from "../common/menu";
2
+ import { useParams } from "react-router-dom";
3
+ declare const useRouterParams: <T extends Record<string, string>>() => ReturnType<typeof useParams<T>> & {
4
+ [QK.ck]?: string;
3
5
  };
4
6
  export default useRouterParams;
@@ -8,6 +8,15 @@ export interface SSRPageMeta {
8
8
  description?: string;
9
9
  renderedAt: number;
10
10
  pathname: string;
11
+ page?: string;
12
+ buildKey?: string | null;
13
+ entry?: string | null;
14
+ head?: SSRHydrationHead;
15
+ }
16
+ export interface SSRHydrationHead {
17
+ meta?: Record<string, string | number | boolean | null | undefined>[];
18
+ link?: Record<string, string | number | boolean | null | undefined>[];
19
+ jsonLd?: unknown[];
11
20
  }
12
21
  export declare const SSR_DATA_KEY = "__SSR_DATA__";
13
22
  declare global {
@@ -13,6 +13,7 @@ export type LabelProps = {
13
13
  children: ReactNode;
14
14
  required?: boolean;
15
15
  htmlFor?: string;
16
+ id?: string;
16
17
  className?: string;
17
18
  labelClassName?: string;
18
19
  contentClassName?: string;
@@ -8,7 +8,7 @@ var labelAlignStyles = {
8
8
  center: "text-center"
9
9
  };
10
10
  var Label = forwardRef((props, ref) => {
11
- const { label, children, layout = "vertical", required = false, htmlFor, className, labelClassName, contentClassName } = props;
11
+ const { label, children, layout = "vertical", required = false, htmlFor, id, className, labelClassName, contentClassName } = props;
12
12
  const isVertical = layout === "vertical";
13
13
  const labelStyles = cn("text-sm font-medium text-foreground", required && "before:content-['*'] before:pt-1 before:mr-0.5 before:text-destructive", labelClassName);
14
14
  const { usedClassName, labelWidth } = useMemo(() => {
@@ -28,6 +28,7 @@ var Label = forwardRef((props, ref) => {
28
28
  ref,
29
29
  className: cn("tc-ui-label flex flex-col gap-2", className),
30
30
  children: [/* @__PURE__ */ jsx("label", {
31
+ id,
31
32
  htmlFor,
32
33
  className: labelStyles,
33
34
  children: label
@@ -40,6 +41,7 @@ var Label = forwardRef((props, ref) => {
40
41
  ref,
41
42
  className: cn("tc-ui-label flex items-center gap-4", className),
42
43
  children: [/* @__PURE__ */ jsx("label", {
44
+ id,
43
45
  htmlFor,
44
46
  className: cn(labelStyles, usedClassName),
45
47
  style: {
@@ -11,6 +11,11 @@ export declare const defaultLanguageResources: {
11
11
  readonly breadcrumb: {
12
12
  readonly close: "关闭";
13
13
  };
14
+ readonly pagination: {
15
+ readonly previousPage: "上一页";
16
+ readonly nextPage: "下一页";
17
+ readonly pageSize: "每页条数";
18
+ };
14
19
  readonly confirmDialog: {
15
20
  readonly title: "提示";
16
21
  readonly okText: "确认";
@@ -18,6 +23,8 @@ export declare const defaultLanguageResources: {
18
23
  };
19
24
  readonly dataTable: {
20
25
  readonly noData: "暂无数据";
26
+ readonly selectAll: "全选行";
27
+ readonly selectRow: "选择行";
21
28
  };
22
29
  readonly date: {
23
30
  readonly placeholder: "请选择日期";
@@ -62,6 +69,12 @@ export declare const defaultLanguageResources: {
62
69
  readonly okText: "确认";
63
70
  readonly cancelText: "取消";
64
71
  };
72
+ readonly multiSelect: {
73
+ readonly removeOption: "移除{label}";
74
+ readonly clear: "清除选择";
75
+ readonly search: "搜索";
76
+ readonly searchOptions: "搜索选项";
77
+ };
65
78
  readonly message: {
66
79
  readonly close: "关闭";
67
80
  };
@@ -17,12 +17,21 @@ var defaultLanguageResources = {
17
17
  /** UI 组件内置文案,按组件名分组。 */
18
18
  components: {
19
19
  breadcrumb: { close: "关闭" },
20
+ pagination: {
21
+ previousPage: "上一页",
22
+ nextPage: "下一页",
23
+ pageSize: "每页条数"
24
+ },
20
25
  confirmDialog: {
21
26
  title: "提示",
22
27
  okText: "确认",
23
28
  cancelText: "取消"
24
29
  },
25
- dataTable: { noData: "暂无数据" },
30
+ dataTable: {
31
+ noData: "暂无数据",
32
+ selectAll: "全选行",
33
+ selectRow: "选择行"
34
+ },
26
35
  date: {
27
36
  placeholder: "请选择日期",
28
37
  placeholderDateTime: "请选择日期时间",
@@ -75,6 +84,12 @@ var defaultLanguageResources = {
75
84
  okText: "确认",
76
85
  cancelText: "取消"
77
86
  },
87
+ multiSelect: {
88
+ removeOption: "移除{label}",
89
+ clear: "清除选择",
90
+ search: "搜索",
91
+ searchOptions: "搜索选项"
92
+ },
78
93
  message: { close: "关闭" },
79
94
  select: { empty: "暂无选项" },
80
95
  tableSearch: {
@@ -11,6 +11,11 @@ export declare const defaultEnglishResources: {
11
11
  readonly breadcrumb: {
12
12
  readonly close: "Close";
13
13
  };
14
+ readonly pagination: {
15
+ readonly previousPage: "Previous page";
16
+ readonly nextPage: "Next page";
17
+ readonly pageSize: "Items per page";
18
+ };
14
19
  readonly confirmDialog: {
15
20
  readonly title: "Prompt";
16
21
  readonly okText: "Confirm";
@@ -18,6 +23,8 @@ export declare const defaultEnglishResources: {
18
23
  };
19
24
  readonly dataTable: {
20
25
  readonly noData: "No Data";
26
+ readonly selectAll: "Select all rows";
27
+ readonly selectRow: "Select row";
21
28
  };
22
29
  readonly date: {
23
30
  readonly placeholder: "Select date";
@@ -62,6 +69,12 @@ export declare const defaultEnglishResources: {
62
69
  readonly okText: "Confirm";
63
70
  readonly cancelText: "Cancel";
64
71
  };
72
+ readonly multiSelect: {
73
+ readonly removeOption: "Remove {label}";
74
+ readonly clear: "Clear selection";
75
+ readonly search: "Search";
76
+ readonly searchOptions: "Search options";
77
+ };
65
78
  readonly message: {
66
79
  readonly close: "Close";
67
80
  };
@@ -17,12 +17,21 @@ var defaultEnglishResources = {
17
17
  /** UI 组件内置文案,按组件名分组。 */
18
18
  components: {
19
19
  breadcrumb: { close: "Close" },
20
+ pagination: {
21
+ previousPage: "Previous page",
22
+ nextPage: "Next page",
23
+ pageSize: "Items per page"
24
+ },
20
25
  confirmDialog: {
21
26
  title: "Prompt",
22
27
  okText: "Confirm",
23
28
  cancelText: "Cancel"
24
29
  },
25
- dataTable: { noData: "No Data" },
30
+ dataTable: {
31
+ noData: "No Data",
32
+ selectAll: "Select all rows",
33
+ selectRow: "Select row"
34
+ },
26
35
  date: {
27
36
  placeholder: "Select date",
28
37
  placeholderDateTime: "Select date and time",
@@ -75,6 +84,12 @@ var defaultEnglishResources = {
75
84
  okText: "Confirm",
76
85
  cancelText: "Cancel"
77
86
  },
87
+ multiSelect: {
88
+ removeOption: "Remove {label}",
89
+ clear: "Clear selection",
90
+ search: "Search",
91
+ searchOptions: "Search options"
92
+ },
78
93
  message: { close: "Close" },
79
94
  select: { empty: "No options" },
80
95
  tableSearch: {
@@ -1,4 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
+ import { type CheckboxProps } from "../../core/Checkbox/index";
2
3
  import type { DropdownItem } from "../../overlays/Dropdown/index";
3
4
  import { type PaginationProps } from "../Pagination";
4
5
  import { type TableFixed } from "../table/index";
@@ -16,6 +17,7 @@ type RowSelection<T> = {
16
17
  onChange?: (selectedRowKeys: Array<string | number>, selectedRows: T[], isAll: boolean) => void;
17
18
  isAll?: boolean;
18
19
  beforeCheckboxNode?: ReactNode;
20
+ getCheckboxProps?: (record: T) => Pick<CheckboxProps, 'disabled' | 'aria-label' | 'aria-labelledby'>;
19
21
  };
20
22
  interface DataTableProps<T = Record<string, unknown>> {
21
23
  columns: TableColumnDef<T>[];
@@ -73,9 +73,17 @@ function DataTable({ columns, data: pData, loading, rowKey = defaultRowKey, rowS
73
73
  pData,
74
74
  pPagination
75
75
  ]);
76
- const pageRowKeys = data.map((record, index) => getRowKey(record, pageStartIndex + index, rowKey));
76
+ const pageRows = data.map((record, index) => ({
77
+ record,
78
+ key: getRowKey(record, pageStartIndex + index, rowKey)
79
+ }));
80
+ const getRowSelectionProps = (record) => rowSelection?.getCheckboxProps?.(record) ?? {};
81
+ const pageSelectableRowKeys = pageRows.filter(({ record }) => !getRowSelectionProps(record).disabled).map(({ key }) => key);
82
+ const selectedPageKeys = pageSelectableRowKeys.filter((key) => selectedKeySet.has(key));
77
83
  const handleRowSelectChange = (key) => {
78
84
  if (!rowSelection) return;
85
+ const record = pData.find((item, index) => getRowKey(item, index, rowKey) === key);
86
+ if (record && getRowSelectionProps(record).disabled) return;
79
87
  const nextSelectedKeys = selectedKeySet.has(key) ? selectedRowKeys.filter((k) => k !== key) : [...selectedRowKeys, key];
80
88
  const nextSelectedKeySet = new Set(nextSelectedKeys);
81
89
  const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index, rowKey)));
@@ -87,10 +95,10 @@ function DataTable({ columns, data: pData, loading, rowKey = defaultRowKey, rowS
87
95
  const checked = event.target.checked;
88
96
  let nextSelectedKeys;
89
97
  if (checked) {
90
- const pageKeySet = new Set(pageRowKeys);
91
- nextSelectedKeys = Array.from(new Set([...selectedRowKeys, ...pageRowKeys.filter((key) => !selectedKeySet.has(key))])).filter((key) => pageKeySet.has(key) || selectedKeySet.has(key));
98
+ const pageKeySet = new Set(pageSelectableRowKeys);
99
+ nextSelectedKeys = Array.from(new Set([...selectedRowKeys, ...pageSelectableRowKeys.filter((key) => !selectedKeySet.has(key))])).filter((key) => pageKeySet.has(key) || selectedKeySet.has(key));
92
100
  } else {
93
- const pageKeySet = new Set(pageRowKeys);
101
+ const pageKeySet = new Set(pageSelectableRowKeys);
94
102
  nextSelectedKeys = selectedRowKeys.filter((key) => !pageKeySet.has(key));
95
103
  }
96
104
  const nextSelectedKeySet = new Set(nextSelectedKeys);
@@ -98,8 +106,8 @@ function DataTable({ columns, data: pData, loading, rowKey = defaultRowKey, rowS
98
106
  if (!isControlled) setInnerSelectedRowKeys(nextSelectedKeys);
99
107
  rowSelection.onChange?.(nextSelectedKeys, selectedRows, checked);
100
108
  };
101
- const allChecked = rowSelection ? rowSelection.isAll ?? (pageRowKeys.length > 0 && pageRowKeys.every((key) => selectedKeySet.has(key))) : false;
102
- const partiallyChecked = rowSelection ? pageRowKeys.some((key) => selectedKeySet.has(key)) && !allChecked : false;
109
+ const allChecked = rowSelection ? rowSelection.isAll ?? (pageSelectableRowKeys.length > 0 && pageSelectableRowKeys.every((key) => selectedKeySet.has(key))) : false;
110
+ const partiallyChecked = rowSelection ? selectedPageKeys.length > 0 && !allChecked : false;
103
111
  const fixedColumns = useMemo(() => {
104
112
  const columnsWithFixed = columns.map((column, index) => {
105
113
  const hasAction = column.isAction ?? column.key === "action";
@@ -149,7 +157,8 @@ function DataTable({ columns, data: pData, loading, rowKey = defaultRowKey, rowS
149
157
  },
150
158
  children: [rowSelection.beforeCheckboxNode, /* @__PURE__ */ jsx(Checkbox, {
151
159
  checked: allChecked,
152
- "aria-label": "Select all rows",
160
+ disabled: pageSelectableRowKeys.length === 0,
161
+ "aria-label": t("components.dataTable.selectAll"),
153
162
  indeterminate: partiallyChecked,
154
163
  onChange: (_, event) => handleSelectAllChange(event)
155
164
  })]
@@ -175,28 +184,33 @@ function DataTable({ columns, data: pData, loading, rowKey = defaultRowKey, rowS
175
184
  })
176
185
  }) }) : data.map((record, rowIndex) => {
177
186
  const recordKey = getRowKey(record, pageStartIndex + rowIndex, rowKey);
178
- return /* @__PURE__ */ jsxs(TableRow, { children: [rowSelection && /* @__PURE__ */ jsx(TableCell, {
179
- fixed: "left",
180
- style: {
181
- width: rowSelectionColumnWidthStyle,
182
- minWidth: rowSelectionColumnWidthStyle
183
- },
184
- children: /* @__PURE__ */ jsx(Checkbox, {
185
- checked: selectedKeySet.has(recordKey),
186
- "aria-label": "Select row",
187
- onChange: () => handleRowSelectChange(recordKey)
188
- })
189
- }), fixedColumns.map(({ column, fixed, fixedOffset }) => {
190
- const value = getCellValue(record, column);
191
- const hasAction = column.isAction ?? column.key === "action";
192
- return /* @__PURE__ */ jsx(TableCell, {
193
- isAction: hasAction,
194
- fixed,
195
- fixedOffset,
196
- style: getDataTableColumnStyle(column, defaultColumnWidth, actionColumnWidth),
197
- children: renderCellContent(column, value, record, rowIndex, hasAction)
198
- }, column.key);
199
- })] }, recordKey);
187
+ const checkboxProps = getRowSelectionProps(record);
188
+ return /* @__PURE__ */ jsxs(TableRow, {
189
+ "data-state": selectedKeySet.has(recordKey) ? "selected" : void 0,
190
+ children: [rowSelection && /* @__PURE__ */ jsx(TableCell, {
191
+ fixed: "left",
192
+ style: {
193
+ width: rowSelectionColumnWidthStyle,
194
+ minWidth: rowSelectionColumnWidthStyle
195
+ },
196
+ children: /* @__PURE__ */ jsx(Checkbox, {
197
+ ...checkboxProps,
198
+ checked: selectedKeySet.has(recordKey),
199
+ "aria-label": checkboxProps["aria-label"] ?? t("components.dataTable.selectRow"),
200
+ onChange: () => handleRowSelectChange(recordKey)
201
+ })
202
+ }), fixedColumns.map(({ column, fixed, fixedOffset }) => {
203
+ const value = getCellValue(record, column);
204
+ const hasAction = column.isAction ?? column.key === "action";
205
+ return /* @__PURE__ */ jsx(TableCell, {
206
+ isAction: hasAction,
207
+ fixed,
208
+ fixedOffset,
209
+ style: getDataTableColumnStyle(column, defaultColumnWidth, actionColumnWidth),
210
+ children: renderCellContent(column, value, record, rowIndex, hasAction)
211
+ }, column.key);
212
+ })]
213
+ }, recordKey);
200
214
  }) })]
201
215
  }), showPagination && /* @__PURE__ */ jsx("div", {
202
216
  className: "px-6 pb-6 mt-6",
@@ -1,30 +1,56 @@
1
1
  import { cn } from "../../core/lib/utils.js";
2
2
  import { Label } from "../../core/Label/Label.js";
3
3
  import "../../core/Label/index.js";
4
- import React, { forwardRef } from "react";
4
+ import React, { forwardRef, useId } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Field } from "rc-field-form";
7
7
  //#region packages/react/forms/Form/FormItem.tsx
8
+ function setRef(ref, value) {
9
+ if (typeof ref === "function") ref(value);
10
+ else if (ref) ref.current = value;
11
+ }
12
+ function mergeRefs(...refs) {
13
+ const activeRefs = refs.filter((ref) => Boolean(ref));
14
+ if (activeRefs.length === 0) return void 0;
15
+ if (activeRefs.length === 1) return activeRefs[0];
16
+ return (value) => activeRefs.forEach((ref) => setRef(ref, value));
17
+ }
18
+ function getNameId(name) {
19
+ if (typeof name === "string" || typeof name === "number") return String(name);
20
+ if (Array.isArray(name) && name.length > 0) return name.map(String).join("_");
21
+ }
8
22
  var FormItemFN = forwardRef(({ className, label, labelClassName, required, children, errorClassName, showError = true, name, rules, layout, ...props }, ref) => {
23
+ const generatedId = useId().replace(/:/g, "");
9
24
  return /* @__PURE__ */ jsx(Field, {
10
25
  name,
11
26
  rules,
12
27
  ...props,
13
28
  children: (control, meta) => {
14
- const { value, onChange, ...restControl } = control;
29
+ const { value, onChange, ref: fieldRef, ...restControl } = control;
15
30
  const { errors, warnings } = meta;
16
31
  const hasError = errors.length > 0;
17
32
  const hasWarning = warnings.length > 0;
18
33
  const childNode = typeof children === "function" ? children(value, onChange, meta) : children;
19
- const childWithProps = childNode && typeof childNode === "object" && "props" in childNode ? React.cloneElement(childNode, {
20
- value,
21
- onChange: (val) => {
22
- if (typeof val === "string") onChange(val);
23
- else if (val?.target?.value !== void 0) onChange(val.target.value);
24
- else onChange(val);
25
- },
26
- ...restControl
27
- }) : childNode;
34
+ const childProps = React.isValidElement(childNode) ? childNode.props : void 0;
35
+ const controlId = (typeof childProps?.id === "string" && childProps.id ? childProps.id : void 0) ?? getNameId(name) ?? `tc-form-item-${generatedId}`;
36
+ const labelId = label ? `${controlId}-label` : void 0;
37
+ const labelledBy = [typeof childProps?.["aria-labelledby"] === "string" ? childProps["aria-labelledby"] : void 0, labelId].filter(Boolean).join(" ") || void 0;
38
+ const childWithProps = React.isValidElement(childNode) ? (() => {
39
+ const childRef = childProps?.ref;
40
+ const mergedRef = mergeRefs(fieldRef, childRef);
41
+ return React.cloneElement(childNode, {
42
+ ...restControl,
43
+ value,
44
+ onChange: (val) => {
45
+ if (typeof val === "string") onChange(val);
46
+ else if (val?.target?.value !== void 0) onChange(val.target.value);
47
+ else onChange(val);
48
+ },
49
+ id: controlId,
50
+ "aria-labelledby": labelledBy,
51
+ ref: mergedRef
52
+ });
53
+ })() : childNode;
28
54
  const content = /* @__PURE__ */ jsx("div", {
29
55
  className: hasError || hasWarning ? "relative" : "",
30
56
  children: childWithProps
@@ -34,7 +60,8 @@ var FormItemFN = forwardRef(({ className, label, labelClassName, required, child
34
60
  className: cn("tc-ui-form-item", className),
35
61
  children: [
36
62
  label ? /* @__PURE__ */ jsx(Label, {
37
- htmlFor: name,
63
+ id: labelId,
64
+ htmlFor: controlId,
38
65
  label,
39
66
  layout,
40
67
  required,