@_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.
- package/.skills/tc-component-usage-skills/reference/component-api.md +27 -0
- package/.skills/tc-generator/SKILL.md +1 -1
- package/.skills/tc-generator/reference/project-template/ssr/apps/hello/hello.entry.tsx +6 -1
- package/.skills/tc-generator/reference/runtime-extensions.md +10 -0
- package/AGENT_README.md +8 -2
- package/CHANGE.md +27 -0
- package/README.md +157 -8
- package/cjs/app/ai/agent/agent-scanner.service.js +1 -1
- package/cjs/app/ai/agent/agent.module.js +1 -1
- package/cjs/app/ai/ai-config.module.js +1 -1
- package/cjs/app/ai/ai-config.service.js +1 -1
- package/cjs/app/ai/ai.controller.js +1 -1
- package/cjs/app/ai/ai.module.js +1 -1
- package/cjs/app/ai/guardrail/guardrail.module.js +1 -1
- package/cjs/app/ai/guardrail/guardrail.service.js +1 -1
- package/cjs/app/ai/index.js +1 -0
- package/cjs/app/ai/mcp/internal/read-sse-response.js +2 -0
- package/cjs/app/ai/mcp/internal/stdio-process.js +1 -0
- package/cjs/app/ai/mcp/mcp-registry.service.js +2 -2
- package/cjs/app/ai/mcp/mcp.client.js +2 -3
- package/cjs/app/ai/mcp/mcp.loader.js +1 -1
- package/cjs/app/ai/mcp/mcp.module.js +1 -1
- package/cjs/app/ai/memory/checkpoint.service.js +1 -1
- package/cjs/app/ai/memory/memory.module.js +1 -1
- package/cjs/app/ai/memory/thread.service.js +1 -1
- package/cjs/app/ai/models/chat-sse.js +4 -0
- package/cjs/app/ai/models/chat.js +1 -0
- package/cjs/app/ai/models/http.js +1 -0
- package/cjs/app/ai/models/image.js +1 -0
- package/cjs/app/ai/models/video.js +1 -0
- package/cjs/app/ai/nest-service-provider.js +1 -0
- package/cjs/app/ai/rag/rag.module.js +1 -1
- package/cjs/app/ai/rag/retriever.service.js +1 -1
- package/cjs/app/ai/retention/conversation-retention.service.js +1 -1
- package/cjs/app/ai/runtime/ai-runtime-startup.validator.js +1 -1
- package/cjs/app/ai/runtime/ai-runtime.js +1 -0
- package/cjs/app/ai/runtime/internal/context-compaction.service.js +3 -3
- package/cjs/app/ai/runtime/internal/declaration-snapshot.js +1 -0
- package/cjs/app/ai/runtime/internal/owned-runtime-resources.js +1 -0
- package/cjs/app/ai/runtime/langchain/langchain-planner.service.js +1 -1
- package/cjs/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +1 -1
- package/cjs/app/ai/runtime/runtime.module.js +1 -1
- package/cjs/app/ai/skill/skill-scanner.service.js +1 -1
- package/cjs/app/ai/skill/skill.module.js +1 -1
- package/cjs/app/ai/snapshot-data.js +1 -0
- package/cjs/app/ai/store/internal/create-vector-store.js +1 -0
- package/cjs/app/ai/store/store.module.js +1 -1
- package/cjs/app/ai/tool/builtin/index.js +1 -1
- package/cjs/app/ai/tool/builtin/invoke-agent.tool.js +1 -1
- package/cjs/app/ai/tool/builtin/retrieve.tool.js +1 -1
- package/cjs/app/ai/tool/executor.service.js +1 -1
- package/cjs/app/ai/tool/tool-registry.service.js +1 -1
- package/cjs/app/ai/tool/tool.module.js +1 -1
- package/cjs/app/ai/trace/trace.service.js +1 -1
- package/cjs/app/csr/controller.js +1 -1
- package/cjs/app/csr/types.js +0 -0
- package/cjs/app/html/browser-options.js +1 -1
- package/cjs/app/html/shell.js +31 -16
- package/cjs/app/http/api-signing.js +1 -0
- package/cjs/app/http/body-parser.middleware.js +1 -1
- package/cjs/app/http/csp-nonce.js +1 -0
- package/cjs/app/http/error-response.js +1 -1
- package/cjs/app/http/exception-filter.js +1 -1
- package/cjs/app/http/request-body-parser-policy.js +1 -0
- package/cjs/app/http/security.guard.js +1 -1
- package/cjs/app/project/controller.js +1 -1
- package/cjs/app/project/service.js +1 -1
- package/cjs/app/providers/foundation.js +1 -1
- package/cjs/app/ssr/artifacts.js +1 -1
- package/cjs/app/ssr/controller.js +1 -1
- package/cjs/app/ssr/html.js +17 -17
- package/cjs/app/ssr/stream.js +1 -1
- package/cjs/app/static-assets.middleware.js +1 -1
- package/cjs/app/template-core.module.js +1 -1
- package/cjs/app/view/entry.tpl +2 -2
- package/cjs/bundler/buildSSR.js +1 -1
- package/cjs/bundler/entryCollect.js +1 -1
- package/cjs/bundler/feSharedConfig.js +1 -1
- package/cjs/bundler/utils.js +3 -3
- package/cjs/config/config.default.js +1 -1
- package/cjs/packages/common/index.js +1 -1
- package/cjs/packages/core/bootstrap.js +1 -1
- package/cjs/packages/core/startup.js +1 -1
- package/esm/app/ai/agent/agent-scanner.service.js +33 -36
- package/esm/app/ai/agent/agent.module.js +9 -7
- package/esm/app/ai/ai-config.module.js +14 -7
- package/esm/app/ai/ai-config.service.js +24 -20
- package/esm/app/ai/ai.controller.js +41 -41
- package/esm/app/ai/ai.module.js +15 -15
- package/esm/app/ai/guardrail/guardrail.module.js +11 -9
- package/esm/app/ai/guardrail/guardrail.service.js +5 -10
- package/esm/app/ai/index.js +2 -0
- package/esm/app/ai/mcp/internal/read-sse-response.js +35 -0
- package/esm/app/ai/mcp/internal/stdio-process.js +59 -0
- package/esm/app/ai/mcp/mcp-registry.service.js +10 -15
- package/esm/app/ai/mcp/mcp.client.js +77 -78
- package/esm/app/ai/mcp/mcp.loader.js +64 -42
- package/esm/app/ai/mcp/mcp.module.js +62 -22
- package/esm/app/ai/memory/checkpoint.service.js +18 -28
- package/esm/app/ai/memory/memory.module.js +15 -12
- package/esm/app/ai/memory/thread.service.js +21 -26
- package/esm/app/ai/models/chat-sse.js +44 -0
- package/esm/app/ai/models/chat.js +60 -0
- package/esm/app/ai/models/http.js +52 -0
- package/esm/app/ai/models/image.js +37 -0
- package/esm/app/ai/models/video.js +32 -0
- package/esm/app/ai/nest-service-provider.js +10 -0
- package/esm/app/ai/rag/rag.module.js +24 -15
- package/esm/app/ai/rag/retriever.service.js +37 -54
- package/esm/app/ai/retention/conversation-retention.service.js +16 -34
- package/esm/app/ai/runtime/ai-runtime-startup.validator.js +2 -19
- package/esm/app/ai/runtime/ai-runtime.js +104 -0
- package/esm/app/ai/runtime/internal/context-compaction.service.js +139 -145
- package/esm/app/ai/runtime/internal/declaration-snapshot.js +32 -0
- package/esm/app/ai/runtime/internal/owned-runtime-resources.js +21 -0
- package/esm/app/ai/runtime/langchain/langchain-planner.service.js +43 -49
- package/esm/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +273 -225
- package/esm/app/ai/runtime/runtime.module.js +56 -35
- package/esm/app/ai/skill/skill-scanner.service.js +11 -16
- package/esm/app/ai/skill/skill.module.js +11 -9
- package/esm/app/ai/snapshot-data.js +24 -0
- package/esm/app/ai/store/internal/create-vector-store.js +10 -0
- package/esm/app/ai/store/store.module.js +9 -13
- package/esm/app/ai/tool/builtin/index.js +16 -4
- package/esm/app/ai/tool/builtin/invoke-agent.tool.js +30 -34
- package/esm/app/ai/tool/builtin/retrieve.tool.js +9 -13
- package/esm/app/ai/tool/executor.service.js +22 -29
- package/esm/app/ai/tool/tool-registry.service.js +6 -16
- package/esm/app/ai/tool/tool.module.js +26 -12
- package/esm/app/ai/trace/trace.service.js +15 -28
- package/esm/app/csr/controller.js +114 -63
- package/esm/app/csr/types.js +0 -0
- package/esm/app/html/browser-options.js +2 -2
- package/esm/app/html/shell.js +173 -32
- package/esm/app/http/api-signing.js +13 -0
- package/esm/app/http/body-parser.middleware.js +47 -27
- package/esm/app/http/csp-nonce.js +13 -0
- package/esm/app/http/error-response.js +8 -5
- package/esm/app/http/exception-filter.js +4 -4
- package/esm/app/http/request-body-parser-policy.js +46 -0
- package/esm/app/http/security.guard.js +23 -21
- package/esm/app/project/controller.js +15 -15
- package/esm/app/project/service.js +3 -3
- package/esm/app/providers/foundation.js +5 -5
- package/esm/app/ssr/artifacts.js +25 -21
- package/esm/app/ssr/controller.js +148 -75
- package/esm/app/ssr/html.js +49 -44
- package/esm/app/ssr/stream.js +25 -24
- package/esm/app/static-assets.middleware.js +4 -4
- package/esm/app/template-core.module.js +57 -52
- package/esm/app/view/entry.tpl +2 -2
- package/esm/bundler/buildSSR.js +1 -1
- package/esm/bundler/entryCollect.js +9 -9
- package/esm/bundler/feSharedConfig.js +42 -42
- package/esm/bundler/utils.js +78 -90
- package/esm/config/config.default.js +4 -3
- package/esm/packages/common/index.js +6 -6
- package/esm/packages/core/bootstrap.js +5 -5
- package/esm/packages/core/startup.js +69 -46
- package/fe/frontend/src/common/request.js +5 -2
- package/fe/frontend/src/hooks/useRouterParams.d.ts +4 -2
- package/fe/packages/common/ssr/hydration.d.ts +9 -0
- package/fe/packages/react/core/Label/Label.d.ts +1 -0
- package/fe/packages/react/core/Label/Label.js +3 -1
- package/fe/packages/react/core/internal/i18n/default.d.ts +13 -0
- package/fe/packages/react/core/internal/i18n/default.js +16 -1
- package/fe/packages/react/core/internal/i18n/en-US.d.ts +13 -0
- package/fe/packages/react/core/internal/i18n/en-US.js +16 -1
- package/fe/packages/react/forms/DataTable/index.d.ts +2 -0
- package/fe/packages/react/forms/DataTable/index.js +43 -29
- package/fe/packages/react/forms/Form/FormItem.js +39 -12
- package/fe/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
- package/fe/packages/react/forms/MultiSelect/MultiSelect.js +218 -0
- package/fe/packages/react/forms/MultiSelect/index.d.ts +1 -0
- package/fe/packages/react/forms/MultiSelect/index.js +2 -0
- package/fe/packages/react/forms/Pagination/Pagination.d.ts +6 -1
- package/fe/packages/react/forms/Pagination/Pagination.js +13 -4
- package/fe/packages/react/forms/Select/Select.d.ts +11 -0
- package/fe/packages/react/forms/Select/Select.js +20 -7
- package/fe/packages/react/forms/index.d.ts +1 -0
- package/fe/packages/react/forms/index.js +3 -1
- package/fe/packages/react/i18n/getUiReactLocale.d.ts +26 -0
- package/fe/packages/react/index.js +2 -1
- package/fe/packages/react/overlays/Drawer/Drawer.d.ts +3 -2
- package/fe/packages/react/overlays/Drawer/Drawer.js +16 -2
- package/fe/packages/react/overlays/Dropdown/Dropdown.d.ts +12 -2
- package/fe/packages/react/overlays/Dropdown/Dropdown.js +27 -14
- package/fe/packages/react/overlays/Modal/Modal.d.ts +11 -3
- package/fe/packages/react/overlays/Modal/Modal.js +26 -2
- package/fe/packages/react/overlays/Modal/ModalManager.d.ts +13 -12
- package/fe/packages/react/overlays/Modal/ModalManager.js +15 -5
- package/fe/packages/react/overlays/Modal/index.d.ts +1 -0
- package/fe/packages/react/overlays/Overlay/Overlay.d.ts +6 -2
- package/fe/packages/react/overlays/Overlay/Overlay.js +31 -14
- package/fe/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
- package/fe/packages/react/overlays/Overlay/focusTypes.js +0 -0
- package/fe/packages/react/overlays/Overlay/index.d.ts +1 -0
- package/fe/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
- package/fe/packages/react/overlays/Overlay/overlayStack.js +290 -0
- package/fe/packages/react/overlays/Popup/Popup.d.ts +5 -4
- package/fe/packages/react/overlays/Popup/Popup.js +28 -11
- package/fe/packages/react/ui/components/index.js +2 -1
- package/fe/packages/react/ui/index.js +2 -1
- package/fe/ssr/components/StreamingRender/StreamingCache.d.ts +1 -0
- package/fe/ssr/components/StreamingRender/StreamingCache.js +5 -1
- package/fe/ssr/components/StreamingRender/StreamingRender.js +1 -1
- package/fe/ssr/components/StreamingRender/StreamingScript.d.ts +1 -0
- package/fe/ssr/components/StreamingRender/StreamingScript.js +9 -1
- package/fe/ssr/createSSREntry.d.ts +9 -3
- package/fe/ssr/createSSREntry.js +43 -19
- package/fe/ssr/index.d.ts +4 -1
- package/fe/ssr/index.js +2 -1
- package/fe/ssr/router.d.ts +76 -0
- package/fe/ssr/router.js +349 -0
- package/fe/ssr/types.d.ts +1 -1
- package/models/packages/common/ssr/hydration.d.ts +9 -0
- package/models/packages/react/core/Label/Label.d.ts +1 -0
- package/models/packages/react/core/internal/i18n/default.d.ts +13 -0
- package/models/packages/react/core/internal/i18n/en-US.d.ts +13 -0
- package/models/packages/react/forms/DataTable/index.d.ts +2 -0
- package/models/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
- package/models/packages/react/forms/MultiSelect/index.d.ts +1 -0
- package/models/packages/react/forms/Pagination/Pagination.d.ts +6 -1
- package/models/packages/react/forms/Select/Select.d.ts +11 -0
- package/models/packages/react/forms/index.d.ts +1 -0
- package/models/packages/react/i18n/getUiReactLocale.d.ts +26 -0
- package/models/packages/react/overlays/Drawer/Drawer.d.ts +3 -2
- package/models/packages/react/overlays/Dropdown/Dropdown.d.ts +12 -2
- package/models/packages/react/overlays/Modal/Modal.d.ts +11 -3
- package/models/packages/react/overlays/Modal/ModalManager.d.ts +13 -12
- package/models/packages/react/overlays/Modal/index.d.ts +1 -0
- package/models/packages/react/overlays/Overlay/Overlay.d.ts +6 -2
- package/models/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
- package/models/packages/react/overlays/Overlay/index.d.ts +1 -0
- package/models/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
- package/models/packages/react/overlays/Popup/Popup.d.ts +5 -4
- package/package.json +26 -1
- package/types/app/ai/agent/agent-scanner.service.d.ts +4 -4
- package/types/app/ai/ai-config.service.d.ts +7 -3
- package/types/app/ai/guardrail/guardrail.service.d.ts +2 -2
- package/types/app/ai/index.d.ts +9 -0
- package/types/app/ai/mcp/internal/load-mcp-config.d.ts +2 -2
- package/types/app/ai/mcp/internal/read-sse-response.d.ts +2 -0
- package/types/app/ai/mcp/internal/stdio-process.d.ts +5 -0
- package/types/app/ai/mcp/mcp-registry.service.d.ts +5 -3
- package/types/app/ai/mcp/mcp.client.d.ts +7 -4
- package/types/app/ai/mcp/mcp.loader.d.ts +11 -11
- package/types/app/ai/mcp/mcp.module.d.ts +5 -5
- package/types/app/ai/memory/thread.service.d.ts +3 -3
- package/types/app/ai/models/chat-sse.d.ts +5 -0
- package/types/app/ai/models/chat.d.ts +22 -0
- package/types/app/ai/models/http.d.ts +20 -0
- package/types/app/ai/models/image.d.ts +69 -0
- package/types/app/ai/models/video.d.ts +99 -0
- package/types/app/ai/nest-service-provider.d.ts +6 -0
- package/types/app/ai/retention/conversation-retention.service.d.ts +3 -4
- package/types/app/ai/runtime/ai-runtime-startup.validator.d.ts +2 -3
- package/types/app/ai/runtime/ai-runtime.d.ts +46 -0
- package/types/app/ai/runtime/internal/agent-run-context.d.ts +4 -0
- package/types/app/ai/runtime/internal/context-compaction.service.d.ts +2 -2
- package/types/app/ai/runtime/internal/declaration-snapshot.d.ts +8 -0
- package/types/app/ai/runtime/internal/owned-runtime-resources.d.ts +5 -0
- package/types/app/ai/runtime/langchain/langchain-planner.service.d.ts +1 -1
- package/types/app/ai/runtime/langgraph/langgraph-orchestrator.service.d.ts +33 -16
- package/types/app/ai/skill/skill-scanner.service.d.ts +3 -4
- package/types/app/ai/snapshot-data.d.ts +1 -0
- package/types/app/ai/store/internal/create-vector-store.d.ts +4 -0
- package/types/app/ai/tool/builtin/index.d.ts +1 -1
- package/types/app/ai/tool/builtin/invoke-agent.tool.d.ts +10 -3
- package/types/app/ai/tool/builtin/retrieve.tool.d.ts +4 -3
- package/types/app/ai/tool/executor.service.d.ts +3 -3
- package/types/app/ai/tool/tool-registry.service.d.ts +2 -7
- package/types/app/ai/tool/tool.interface.d.ts +1 -1
- package/types/app/ai/tool/tool.module.d.ts +8 -1
- package/types/app/ai/trace/trace.service.d.ts +4 -5
- package/types/app/csr/types.d.ts +10 -0
- package/types/app/html/browser-options.d.ts +1 -1
- package/types/app/html/shell.d.ts +37 -10
- package/types/app/http/api-signing.d.ts +16 -0
- package/types/app/http/body-parser.middleware.d.ts +6 -2
- package/types/app/http/csp-nonce.d.ts +3 -0
- package/types/app/http/error-response.d.ts +1 -0
- package/types/app/http/request-body-parser-policy.d.ts +8 -0
- package/types/app/http/security.guard.d.ts +1 -0
- package/types/app/ssr/artifacts.d.ts +6 -3
- package/types/app/ssr/html.d.ts +7 -0
- package/types/app/ssr/stream.d.ts +1 -1
- package/types/app/ssr/types.d.ts +56 -0
- package/types/bundler/buildSSR.d.ts +2 -1
- package/types/bundler/index.d.ts +1 -1
- package/types/bundler/state.d.ts +13 -0
- package/types/bundler/utils.d.ts +3 -14
- package/types/config/config.default.d.ts +9 -3
- package/types/index.d.ts +4 -1
- package/types/packages/common/ssr/hydration.d.ts +13 -0
- package/types/packages/core/index.d.ts +1 -1
- 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
|
|
10
|
-
import _ from "
|
|
11
|
-
import v from "@oxc-project/runtime/helpers/
|
|
12
|
-
import y from "@oxc-project/runtime/helpers/
|
|
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
|
|
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
|
-
],
|
|
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 (
|
|
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
|
|
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
|
-
},
|
|
91
|
-
function
|
|
92
|
-
let n =
|
|
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
|
|
97
|
-
let n =
|
|
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
|
|
102
|
-
let t =
|
|
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
|
|
107
|
-
|
|
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" ?
|
|
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
|
|
112
|
-
return
|
|
130
|
+
function j(e, t = !1) {
|
|
131
|
+
return E.get(e)?.close(t) ?? Promise.resolve();
|
|
113
132
|
}
|
|
114
|
-
var
|
|
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,
|
|
136
|
+
this.options = e, this.environment = t, this.config = n, this.port = r, this.host = i, E.set(this, new T());
|
|
118
137
|
}
|
|
119
|
-
},
|
|
138
|
+
}, N = class {
|
|
120
139
|
businessAppPath;
|
|
121
140
|
frameAppPath;
|
|
122
141
|
publicPaths;
|
|
123
142
|
constructor(e) {
|
|
124
|
-
this.startup = e, this.businessAppPath =
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
132
|
-
var
|
|
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
|
-
|
|
152
|
-
var
|
|
153
|
-
function
|
|
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) => !
|
|
156
|
-
let n =
|
|
157
|
-
if (s.some((e) => typeof e != "string" || !
|
|
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
|
-
|
|
161
|
-
|
|
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) =>
|
|
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 =
|
|
176
|
-
|
|
177
|
-
|
|
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
|
|
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 !==
|
|
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
|
|
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
|
|
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(
|
|
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 {
|
|
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
|
-
|
|
108
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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 {
|
|
@@ -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: {
|
|
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: {
|
|
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
|
|
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(
|
|
91
|
-
nextSelectedKeys = Array.from(new Set([...selectedRowKeys, ...
|
|
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(
|
|
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 ?? (
|
|
102
|
-
const partiallyChecked = rowSelection ?
|
|
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
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
63
|
+
id: labelId,
|
|
64
|
+
htmlFor: controlId,
|
|
38
65
|
label,
|
|
39
66
|
layout,
|
|
40
67
|
required,
|