@nocobase/plugin-ai 2.1.0-beta.14 → 2.1.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/ai-employees/atlas/index.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/ai-coding/prompt.js → ai/ai-employees/atlas/index.js} +29 -20
- package/dist/ai/ai-employees/atlas/prompt.md +84 -0
- package/dist/ai/ai-employees/dara.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/data-visualization/prompt.js → ai/ai-employees/dara.js} +21 -13
- package/dist/ai/ai-employees/dex.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/data-organizer/prompt.js → ai/ai-employees/dex.js} +15 -7
- package/dist/ai/ai-employees/ellis.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/email-assistant/prompt.js → ai/ai-employees/ellis.js} +19 -11
- package/dist/ai/ai-employees/lexi.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/translator/prompt.js → ai/ai-employees/lexi.js} +15 -7
- package/dist/ai/ai-employees/vera.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/research-analyst/prompt.js → ai/ai-employees/vera.js} +16 -8
- package/dist/ai/ai-employees/viz.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/insights-analyst/prompt.js → ai/ai-employees/viz.js} +15 -7
- package/dist/ai/skills/business-analysis-report/SKILLS.md +88 -0
- package/dist/{server/ai-employees/built-in/ai-coding/prompt.d.ts → ai/skills/business-analysis-report/tools/businessReportGenerator.d.ts} +1 -3
- package/dist/ai/skills/business-analysis-report/tools/businessReportGenerator.js +98 -0
- package/dist/ai/skills/document-search/SKILLS.md +69 -0
- package/dist/ai/tools/chartGenerator.js +15 -3
- package/dist/ai/tools/formFiller.js +13 -2
- package/dist/{server/ai-employees/built-in/data-modeling/prompt.d.ts → ai/tools/getSkill.d.ts} +1 -3
- package/dist/{server/ai-employees/built-in/data-modeling/index.js → ai/tools/getSkill.js} +39 -32
- package/dist/{server/ai-employees/built-in/data-organizer/prompt.d.ts → ai/tools/knowledge-base-retrieve.d.ts} +1 -3
- package/dist/ai/tools/knowledge-base-retrieve.js +94 -0
- package/dist/{server/ai-employees/built-in/data-visualization/prompt.d.ts → ai/tools/sub-agents/dispatch-sub-agent-task.d.ts} +1 -3
- package/dist/ai/tools/sub-agents/dispatch-sub-agent-task.js +108 -0
- package/dist/ai/tools/sub-agents/get-ai-employee.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/translator/profile.js → ai/tools/sub-agents/get-ai-employee.js} +28 -21
- package/dist/ai/tools/sub-agents/list-ai-employees.d.ts +10 -0
- package/dist/{server/ai-employees/built-in/email-assistant/profile.js → ai/tools/sub-agents/list-ai-employees.js} +25 -21
- package/dist/ai/tools/sub-agents/shared.d.ts +33 -0
- package/dist/ai/tools/sub-agents/shared.js +169 -0
- package/dist/ai/tools/suggestions.js +15 -4
- package/dist/client/170.d98eacdc00d9d527.js +10 -0
- package/dist/client/228.b18148eb1009d2fb.js +10 -0
- package/dist/client/280.029428b83d62155f.js +10 -0
- package/dist/client/290.0888139e33c9b7cb.js +10 -0
- package/dist/client/{524.954f96ec4fc2fd7a.js → 331.d547c95410476a69.js} +1 -1
- package/dist/client/343.83f7d96664e4e038.js +10 -0
- package/dist/client/406.15c09d98faa2ccf1.js +10 -0
- package/dist/client/428.e9f38da3b0d8b498.js +10 -0
- package/dist/client/486.77c26e2e7f8daf28.js +10 -0
- package/dist/client/502.2b4a51e0a8122e52.js +10 -0
- package/dist/client/525.33a9c8ec28be4ec4.js +10 -0
- package/dist/client/559.133d286a0a0a1d93.js +10 -0
- package/dist/client/{91.90e7098b7fbd5d00.js → 561.776886c5308e3c26.js} +1 -1
- package/dist/client/580.e75f97fb883ad042.js +10 -0
- package/dist/client/597.aa363881a325b5c0.js +10 -0
- package/dist/client/604.de96f3ec4d471afd.js +10 -0
- package/dist/client/614.aa766080f6b99aab.js +10 -0
- package/dist/client/646.ef9d7c2ea8641044.js +10 -0
- package/dist/client/687.224e569a99cae4bb.js +10 -0
- package/dist/client/699.57c0a1acb723202a.js +10 -0
- package/dist/client/711.266b8f1c520d467a.js +10 -0
- package/dist/client/758.a9741e81911e53c3.js +10 -0
- package/dist/client/768.973ce32e15099a48.js +10 -0
- package/dist/client/792.ae8ad1fcae9fd974.js +10 -0
- package/dist/client/820.6a26239ea96c075a.js +10 -0
- package/dist/client/832.0cf69e3f43c320b2.js +10 -0
- package/dist/client/927.ff5cd05b14901ae6.js +10 -0
- package/dist/client/ai-employees/admin/SkillSettings.d.ts +7 -5
- package/dist/client/ai-employees/admin/ToolsSettings.d.ts +17 -0
- package/dist/client/ai-employees/admin/mcp/MCPSettings.d.ts +10 -0
- package/dist/client/ai-employees/admin/mcp/MCPToolsList.d.ts +19 -0
- package/dist/client/ai-employees/admin/mcp/context.d.ts +15 -0
- package/dist/client/ai-employees/admin/mcp/schemas.d.ts +1286 -0
- package/dist/client/ai-employees/built-in/utils.d.ts +1 -0
- package/dist/client/ai-employees/business-report/tools/index.d.ts +10 -0
- package/dist/client/ai-employees/business-report/ui/BusinessReportCard.d.ts +12 -0
- package/dist/client/ai-employees/business-report/ui/BusinessReportModal.d.ts +17 -0
- package/dist/client/ai-employees/business-report/ui/report-utils.d.ts +38 -0
- package/dist/client/ai-employees/chatbox/AIEmployeeSwitch.d.ts +3 -2
- package/dist/client/ai-employees/chatbox/HintMessageHeader.d.ts +10 -0
- package/dist/client/ai-employees/chatbox/ModelSwitcher.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/SearchSwitch.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/Upload.d.ts +3 -1
- package/dist/client/ai-employees/chatbox/conversations/ConversationsList.d.ts +27 -0
- package/dist/client/ai-employees/chatbox/conversations/WorkflowTasksList.d.ts +31 -0
- package/dist/client/ai-employees/chatbox/conversations/common.d.ts +43 -0
- package/dist/{server/document-loader/loader.worker.d.ts → client/ai-employees/chatbox/conversations/index.d.ts} +1 -1
- package/dist/client/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +5 -3
- package/dist/client/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +24 -0
- package/dist/client/ai-employees/chatbox/markdown/ECharts.d.ts +1 -2
- package/dist/client/ai-employees/chatbox/markdown/Markdown.d.ts +1 -1
- package/dist/client/ai-employees/chatbox/roles.d.ts +1 -0
- package/dist/client/ai-employees/chatbox/stores/chat-box.d.ts +8 -0
- package/dist/client/ai-employees/chatbox/stores/chat-conversations.d.ts +4 -0
- package/dist/client/ai-employees/chatbox/stores/chat-messages.d.ts +8 -0
- package/dist/client/ai-employees/chatbox/stores/workflow-tasks.d.ts +41 -0
- package/dist/client/ai-employees/chatbox/utils.d.ts +17 -7
- package/dist/client/ai-employees/sub-agents/tools/index.d.ts +10 -0
- package/dist/client/ai-employees/sub-agents/ui/SubAgentDispatchCard.d.ts +21 -0
- package/dist/client/ai-employees/types.d.ts +24 -4
- package/dist/{server/ai-employees/built-in/ai-coding/document/example/js-filter → client/ai-employees/workflow-tasks/tools}/index.d.ts +2 -7
- package/dist/client/ai-employees/workflow-tasks/ui/WorkflowTaskOutputCard.d.ts +11 -0
- package/dist/client/components/ListCollapse.d.ts +28 -0
- package/dist/client/index.js +7 -7
- package/dist/client/manager/ai-manager.d.ts +4 -23
- package/dist/client/repositories/AIConfigRepository.d.ts +11 -3
- package/dist/client/workflow/nodes/employee/components/AIEmployeeSelect.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/assigness.d.ts +11 -0
- package/dist/client/workflow/nodes/employee/components/file-inputs.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/message-inputs.d.ts +12 -0
- package/dist/client/workflow/nodes/employee/components/model-options.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/skill-settings.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/structured-output.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/components/users-select.d.ts +15 -0
- package/dist/client/workflow/nodes/employee/components/web-search-options.d.ts +10 -0
- package/dist/client/workflow/nodes/employee/configuration.d.ts +12 -0
- package/dist/client/workflow/nodes/employee/flow-models/feedback.d.ts +13 -0
- package/dist/client/workflow/nodes/employee/flow-models/task.d.ts +13 -0
- package/dist/client/workflow/nodes/employee/index.d.ts +7 -31
- package/dist/collections/ai-employees.js +2 -1
- package/dist/collections/ai-mcp-clients.d.ts +51 -0
- package/dist/collections/ai-mcp-clients.js +111 -0
- package/dist/externalVersion.js +17 -16
- package/dist/locale/en-US.json +136 -8
- package/dist/locale/zh-CN.json +138 -9
- package/dist/node_modules/fast-glob/out/index.js +8 -8
- package/dist/node_modules/fast-glob/package.json +1 -1
- package/dist/node_modules/flexsearch/dist/flexsearch.bundle.min.js +2 -2
- package/dist/node_modules/flexsearch/package.json +1 -1
- package/dist/node_modules/fs-extra/lib/index.js +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/nodejs_snowflake.js +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/index.js +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-conversations.d.ts +70 -0
- package/dist/server/ai-employees/ai-conversations.js +325 -0
- package/dist/server/ai-employees/ai-employee.d.ts +100 -19
- package/dist/server/ai-employees/ai-employee.js +484 -261
- package/dist/server/ai-employees/ai-knowledge-base.d.ts +28 -0
- package/dist/server/ai-employees/ai-knowledge-base.js +167 -0
- package/dist/server/ai-employees/middleware/conversation.d.ts +2 -0
- package/dist/server/ai-employees/middleware/conversation.js +38 -5
- package/dist/server/ai-employees/middleware/index.d.ts +2 -0
- package/dist/server/ai-employees/middleware/index.js +5 -1
- package/dist/server/ai-employees/middleware/skill-tools.d.ts +12 -0
- package/dist/server/ai-employees/middleware/skill-tools.js +88 -0
- package/dist/server/ai-employees/middleware/tools.js +37 -10
- package/dist/server/ai-employees/middleware/workflow-history.d.ts +22 -0
- package/dist/server/ai-employees/middleware/workflow-history.js +173 -0
- package/dist/server/ai-employees/prompts.d.ts +16 -1
- package/dist/server/ai-employees/prompts.js +37 -1
- package/dist/server/ai-employees/sub-agents/dispatcher.d.ts +36 -0
- package/dist/server/ai-employees/sub-agents/dispatcher.js +225 -0
- package/dist/server/ai-employees/sub-agents/index.d.ts +9 -0
- package/dist/server/{migrations/20250923221107-setup-build-in.js → ai-employees/sub-agents/index.js} +9 -13
- package/dist/server/ai-employees/templates/form-assistant.d.ts +2 -2
- package/dist/server/ai-employees/templates/form-assistant.js +2 -2
- package/dist/server/ai-employees/utils.js +2 -2
- package/dist/server/collections/ai-conversations.js +18 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.d.ts → collections/ai-mcp-clients.d.ts} +1 -4
- package/dist/server/{ai-employees/built-in/nocobase-assistant/index.js → collections/ai-mcp-clients.js} +12 -13
- package/dist/server/{ai-employees/built-in/ai-coding/document/basic/flow-resource.d.ts → collections/ai-skills.d.ts} +1 -4
- package/dist/server/collections/ai-skills.js +73 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.d.ts → collections/ai-workflow-tasks.d.ts} +1 -4
- package/dist/server/collections/ai-workflow-tasks.js +112 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.d.ts → collections/users-ai-workflow-tasks.d.ts} +1 -4
- package/dist/server/collections/users-ai-workflow-tasks.js +44 -0
- package/dist/server/document-loader/constants.d.ts +1 -2
- package/dist/server/document-loader/constants.js +6 -1
- package/dist/server/document-loader/loader.d.ts +0 -1
- package/dist/server/document-loader/loader.js +2 -55
- package/dist/server/document-loader/types.d.ts +0 -1
- package/dist/server/llm-providers/anthropic.d.ts +1 -0
- package/dist/server/llm-providers/anthropic.js +2 -1
- package/dist/server/llm-providers/dashscope.d.ts +1 -0
- package/dist/server/llm-providers/deepseek.d.ts +1 -0
- package/dist/server/llm-providers/google-genai.d.ts +1 -0
- package/dist/server/llm-providers/google-genai.js +2 -1
- package/dist/server/llm-providers/kimi/provider.d.ts +1 -0
- package/dist/server/llm-providers/openai/responses.d.ts +1 -0
- package/dist/server/llm-providers/openai/responses.js +2 -1
- package/dist/server/llm-providers/provider.d.ts +1 -10
- package/dist/server/llm-providers/provider.js +4 -35
- package/dist/server/manager/ai-coding-manager.d.ts +1 -2
- package/dist/server/manager/ai-coding-manager.js +0 -41
- package/dist/server/manager/ai-context-datasource-manager.js +30 -1
- package/dist/server/manager/built-in-manager.d.ts +2 -4
- package/dist/server/manager/built-in-manager.js +8 -118
- package/dist/server/migrations/20260306000001-migrate-skill-settings-tools.js +68 -0
- package/dist/server/migrations/20260319000000-add-ai-conversations-from.d.ts +14 -0
- package/dist/server/migrations/20260319000000-add-ai-conversations-from.js +63 -0
- package/dist/server/migrations/20260424000000-remove-cole-ai-employee.d.ts +14 -0
- package/dist/server/{ai-employees/built-in/email-assistant/index.js → migrations/20260424000000-remove-cole-ai-employee.js} +20 -22
- package/dist/server/plugin.d.ts +6 -1
- package/dist/server/plugin.js +31 -8
- package/dist/server/resource/aiConversations.js +112 -188
- package/dist/server/resource/aiEmployees.js +5 -7
- package/dist/server/resource/aiMcpClients.d.ts +11 -0
- package/dist/server/resource/aiMcpClients.js +78 -0
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/index.d.ts → resource/aiSkills.d.ts} +3 -7
- package/dist/server/resource/aiSkills.js +71 -0
- package/dist/server/resource/aiTools.js +4 -6
- package/dist/server/resource/aiWorkflowTasks.d.ts +12 -0
- package/dist/server/resource/aiWorkflowTasks.js +290 -0
- package/dist/server/tools/docs.js +4 -3
- package/dist/server/tools/workflow-caller.js +1 -0
- package/dist/server/types/ai-chat-conversation.type.d.ts +8 -2
- package/dist/server/types/ai-message.type.d.ts +7 -0
- package/dist/server/utils.d.ts +3 -0
- package/dist/server/utils.js +28 -3
- package/dist/server/workflow/nodes/employee/files.d.ts +16 -0
- package/dist/server/workflow/nodes/employee/files.js +125 -0
- package/dist/server/workflow/nodes/employee/handler.d.ts +11 -0
- package/dist/server/workflow/nodes/employee/handler.js +107 -0
- package/dist/server/workflow/nodes/employee/index.d.ts +17 -0
- package/dist/server/workflow/nodes/employee/index.js +391 -0
- package/dist/server/workflow/nodes/employee/tools.d.ts +12 -0
- package/dist/server/workflow/nodes/employee/tools.js +133 -0
- package/dist/server/workflow/nodes/employee/types.d.ts +35 -0
- package/dist/server/workflow/nodes/employee/types.js +24 -0
- package/dist/server/workflow/utils.d.ts +14 -0
- package/dist/server/workflow/utils.js +111 -0
- package/package.json +4 -2
- package/dist/client/107.64d9efa24d6b9143.js +0 -10
- package/dist/client/124.768c8aa5d6e6b461.js +0 -10
- package/dist/client/159.d52107c7a34ce2da.js +0 -10
- package/dist/client/192.0419770b69678994.js +0 -10
- package/dist/client/204.91be8cfc54d91a59.js +0 -10
- package/dist/client/238.9f784a7cdb751999.js +0 -10
- package/dist/client/263.6e1dfb1cbb1964f5.js +0 -10
- package/dist/client/35.5ee7503d9c09daa8.js +0 -10
- package/dist/client/47.6bd245f2140efd24.js +0 -10
- package/dist/client/481.03b3d2306d409933.js +0 -10
- package/dist/client/586.6a1510cabaa84f23.js +0 -10
- package/dist/client/650.8871a07b31c307ea.js +0 -10
- package/dist/client/755.e295bbd2b2a1cc21.js +0 -10
- package/dist/client/772.d51f683c55e18dd4.js +0 -10
- package/dist/client/870.84187dcb8c89b4dc.js +0 -10
- package/dist/client/933.baab3aa75f30e020.js +0 -10
- package/dist/client/987.3aee964e7f406939.js +0 -10
- package/dist/server/ai-employees/built-in/ai-coding/document/basic/flow-resource.js +0 -256
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/index.js +0 -48
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.js +0 -452
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.js +0 -363
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.js +0 -270
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.js +0 -219
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.js +0 -409
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.js +0 -324
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.js +0 -309
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/index.js +0 -50
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.js +0 -345
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.js +0 -381
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.js +0 -545
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.js +0 -346
- package/dist/server/ai-employees/built-in/ai-coding/document/js-action.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-action.js +0 -102
- package/dist/server/ai-employees/built-in/ai-coding/document/js-block.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-block.js +0 -314
- package/dist/server/ai-employees/built-in/ai-coding/document/js-column.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-column.js +0 -113
- package/dist/server/ai-employees/built-in/ai-coding/document/js-field.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-field.js +0 -498
- package/dist/server/ai-employees/built-in/ai-coding/document/js-item.d.ts +0 -13
- package/dist/server/ai-employees/built-in/ai-coding/document/js-item.js +0 -184
- package/dist/server/ai-employees/built-in/ai-coding/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/ai-coding/index.js +0 -99
- package/dist/server/ai-employees/built-in/ai-coding/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/ai-coding/profile.js +0 -60
- package/dist/server/ai-employees/built-in/ai-coding/prompt_en.md +0 -110
- package/dist/server/ai-employees/built-in/data-modeling/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-modeling/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-modeling/profile.js +0 -60
- package/dist/server/ai-employees/built-in/data-modeling/prompt.js +0 -283
- package/dist/server/ai-employees/built-in/data-organizer/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-organizer/index.js +0 -63
- package/dist/server/ai-employees/built-in/data-organizer/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-organizer/profile.js +0 -60
- package/dist/server/ai-employees/built-in/data-visualization/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/data-visualization/index.js +0 -58
- package/dist/server/ai-employees/built-in/data-visualization/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/data-visualization/profile.js +0 -60
- package/dist/server/ai-employees/built-in/email-assistant/index.d.ts +0 -34
- package/dist/server/ai-employees/built-in/email-assistant/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/email-assistant/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/insights-analyst/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/insights-analyst/index.js +0 -63
- package/dist/server/ai-employees/built-in/insights-analyst/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/insights-analyst/profile.js +0 -60
- package/dist/server/ai-employees/built-in/insights-analyst/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/nocobase-assistant/index.d.ts +0 -34
- package/dist/server/ai-employees/built-in/nocobase-assistant/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/nocobase-assistant/profile.js +0 -60
- package/dist/server/ai-employees/built-in/nocobase-assistant/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/nocobase-assistant/prompt.js +0 -52
- package/dist/server/ai-employees/built-in/research-analyst/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/research-analyst/index.js +0 -63
- package/dist/server/ai-employees/built-in/research-analyst/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/research-analyst/profile.js +0 -60
- package/dist/server/ai-employees/built-in/research-analyst/prompt.d.ts +0 -12
- package/dist/server/ai-employees/built-in/translator/index.d.ts +0 -37
- package/dist/server/ai-employees/built-in/translator/index.js +0 -67
- package/dist/server/ai-employees/built-in/translator/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/translator/prompt.d.ts +0 -12
- package/dist/server/document-loader/loader.worker.js +0 -68
- package/dist/server/document-loader/vendor/langchain/document_loaders/fs/text.d.ts +0 -20
- package/dist/server/document-loader/vendor/langchain/document_loaders/fs/text.js +0 -96
- /package/dist/client/ai-employees/chatbox/{Conversations.d.ts → conversations/Conversations.d.ts} +0 -0
- /package/dist/server/migrations/{20250923221107-setup-build-in.d.ts → 20260306000001-migrate-skill-settings-tools.d.ts} +0 -0
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var js_block_exports = {};
|
|
28
|
-
__export(js_block_exports, {
|
|
29
|
-
default: () => js_block_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(js_block_exports);
|
|
32
|
-
var js_block_default = {
|
|
33
|
-
name: "js-block-model",
|
|
34
|
-
content: String.raw`# JSBlockModel
|
|
35
|
-
|
|
36
|
-
## 示例
|
|
37
|
-
|
|
38
|
-
### 支持筛选的自定义区块
|
|
39
|
-
|
|
40
|
-
自定义区块
|
|
41
|
-
|
|
42
|
-
\`\`\`typescript
|
|
43
|
-
// 使用 Resource,支持 MultiRecordResource、SingleRecordResource、SQLResource
|
|
44
|
-
ctx.useResource('MultiRecordResource');
|
|
45
|
-
ctx.resource.setResourceName('users');
|
|
46
|
-
|
|
47
|
-
await ctx.resource.refresh();
|
|
48
|
-
|
|
49
|
-
ctx.model.getFilterFields = async () => {
|
|
50
|
-
return ctx.dataSourceManager.getCollection('main', 'users').getFields();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
ctx.element.innerHTML = \`<pre>\${JSON.stringify(ctx.resource.getData(), null, 2)}</pre>\`;
|
|
54
|
-
\`\`\`
|
|
55
|
-
|
|
56
|
-
JS 按钮
|
|
57
|
-
|
|
58
|
-
\`\`\`typescript
|
|
59
|
-
ctx.form.submit();
|
|
60
|
-
const model = ctx.engine.getModel('11df49d3343');
|
|
61
|
-
model.rerender();
|
|
62
|
-
\`\`\`
|
|
63
|
-
|
|
64
|
-
### SQL 数据的区块
|
|
65
|
-
|
|
66
|
-
\`\`\`typescript
|
|
67
|
-
if (ctx.flowSettingsEnabled) {
|
|
68
|
-
await ctx.sql.save({
|
|
69
|
-
uid: ctx.model.uid,
|
|
70
|
-
sql: 'select * from users where id = {{ctx.user.id}}',
|
|
71
|
-
dataSourceKey: 'main',
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
ctx.useResource('SQLResource');
|
|
76
|
-
ctx.resource.setDataSourceKey('main');
|
|
77
|
-
ctx.resource.setFilterByTk(ctx.model.uid);
|
|
78
|
-
await ctx.resource.refresh();
|
|
79
|
-
|
|
80
|
-
ctx.model.getFilterFields = async () => {
|
|
81
|
-
return ctx.dataSourceManager.getCollection('main', 'users').getFields();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
ctx.element.innerHTML = \`<pre>\${JSON.stringify(ctx.resource.getData(), null, 2)}</pre>\`;
|
|
85
|
-
\`\`\`
|
|
86
|
-
|
|
87
|
-
### 图表区块
|
|
88
|
-
|
|
89
|
-
\`\`\`typescript
|
|
90
|
-
ctx.element.innerHTML = '';
|
|
91
|
-
const chartContainer = document.createElement('div');
|
|
92
|
-
chartContainer.style.height = '400px';
|
|
93
|
-
ctx.element.appendChild(chartContainer);
|
|
94
|
-
|
|
95
|
-
const echarts = await ctx.requireAsync('https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js');
|
|
96
|
-
if (!echarts) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const chart = echarts.init(chartContainer);
|
|
100
|
-
// Generate random data
|
|
101
|
-
const categories = ['A', 'B', 'C', 'D', 'E', 'F'];
|
|
102
|
-
const randomData = categories.map(() => Math.floor(Math.random() * 50) + 1);
|
|
103
|
-
const option = {
|
|
104
|
-
title: { text: 'ECharts Example (Random Data)' },
|
|
105
|
-
tooltip: {},
|
|
106
|
-
xAxis: { data: categories },
|
|
107
|
-
yAxis: {},
|
|
108
|
-
series: [{ name: 'Sales', type: 'bar', data: randomData }],
|
|
109
|
-
};
|
|
110
|
-
chart.setOption(option);
|
|
111
|
-
chart.resize();
|
|
112
|
-
window.addEventListener('resize', () => chart.resize());
|
|
113
|
-
\`\`\`
|
|
114
|
-
|
|
115
|
-
### 点击弹窗
|
|
116
|
-
|
|
117
|
-
\`\`\`typescript
|
|
118
|
-
ctx.element.innerHTML = \`<button class="myButton">点击我</button>\`;
|
|
119
|
-
// 绑定点击事件
|
|
120
|
-
const button = ctx.element.querySelector('.myButton');
|
|
121
|
-
button.addEventListener('click', () => {
|
|
122
|
-
ctx.runAction('openView', {
|
|
123
|
-
navigation: false, // 必填
|
|
124
|
-
mode: 'dialog',
|
|
125
|
-
collectionName: 'users',
|
|
126
|
-
dataSourceKey: 'main',
|
|
127
|
-
filterByTk: 1,
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
\`\`\`
|
|
131
|
-
|
|
132
|
-
弹窗的 openView 参数
|
|
133
|
-
|
|
134
|
-
\`\`\`typescript
|
|
135
|
-
interface OpenViewParams {
|
|
136
|
-
navigation: boolean;
|
|
137
|
-
mode?: 'drawer' | 'dialog'; // 默认是 drawer
|
|
138
|
-
collectionName?: string; // 数据表
|
|
139
|
-
dataSourceKey?: string; // 数据源
|
|
140
|
-
filterByTk?: any; // 数据表记录ID
|
|
141
|
-
tabUid?: string; // 激活的标签页
|
|
142
|
-
}
|
|
143
|
-
\`\`\`
|
|
144
|
-
|
|
145
|
-
## 示例:JSBlock 打开预配置的编辑弹窗
|
|
146
|
-
|
|
147
|
-
以下 Demo 展示了更贴近实际的做法:弹窗(含表单与提交流程)提前在插件中配置好,JS 代码区块只负责渲染列表并在点击时调用 \`openView\`。保存成功后,提交按钮内预置的 \`afterSaved\` 步骤会回调代码区块刷新数据。
|
|
148
|
-
|
|
149
|
-
\`\`\`javascript
|
|
150
|
-
const submitActionUid = 'jsblock-external-submit';
|
|
151
|
-
|
|
152
|
-
ctx.useResource('MultiRecordResource');
|
|
153
|
-
ctx.resource.setResourceName('lead');
|
|
154
|
-
ctx.resource.setDataSourceKey('main');
|
|
155
|
-
ctx.resource.setPageSize(100);
|
|
156
|
-
ctx.resource.setFields(['id','name','company','email','phone','status','rating']);
|
|
157
|
-
|
|
158
|
-
ctx.resource.on('refresh', render);
|
|
159
|
-
|
|
160
|
-
const handleLeadSaved = async () => {
|
|
161
|
-
await ctx.resource.refresh();
|
|
162
|
-
ctx.message.success('保存成功,已刷新列表');
|
|
163
|
-
render();
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// 确保在外部已创建的提交按钮上追加 afterSaved 回调步骤
|
|
167
|
-
async function ensureAfterSavedStep() {
|
|
168
|
-
try {
|
|
169
|
-
var submitAction = ctx.engine.getModel(submitActionUid);
|
|
170
|
-
if (!submitAction) return;
|
|
171
|
-
var flow = submitAction.flowRegistry && submitAction.flowRegistry.getFlow ? submitAction.flowRegistry.getFlow('submitSettings') : null;
|
|
172
|
-
if (!flow) {
|
|
173
|
-
var base = submitAction.getFlow && submitAction.getFlow('submitSettings');
|
|
174
|
-
if (base && submitAction.flowRegistry && submitAction.flowRegistry.addFlow) {
|
|
175
|
-
var opts = base.serialize ? base.serialize() : {};
|
|
176
|
-
delete opts.key;
|
|
177
|
-
flow = submitAction.flowRegistry.addFlow('submitSettings', opts);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (!flow) return;
|
|
181
|
-
if (flow.hasStep && flow.hasStep('jsBlockAfterSaved')) {
|
|
182
|
-
try { flow.removeStep('jsBlockAfterSaved'); } catch (e) {}
|
|
183
|
-
}
|
|
184
|
-
flow.addStep && flow.addStep('jsBlockAfterSaved', {
|
|
185
|
-
sort: 9999,
|
|
186
|
-
async handler() { await handleLeadSaved(); },
|
|
187
|
-
});
|
|
188
|
-
if (flow.save) { try { await flow.save(); } catch(e) {} }
|
|
189
|
-
} catch (e) {}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
await ensureAfterSavedStep();
|
|
193
|
-
await ctx.resource.refresh();
|
|
194
|
-
|
|
195
|
-
function render() {
|
|
196
|
-
const list = ctx.resource.getData() || [];
|
|
197
|
-
const rows = list
|
|
198
|
-
.map(function (record) {
|
|
199
|
-
return (
|
|
200
|
-
'<tr>' +
|
|
201
|
-
'<td style="padding:6px 8px;border-bottom:1px solid #f0f0f0;">' + (record.id || '') + '</td>' +
|
|
202
|
-
'<td style="padding:6px 8px;border-bottom:1px solid #f0f0f0;">' + (record.name || '-') + '</td>' +
|
|
203
|
-
'<td style="padding:6px 8px;border-bottom:1px solid #f0f0f0;">' + (record.company || '-') + '</td>' +
|
|
204
|
-
'<td style="padding:6px 8px;border-bottom:1px solid #f0f0f0;">' + (record.status || '-') + '</td>' +
|
|
205
|
-
'<td style="padding:6px 8px;border-bottom:1px solid #f0f0f0;">' + (record.rating || '-') + '</td>' +
|
|
206
|
-
'<td style="padding:6px 8px;border-bottom:1px solid #f0f0f0;text-align:right">' +
|
|
207
|
-
'<button class="btn-edit" data-id="' + (record.id || '') + '" style="padding:4px 8px;border:1px solid #d9d9d9;border-radius:4px;background:#fff;cursor:pointer;">编辑</button>' +
|
|
208
|
-
'<button class="btn-del" data-id="' + (record.id || '') + '" style="margin-left:8px;padding:4px 8px;border:1px solid #ffccc7;border-radius:4px;background:#fff;color:#ff4d4f;cursor:pointer;">删除</button>' +
|
|
209
|
-
'</td>' +
|
|
210
|
-
'</tr>'
|
|
211
|
-
);
|
|
212
|
-
})
|
|
213
|
-
.join('');
|
|
214
|
-
|
|
215
|
-
ctx.element.innerHTML =
|
|
216
|
-
'<div style="padding:12px;">' +
|
|
217
|
-
'<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;">' +
|
|
218
|
-
'<h3 style="margin:0;font-size:16px;">线索管理(示例)</h3>' +
|
|
219
|
-
'<button id="btnAdd" style="padding:6px 10px;border:1px solid #91d5ff;border-radius:4px;background:#e6f7ff;color:#1677ff;cursor:pointer;">新增线索</button>' +
|
|
220
|
-
'</div>' +
|
|
221
|
-
'<table style="width:100%;border-collapse:collapse;font-size:13px;">' +
|
|
222
|
-
'<thead>' +
|
|
223
|
-
'<tr style="background:#fafafa;">' +
|
|
224
|
-
'<th style="text-align:left;padding:6px 8px;border-bottom:1px solid #f0f0f0;">ID</th>' +
|
|
225
|
-
'<th style="text-align:left;padding:6px 8px;border-bottom:1px solid #f0f0f0;">姓名</th>' +
|
|
226
|
-
'<th style="text-align:left;padding:6px 8px;border-bottom:1px solid #f0f0f0;">公司</th>' +
|
|
227
|
-
'<th style="text-align:left;padding:6px 8px;border-bottom:1px solid #f0f0f0;">状态</th>' +
|
|
228
|
-
'<th style="text-align:left;padding:6px 8px;border-bottom:1px solid #f0f0f0;">评级</th>' +
|
|
229
|
-
'<th style="text-align:right;padding:6px 8px;border-bottom:1px solid #f0f0f0;">操作</th>' +
|
|
230
|
-
'</tr>' +
|
|
231
|
-
'</thead>' +
|
|
232
|
-
'<tbody>' + rows + '</tbody>' +
|
|
233
|
-
'</table>' +
|
|
234
|
-
'</div>';
|
|
235
|
-
|
|
236
|
-
const btnAdd = ctx.element.querySelector('#btnAdd');
|
|
237
|
-
btnAdd.addEventListener('click', async () => {
|
|
238
|
-
const now = new Date().toLocaleString('zh-CN');
|
|
239
|
-
await ctx.resource.create({ name: '新线索 ' + now, company: '示例公司', status: 'Initial Contact', rating: 'Warm' });
|
|
240
|
-
render();
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
const tbody = ctx.element.querySelector('tbody');
|
|
244
|
-
tbody.addEventListener('click', async (event) => {
|
|
245
|
-
const button = event.target.closest('button');
|
|
246
|
-
if (!button) return;
|
|
247
|
-
const id = Number(button.getAttribute('data-id'));
|
|
248
|
-
|
|
249
|
-
if (button.classList.contains('btn-edit')) {
|
|
250
|
-
await ctx.runAction('openView', {
|
|
251
|
-
navigation: false,
|
|
252
|
-
mode: 'drawer',
|
|
253
|
-
collectionName: 'lead',
|
|
254
|
-
dataSourceKey: 'main',
|
|
255
|
-
filterByTk: id,
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (button.classList.contains('btn-del')) {
|
|
260
|
-
await ctx.resource.destroy(id);
|
|
261
|
-
render();
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
render();
|
|
267
|
-
\`\`\`
|
|
268
|
-
|
|
269
|
-
要点说明:
|
|
270
|
-
- 插件加载时就使用 \`flowEngine.loadOrCreateModel\` 预置了 ChildPage + EditForm,表单的 \`resourceSettings\` 写成 \`{{ ctx.view.inputArgs.filterByTk }}\`,因此每次弹窗都会根据当前点击的记录自动拉取数据。
|
|
271
|
-
- 弹窗通过 \`ctx.runAction('openView', {...})\` 打开,JSBlock 只传入主键;保存动作的 \`submitSettings\` 追加 \`afterSaved\` 步骤,调用父区块的 \`ctx.onLeadSaved\` 完成刷新。
|
|
272
|
-
- JSBlock 中仅保留列表渲染、按钮绑定和本地增删逻辑,便于普通开发者聚焦在数据展示与交互。
|
|
273
|
-
|
|
274
|
-
### Tabulator
|
|
275
|
-
|
|
276
|
-
\`\`\`typescript
|
|
277
|
-
ctx.element.innerHTML = '';
|
|
278
|
-
const tableContainer = document.createElement('div');
|
|
279
|
-
// tableContainer.style.height = '400px';
|
|
280
|
-
ctx.element.appendChild(tableContainer);
|
|
281
|
-
|
|
282
|
-
// 动态加载 Tabulator 的 CSS
|
|
283
|
-
await ctx.loadCSS('https://cdn.jsdelivr.net/npm/tabulator-tables@5.5.0/dist/css/tabulator.min.css');
|
|
284
|
-
|
|
285
|
-
// 动态加载 Tabulator 的 JS
|
|
286
|
-
const Tabulator = await ctx.requireAsync('https://cdn.jsdelivr.net/npm/tabulator-tables@5.5.0/dist/js/tabulator.min.js');
|
|
287
|
-
if (!Tabulator) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// 示例数据
|
|
292
|
-
const tableData = [
|
|
293
|
-
{ id: 1, name: 'Alice', age: 25, gender: 'Female' },
|
|
294
|
-
{ id: 2, name: 'Bob', age: 30, gender: 'Male' },
|
|
295
|
-
{ id: 3, name: 'Charlie', age: 35, gender: 'Male' },
|
|
296
|
-
{ id: 4, name: 'Diana', age: 28, gender: 'Female' },
|
|
297
|
-
];
|
|
298
|
-
|
|
299
|
-
// 初始化 Tabulator 表格
|
|
300
|
-
const table = new Tabulator(tableContainer, {
|
|
301
|
-
data: tableData, // 数据源
|
|
302
|
-
layout: 'fitColumns', // 列宽自适应
|
|
303
|
-
columns: [
|
|
304
|
-
{ title: 'ID', field: 'id', width: 50 },
|
|
305
|
-
{ title: 'Name', field: 'name', width: 150 },
|
|
306
|
-
{ title: 'Age', field: 'age', width: 100 },
|
|
307
|
-
{ title: 'Gender', field: 'gender', width: 100 },
|
|
308
|
-
],
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
// 监听窗口大小变化,调整表格大小
|
|
312
|
-
window.addEventListener('resize', () => table.redraw());
|
|
313
|
-
\`\`\``
|
|
314
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
name: string;
|
|
11
|
-
content: string;
|
|
12
|
-
};
|
|
13
|
-
export default _default;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var js_column_exports = {};
|
|
28
|
-
__export(js_column_exports, {
|
|
29
|
-
default: () => js_column_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(js_column_exports);
|
|
32
|
-
var js_column_default = {
|
|
33
|
-
name: "js-column-model",
|
|
34
|
-
content: String.raw`# JSColumnModel
|
|
35
|
-
|
|
36
|
-
用于表格中的“自定义列”,以 JavaScript 渲染单元格内容。适合表格汇总或者计算,或者请求远端关联数据展示等场景。
|
|
37
|
-
与普通字段列不同,JSColumnModel 不绑定具体字段值,你需要通过 \`ctx.record\` 自行读取当前行数据并渲染。
|
|
38
|
-
|
|
39
|
-
## 可用上下文(常用)
|
|
40
|
-
- \`ctx.element\`:ElementProxy(当前单元格容器)。
|
|
41
|
-
- \`ctx.record\`:当前行记录对象。
|
|
42
|
-
- \`ctx.collection\`:当前集合对象(可获取主键、字段信息)。
|
|
43
|
-
- \`ctx.viewer\`:视图控制器,支持 \`drawer\`、\`dialog\`、\`popover\`、\`embed\`。
|
|
44
|
-
- \`ctx.api\`:API 客户端,可在点击时发起请求。
|
|
45
|
-
- \`ctx.t\`:国际化函数。
|
|
46
|
-
|
|
47
|
-
说明:
|
|
48
|
-
- 表格逐行渲染时会为每行创建 fork 上下文,\`ctx.record\` 均指向当前行。
|
|
49
|
-
|
|
50
|
-
## 示例:状态徽标列
|
|
51
|
-
<code src="./demos/table.tsx"></code>
|
|
52
|
-
|
|
53
|
-
\`\`\`js
|
|
54
|
-
const status = String(ctx.record?.status ?? '').toLowerCase();
|
|
55
|
-
const color = status === 'done' ? '#52c41a' : status === 'pending' ? '#faad14' : '#ff4d4f';
|
|
56
|
-
const text = status || 'unknown';
|
|
57
|
-
|
|
58
|
-
ctx.element.innerHTML = \`
|
|
59
|
-
<span style="display:inline-flex;align-items:center;gap:6px;">
|
|
60
|
-
<i style="width:8px;height:8px;border-radius:50%;background:\${color};display:inline-block;"></i>
|
|
61
|
-
<span style="color:\${color};text-transform:capitalize;">\${text}</span>
|
|
62
|
-
</span>
|
|
63
|
-
\`;
|
|
64
|
-
\`\`\`
|
|
65
|
-
|
|
66
|
-
## 示例:点击打开抽屉查看详情(扩展性示例)
|
|
67
|
-
<code src="./demos/table-drawer.tsx"></code>
|
|
68
|
-
见上方 Demo 中 \`ctx.viewer.drawer\` 的用法。
|
|
69
|
-
|
|
70
|
-
\`\`\`js
|
|
71
|
-
// 简单 JSON 预览按钮
|
|
72
|
-
ctx.element.innerHTML = \`
|
|
73
|
-
<a href="javascript:;" style="color:#1677ff;">查看</a>
|
|
74
|
-
\`;
|
|
75
|
-
|
|
76
|
-
ctx.element.querySelector('a')?.addEventListener('click', async () => {
|
|
77
|
-
const pk = ctx.collection?.getFilterByTK?.(ctx.record); // 当前行主键(若集合可推断)
|
|
78
|
-
await ctx.viewer.drawer({
|
|
79
|
-
width: '56%',
|
|
80
|
-
content: \`
|
|
81
|
-
<div style="padding:16px;font:14px/1.6 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;">
|
|
82
|
-
<h3 style="margin:0 0 12px;">行数据预览(#\${pk ?? ctx.recordIndex})</h3>
|
|
83
|
-
<pre style="background:#f5f5f5;padding:12px;border-radius:6px;">\${JSON.stringify(ctx.record, null, 2)}</pre>
|
|
84
|
-
</div>
|
|
85
|
-
\`,
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
\`\`\`
|
|
89
|
-
|
|
90
|
-
## 示例:组合多字段为一列的展示
|
|
91
|
-
<code src="./demos/table-combine.tsx"></code>
|
|
92
|
-
将多个字段合并为单列显示(如 “姓名(部门) - 职级”):
|
|
93
|
-
|
|
94
|
-
\`\`\`js
|
|
95
|
-
const name = ctx.record?.name ?? '';
|
|
96
|
-
const dept = ctx.record?.department?.name ?? '';
|
|
97
|
-
const level = ctx.record?.level ?? '';
|
|
98
|
-
|
|
99
|
-
ctx.element.innerHTML = \`
|
|
100
|
-
<div style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">
|
|
101
|
-
<strong>\${name}</strong>
|
|
102
|
-
<span style="color:#999">(\${dept})</span>
|
|
103
|
-
<span style="color:#999"> - \${level}</span>
|
|
104
|
-
</div>
|
|
105
|
-
\`;
|
|
106
|
-
\`\`\`
|
|
107
|
-
|
|
108
|
-
## 进阶提示
|
|
109
|
-
- 可通过 \`ctx.api\` 请求后端,动态刷新 \`ctx.element\` 内容;
|
|
110
|
-
- 如需在表格中联动其他列或行操作,可结合 \`ctx.openView\` 做轻交互;
|
|
111
|
-
- 对于“绑定字段值”的场景,请使用JS字段列,JSColumn 适合完全自定义展示与行为, 例如跨字段的汇总等场景。
|
|
112
|
-
`
|
|
113
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
name: string;
|
|
11
|
-
content: string;
|
|
12
|
-
};
|
|
13
|
-
export default _default;
|