@nocobase/plugin-ai 2.1.0-alpha.10 → 2.1.0-alpha.11
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/{server/ai-employees/built-in/data-modeling/prompt.d.ts → ai/ai-employees/cole.d.ts} +1 -3
- package/dist/{server/ai-employees/built-in/nocobase-assistant/prompt.js → ai/ai-employees/cole.js} +15 -7
- package/dist/{server/ai-employees/built-in/data-organizer/prompt.d.ts → ai/ai-employees/dara.d.ts} +1 -3
- package/dist/{server/ai-employees/built-in/data-visualization/prompt.js → ai/ai-employees/dara.js} +21 -13
- package/dist/{server/ai-employees/built-in/data-visualization/prompt.d.ts → ai/ai-employees/dex.d.ts} +1 -3
- 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} +15 -7
- 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/document-search/SKILLS.md +69 -0
- package/dist/ai/tools/chartGenerator.js +14 -3
- package/dist/ai/tools/formFiller.js +13 -2
- package/dist/{server/ai-employees/built-in/ai-coding/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/ai/tools/suggestions.js +13 -2
- package/dist/client/{a06081a2b06f1c14.js → 200ac94fc7f6e97b.js} +1 -1
- package/dist/client/27539a4356faebb1.js +10 -0
- package/dist/client/2db4faf814179140.js +10 -0
- package/dist/client/{521c94db45b1e031.js → 4f9117811ffc7ab3.js} +1 -1
- package/dist/client/{c49557cc10afc6b2.js → 5af11e24bcb39ac4.js} +1 -1
- package/dist/client/62bf6ed27c8de0df.js +10 -0
- package/dist/client/6dc8c9b641452067.js +10 -0
- package/dist/client/8169eb2b48edf6c7.js +10 -0
- package/dist/client/81f6436fd9322dc1.js +10 -0
- package/dist/client/{33811690df6f43ba.js → 85af3d6d85eb5b2b.js} +1 -1
- package/dist/client/87bc4d3cb55e4006.js +10 -0
- package/dist/client/9ac11803370a9625.js +10 -0
- package/dist/client/9c00efb8eb0b4d69.js +10 -0
- package/dist/client/{f74949b95f9bbb91.js → a4948d5b70172a69.js} +1 -1
- package/dist/client/ai-employees/admin/SkillSettings.d.ts +7 -5
- package/dist/{server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.d.ts → client/ai-employees/admin/ToolsSettings.d.ts} +8 -4
- 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/chatbox/utils.d.ts +3 -7
- package/dist/client/ai-employees/types.d.ts +5 -4
- package/dist/client/c83c2cae956ba914.js +10 -0
- package/dist/client/{6fcc98eb80deed47.js → d4e2ed9fa44a82b2.js} +1 -1
- package/dist/client/{5be6710cc905ec12.js → f944d487b7ff1f00.js} +1 -1
- package/dist/client/index.js +2 -2
- package/dist/client/repositories/AIConfigRepository.d.ts +8 -1
- 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 +14 -14
- package/dist/locale/en-US.json +65 -8
- package/dist/locale/zh-CN.json +66 -9
- package/dist/node_modules/fast-glob/package.json +1 -1
- package/dist/node_modules/flexsearch/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-employee.d.ts +5 -1
- package/dist/server/ai-employees/ai-employee.js +90 -13
- package/dist/server/ai-employees/middleware/index.d.ts +1 -0
- package/dist/server/ai-employees/middleware/index.js +2 -0
- package/dist/server/ai-employees/middleware/skill-tools.d.ts +12 -0
- package/dist/server/ai-employees/middleware/skill-tools.js +74 -0
- package/dist/server/ai-employees/prompts.d.ts +6 -1
- package/dist/server/ai-employees/prompts.js +9 -1
- 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/{ai-employees/built-in/ai-coding/document/basic/flow-resource.d.ts → collections/ai-mcp-clients.d.ts} +1 -4
- package/dist/server/{ai-employees/built-in/ai-coding/prompt.js → collections/ai-mcp-clients.js} +12 -10
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.d.ts → collections/ai-skills.d.ts} +1 -4
- package/dist/server/{migrations/20250923221107-setup-build-in.js → collections/ai-skills.js} +46 -13
- 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/built-in-manager.d.ts +2 -4
- package/dist/server/manager/built-in-manager.js +7 -118
- package/dist/server/migrations/20260306000001-migrate-skill-settings-tools.js +68 -0
- package/dist/server/plugin.d.ts +0 -1
- package/dist/server/plugin.js +17 -8
- package/dist/server/resource/aiEmployees.js +5 -7
- package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.d.ts → resource/aiMcpClients.d.ts} +3 -5
- 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/tools/docs.js +2 -2
- package/dist/server/tools/workflow-caller.js +1 -0
- package/package.json +2 -2
- package/dist/client/16dbe01d9077bb74.js +0 -10
- package/dist/client/180c8b1051a4f36e.js +0 -10
- package/dist/client/41229e007006e7f6.js +0 -10
- package/dist/client/41950da4c64caf73.js +0 -10
- package/dist/client/585ba360c7c57caf.js +0 -10
- package/dist/client/9f62a4c5136dfe8b.js +0 -10
- package/dist/client/b7f721f8dabb54e5.js +0 -10
- package/dist/client/bc471dd60174458c.js +0 -10
- package/dist/client/c40ed1a900aefb67.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.d.ts +0 -15
- 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/index.js +0 -50
- package/dist/server/ai-employees/built-in/email-assistant/profile.d.ts +0 -27
- package/dist/server/ai-employees/built-in/email-assistant/profile.js +0 -60
- 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/index.js +0 -50
- 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/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/profile.js +0 -60
- package/dist/server/ai-employees/built-in/translator/prompt.d.ts +0 -12
- /package/dist/server/migrations/{20250923221107-setup-build-in.d.ts → 20260306000001-migrate-skill-settings-tools.d.ts} +0 -0
|
@@ -1,50 +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 __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
-
var js_filter_exports = {};
|
|
38
|
-
__export(js_filter_exports, {
|
|
39
|
-
default: () => js_filter_default
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(js_filter_exports);
|
|
42
|
-
var import_accounts_filter_ant_style = __toESM(require("./accounts_filter_ant_style"));
|
|
43
|
-
var import_contacts_filter_ant_style = __toESM(require("./contacts_filter_ant_style"));
|
|
44
|
-
var import_leads_filter_ant_style = __toESM(require("./leads_filter_ant_style"));
|
|
45
|
-
var import_opportunities_filter_ant_style = __toESM(require("./opportunities_filter_ant_style"));
|
|
46
|
-
var import_product_categories_ant_style = __toESM(require("./product_categories_ant_style"));
|
|
47
|
-
var import_tickets_filter_ant_style = __toESM(require("./tickets_filter_ant_style"));
|
|
48
|
-
var js_filter_default = {
|
|
49
|
-
"en-US": [import_accounts_filter_ant_style.default, import_contacts_filter_ant_style.default, import_leads_filter_ant_style.default, import_opportunities_filter_ant_style.default, import_product_categories_ant_style.default, import_tickets_filter_ant_style.default]
|
|
50
|
-
};
|
|
@@ -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,345 +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 leads_filter_ant_style_exports = {};
|
|
28
|
-
__export(leads_filter_ant_style_exports, {
|
|
29
|
-
default: () => leads_filter_ant_style_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(leads_filter_ant_style_exports);
|
|
32
|
-
var leads_filter_ant_style_default = {
|
|
33
|
-
name: "leads_filter_ant_style",
|
|
34
|
-
content: String.raw`// Leads Filter Block - Ant Design Style
|
|
35
|
-
// Configure block UID (needs to be replaced with actual UID)
|
|
36
|
-
const leadsBlockUid = 'f84d922c772'; // Replace with actual leads list block UID
|
|
37
|
-
|
|
38
|
-
// State management
|
|
39
|
-
let selectedFilter = 'all';
|
|
40
|
-
let isExpanded = false;
|
|
41
|
-
|
|
42
|
-
// Load icon library
|
|
43
|
-
await ctx.loadCSS('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');
|
|
44
|
-
|
|
45
|
-
// Predefined filter configurations
|
|
46
|
-
const filterConfigs = [
|
|
47
|
-
{ key: 'all', label: 'All', icon: 'fa-th-large', filter: {"$and":[]} },
|
|
48
|
-
{ key: 'public', label: 'Public', icon: 'fa-globe', filter: { is_public: true } },
|
|
49
|
-
{ key: 'my', label: 'My Leads', icon: 'fa-user', filter: { owner_id: ctx.user?.id } },
|
|
50
|
-
{ key: 'unqualified', label: 'Unqualified', icon: 'fa-times-circle', filter: { status: 'Unqualified' } },
|
|
51
|
-
{ key: 'initial', label: 'Initial', icon: 'fa-phone', filter: { status: 'Initial Contact' } },
|
|
52
|
-
{ key: 'interest', label: 'Interest', icon: 'fa-heart', filter: { status: 'Interest Cultivation' } },
|
|
53
|
-
{ key: 'followup', label: 'Follow-up', icon: 'fa-user-check', filter: { status: 'Deep Follow-up' } },
|
|
54
|
-
{ key: 'success', label: 'Success', icon: 'fa-trophy', filter: { status: 'Success' } },
|
|
55
|
-
{ key: 'web', label: 'From Web', icon: 'fa-globe', filter: { source: 'Web' } },
|
|
56
|
-
{ key: 'email', label: 'From Email', icon: 'fa-envelope', filter: { source: 'Email' } },
|
|
57
|
-
{ key: 'today', label: 'Today', icon: 'fa-calendar-day', filter: { createdAt: { $gte: new Date(new Date().setHours(0,0,0,0)).toISOString() } } },
|
|
58
|
-
{ key: 'week', label: 'This Week', icon: 'fa-calendar-week', filter: { createdAt: { $gte: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString() } } },
|
|
59
|
-
{ key: 'month', label: 'This Month', icon: 'fa-calendar-alt', filter: {
|
|
60
|
-
createdAt: {
|
|
61
|
-
$gte: new Date(new Date().getFullYear(), new Date().getMonth(), 1).toISOString()
|
|
62
|
-
}
|
|
63
|
-
}}
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
// Save SQL configuration
|
|
67
|
-
if (ctx.flowSettingsEnabled) {
|
|
68
|
-
const today = new Date(new Date().setHours(0,0,0,0)).toISOString();
|
|
69
|
-
const weekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString();
|
|
70
|
-
const monthStart = new Date(new Date().getFullYear(), new Date().getMonth(), 1).toISOString();
|
|
71
|
-
|
|
72
|
-
await ctx.sql.save({
|
|
73
|
-
uid: ctx.model.uid,
|
|
74
|
-
sql: \`
|
|
75
|
-
WITH lead_stats AS (
|
|
76
|
-
SELECT
|
|
77
|
-
COUNT(*) as total,
|
|
78
|
-
COUNT(CASE WHEN is_public = true THEN 1 END) as public_count,
|
|
79
|
-
COUNT(CASE WHEN owner_id = \${ctx.user?.id || 0} THEN 1 END) as my_count,
|
|
80
|
-
COUNT(CASE WHEN status = 'Unqualified' THEN 1 END) as unqualified_count,
|
|
81
|
-
COUNT(CASE WHEN status = 'Initial Contact' THEN 1 END) as initial_count,
|
|
82
|
-
COUNT(CASE WHEN status = 'Interest Cultivation' THEN 1 END) as interest_count,
|
|
83
|
-
COUNT(CASE WHEN status = 'Deep Follow-up' THEN 1 END) as followup_count,
|
|
84
|
-
COUNT(CASE WHEN status = 'Success' THEN 1 END) as success_count,
|
|
85
|
-
COUNT(CASE WHEN source = 'Web' THEN 1 END) as web_count,
|
|
86
|
-
COUNT(CASE WHEN source = 'Email' THEN 1 END) as email_count,
|
|
87
|
-
COUNT(CASE WHEN "createdAt" >= '\${today}' THEN 1 END) as today_count,
|
|
88
|
-
COUNT(CASE WHEN "createdAt" >= '\${weekAgo}' THEN 1 END) as week_count,
|
|
89
|
-
COUNT(CASE WHEN "createdAt" >= '\${monthStart}' THEN 1 END) as month_count
|
|
90
|
-
FROM lead
|
|
91
|
-
)
|
|
92
|
-
SELECT * FROM lead_stats
|
|
93
|
-
\`,
|
|
94
|
-
dataSourceKey: 'main',
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Use SQLResource
|
|
99
|
-
ctx.useResource('SQLResource');
|
|
100
|
-
ctx.resource.setDataSourceKey('main');
|
|
101
|
-
ctx.resource.setFilterByTk(ctx.model.uid);
|
|
102
|
-
|
|
103
|
-
// Query statistics data
|
|
104
|
-
await ctx.resource.refresh();
|
|
105
|
-
const stats = ctx.resource.getData()[0] || {};
|
|
106
|
-
|
|
107
|
-
// Map statistics data
|
|
108
|
-
const statMapping = {
|
|
109
|
-
'all': stats.total || 0,
|
|
110
|
-
'public': stats.public_count || 0,
|
|
111
|
-
'my': stats.my_count || 0,
|
|
112
|
-
'unqualified': stats.unqualified_count || 0,
|
|
113
|
-
'initial': stats.initial_count || 0,
|
|
114
|
-
'interest': stats.interest_count || 0,
|
|
115
|
-
'followup': stats.followup_count || 0,
|
|
116
|
-
'success': stats.success_count || 0,
|
|
117
|
-
'web': stats.web_count || 0,
|
|
118
|
-
'email': stats.email_count || 0,
|
|
119
|
-
'today': stats.today_count || 0,
|
|
120
|
-
'week': stats.week_count || 0,
|
|
121
|
-
'month': stats.month_count || 0
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// Apply filter
|
|
125
|
-
function applyFilter(filterKey) {
|
|
126
|
-
const config = filterConfigs.find(c => c.key === filterKey);
|
|
127
|
-
if (!config) return;
|
|
128
|
-
|
|
129
|
-
try {
|
|
130
|
-
const targetModel = ctx.engine.getModel(leadsBlockUid);
|
|
131
|
-
if (!targetModel) {
|
|
132
|
-
ctx.message.warning(\`Target block not found (UID: \${leadsBlockUid})\`);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Clear previous filters
|
|
137
|
-
if (targetModel.resource.filters && targetModel.resource.filters[ctx.model.uid]) {
|
|
138
|
-
delete targetModel.resource.filters[ctx.model.uid];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Apply new filter
|
|
142
|
-
if (config.filter) {
|
|
143
|
-
targetModel.resource.addFilterGroup(ctx.model.uid, config.filter);
|
|
144
|
-
if (filterKey === 'all') {
|
|
145
|
-
ctx.message.info('Showing all leads');
|
|
146
|
-
} else {
|
|
147
|
-
ctx.message.success(\`Applied filter: \${config.label}\`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Refresh target block
|
|
152
|
-
targetModel.resource.refresh();
|
|
153
|
-
} catch (error) {
|
|
154
|
-
ctx.message.error('Filter failed: ' + error.message);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Calculate visible filters based on container width
|
|
159
|
-
function calculateVisibleFilters() {
|
|
160
|
-
const containerWidth = ctx.element.offsetWidth || 800;
|
|
161
|
-
const buttonWidth = 120;
|
|
162
|
-
const gap = 6;
|
|
163
|
-
const padding = 16;
|
|
164
|
-
const moreButtonWidth = 80;
|
|
165
|
-
|
|
166
|
-
const availableWidth = containerWidth - padding - moreButtonWidth;
|
|
167
|
-
const maxVisible = Math.floor(availableWidth / (buttonWidth + gap));
|
|
168
|
-
|
|
169
|
-
return Math.min(Math.max(3, maxVisible), filterConfigs.length);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Render function
|
|
173
|
-
function render() {
|
|
174
|
-
// Calculate how many filters to show based on container width
|
|
175
|
-
const maxVisible = calculateVisibleFilters();
|
|
176
|
-
const needsMore = filterConfigs.length > maxVisible;
|
|
177
|
-
|
|
178
|
-
// Determine filters to display
|
|
179
|
-
const displayFilters = isExpanded ? filterConfigs : filterConfigs.slice(0, maxVisible);
|
|
180
|
-
|
|
181
|
-
ctx.element.innerHTML = \`
|
|
182
|
-
<div style="padding: 8px; background: white; border-radius: 8px;">
|
|
183
|
-
<div style="display: flex; gap: 6px; flex-wrap: wrap;">
|
|
184
|
-
\${displayFilters.map(config => {
|
|
185
|
-
const count = statMapping[config.key] || 0;
|
|
186
|
-
const isActive = selectedFilter === config.key;
|
|
187
|
-
|
|
188
|
-
return \`
|
|
189
|
-
<button class="filter-btn" data-key="\${config.key}" style="
|
|
190
|
-
position: relative;
|
|
191
|
-
display: inline-flex;
|
|
192
|
-
align-items: center;
|
|
193
|
-
justify-content: center;
|
|
194
|
-
gap: 5px;
|
|
195
|
-
height: 32px;
|
|
196
|
-
padding: 0px 12px;
|
|
197
|
-
font-size: 14px;
|
|
198
|
-
font-weight: 400;
|
|
199
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
200
|
-
white-space: nowrap;
|
|
201
|
-
text-align: center;
|
|
202
|
-
border: 1px solid \${isActive ? 'transparent' : '#d9d9d9'};
|
|
203
|
-
border-radius: 6px;
|
|
204
|
-
background: \${isActive ? '#1677ff' : '#fff'};
|
|
205
|
-
color: \${isActive ? '#fff' : 'rgba(0,0,0,0.88)'};
|
|
206
|
-
box-shadow: \${isActive ? '0 2px 0 rgba(5,145,255,0.1)' : 'none'};
|
|
207
|
-
cursor: pointer;
|
|
208
|
-
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
209
|
-
user-select: none;
|
|
210
|
-
touch-action: manipulation;
|
|
211
|
-
outline: none;
|
|
212
|
-
-webkit-appearance: button;
|
|
213
|
-
box-sizing: border-box;
|
|
214
|
-
">
|
|
215
|
-
<i class="fas \${config.icon}" style="
|
|
216
|
-
font-size: 13px;
|
|
217
|
-
opacity: \${isActive ? '1' : '0.75'};
|
|
218
|
-
"></i>
|
|
219
|
-
<span>\${config.label}</span>
|
|
220
|
-
<span style="
|
|
221
|
-
background: \${isActive ? 'rgba(255,255,255,0.25)' : '#f0f0f0'};
|
|
222
|
-
color: \${isActive ? '#fff' : 'rgba(0,0,0,0.65)'};
|
|
223
|
-
padding: 0 5px;
|
|
224
|
-
height: 18px;
|
|
225
|
-
line-height: 18px;
|
|
226
|
-
border-radius: 9px;
|
|
227
|
-
font-size: 12px;
|
|
228
|
-
font-weight: 400;
|
|
229
|
-
min-width: 20px;
|
|
230
|
-
text-align: center;
|
|
231
|
-
display: inline-block;
|
|
232
|
-
">\${count}</span>
|
|
233
|
-
</button>
|
|
234
|
-
\`;
|
|
235
|
-
}).join('')}
|
|
236
|
-
|
|
237
|
-
\${needsMore ? \`
|
|
238
|
-
<button class="filter-btn" id="toggle-more" style="
|
|
239
|
-
position: relative;
|
|
240
|
-
display: inline-flex;
|
|
241
|
-
align-items: center;
|
|
242
|
-
justify-content: center;
|
|
243
|
-
gap: 5px;
|
|
244
|
-
height: 32px;
|
|
245
|
-
padding: 0px 12px;
|
|
246
|
-
font-size: 14px;
|
|
247
|
-
font-weight: 400;
|
|
248
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
249
|
-
white-space: nowrap;
|
|
250
|
-
text-align: center;
|
|
251
|
-
border: 1px solid #d9d9d9;
|
|
252
|
-
border-radius: 6px;
|
|
253
|
-
background: #fff;
|
|
254
|
-
color: #1677ff;
|
|
255
|
-
box-shadow: none;
|
|
256
|
-
cursor: pointer;
|
|
257
|
-
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
258
|
-
user-select: none;
|
|
259
|
-
touch-action: manipulation;
|
|
260
|
-
outline: none;
|
|
261
|
-
-webkit-appearance: button;
|
|
262
|
-
box-sizing: border-box;
|
|
263
|
-
">
|
|
264
|
-
<i class="fas fa-chevron-\${isExpanded ? 'up' : 'down'}" style="
|
|
265
|
-
font-size: 12px;
|
|
266
|
-
opacity: 0.75;
|
|
267
|
-
"></i>
|
|
268
|
-
<span>\${isExpanded ? 'Less' : 'More'}</span>
|
|
269
|
-
</button>
|
|
270
|
-
\` : ''}
|
|
271
|
-
</div>
|
|
272
|
-
</div>
|
|
273
|
-
|
|
274
|
-
<style>
|
|
275
|
-
.filter-btn:hover:not([style*="background: #1677ff"]) {
|
|
276
|
-
border-color: #4096ff !important;
|
|
277
|
-
color: #1677ff !important;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.filter-btn:active {
|
|
281
|
-
transform: scale(0.98);
|
|
282
|
-
}
|
|
283
|
-
</style>
|
|
284
|
-
\`;
|
|
285
|
-
|
|
286
|
-
// Bind events
|
|
287
|
-
bindEvents();
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Bind events
|
|
291
|
-
function bindEvents() {
|
|
292
|
-
const container = ctx.element.querySelector('div');
|
|
293
|
-
if (container) {
|
|
294
|
-
container.addEventListener('click', (e) => {
|
|
295
|
-
const btn = e.target.closest('.filter-btn');
|
|
296
|
-
if (btn && !btn.id) {
|
|
297
|
-
const key = btn.dataset.key;
|
|
298
|
-
selectedFilter = selectedFilter === key ? 'all' : key;
|
|
299
|
-
applyFilter(selectedFilter);
|
|
300
|
-
render();
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// Expand/collapse more
|
|
304
|
-
if (e.target.closest('#toggle-more')) {
|
|
305
|
-
isExpanded = !isExpanded;
|
|
306
|
-
render();
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Handle window resize
|
|
313
|
-
let resizeTimeout;
|
|
314
|
-
window.addEventListener('resize', () => {
|
|
315
|
-
clearTimeout(resizeTimeout);
|
|
316
|
-
resizeTimeout = setTimeout(() => {
|
|
317
|
-
render();
|
|
318
|
-
}, 250);
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
// Listen for data refresh
|
|
322
|
-
ctx.resource.on('refresh', () => {
|
|
323
|
-
const newStats = ctx.resource.getData()[0] || {};
|
|
324
|
-
|
|
325
|
-
// Update statistics data
|
|
326
|
-
Object.assign(stats, newStats);
|
|
327
|
-
|
|
328
|
-
// Update mapping
|
|
329
|
-
statMapping['all'] = newStats.total || 0;
|
|
330
|
-
statMapping['public'] = newStats.public_count || 0;
|
|
331
|
-
statMapping['my'] = newStats.my_count || 0;
|
|
332
|
-
statMapping['unqualified'] = newStats.unqualified_count || 0;
|
|
333
|
-
statMapping['initial'] = newStats.initial_count || 0;
|
|
334
|
-
statMapping['interest'] = newStats.interest_count || 0;
|
|
335
|
-
statMapping['followup'] = newStats.followup_count || 0;
|
|
336
|
-
statMapping['success'] = newStats.success_count || 0;
|
|
337
|
-
statMapping['web'] = newStats.web_count || 0;
|
|
338
|
-
statMapping['email'] = newStats.email_count || 0;
|
|
339
|
-
statMapping['today'] = newStats.today_count || 0;
|
|
340
|
-
statMapping['week'] = newStats.week_count || 0;
|
|
341
|
-
statMapping['month'] = newStats.month_count || 0;
|
|
342
|
-
|
|
343
|
-
render();
|
|
344
|
-
});`
|
|
345
|
-
};
|
|
@@ -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;
|