@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,324 +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 accounts_filter_ant_style_exports = {};
|
|
28
|
-
__export(accounts_filter_ant_style_exports, {
|
|
29
|
-
default: () => accounts_filter_ant_style_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(accounts_filter_ant_style_exports);
|
|
32
|
-
var accounts_filter_ant_style_default = {
|
|
33
|
-
name: "accounts_filter_ant_style",
|
|
34
|
-
content: String.raw`// Accounts Filter Block - Ant Design Style
|
|
35
|
-
// Configure block UID (needs to be replaced with actual UID)
|
|
36
|
-
const accountBlockUid = 'a233e6cd712'; // Replace with actual account 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: 'customer', label: 'Customers', icon: 'fa-users', filter: { type: 'Customer' } },
|
|
49
|
-
{ key: 'partner', label: 'Partners', icon: 'fa-handshake', filter: { type: 'Partner' } },
|
|
50
|
-
{ key: 'vendor', label: 'Vendors', icon: 'fa-truck', filter: { type: 'Vendor' } },
|
|
51
|
-
{ key: 'prospect', label: 'Prospects', icon: 'fa-user-plus', filter: { type: 'Prospect' } },
|
|
52
|
-
{ key: 'other', label: 'Other', icon: 'fa-question-circle', filter: { type: 'Other' } },
|
|
53
|
-
{ key: 'high_value', label: 'High Value', icon: 'fa-gem', filter: { annual_revenue: { $gte: 1000000 } } },
|
|
54
|
-
{ key: 'recent', label: 'Recent', icon: 'fa-clock', filter: { createdAt: { $gte: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString() } } },
|
|
55
|
-
{ key: 'my_accounts', label: 'My Accounts', icon: 'fa-user', filter: { owner_id: ctx.user?.id } }
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
// Save SQL configuration
|
|
59
|
-
if (ctx.flowSettingsEnabled) {
|
|
60
|
-
await ctx.sql.save({
|
|
61
|
-
uid: ctx.model.uid,
|
|
62
|
-
sql: \`
|
|
63
|
-
WITH account_stats AS (
|
|
64
|
-
SELECT
|
|
65
|
-
COUNT(*) as total,
|
|
66
|
-
COUNT(CASE WHEN type = 'Customer' THEN 1 END) as customer_count,
|
|
67
|
-
COUNT(CASE WHEN type = 'Partner' THEN 1 END) as partner_count,
|
|
68
|
-
COUNT(CASE WHEN type = 'Vendor' THEN 1 END) as vendor_count,
|
|
69
|
-
COUNT(CASE WHEN type = 'Prospect' THEN 1 END) as prospect_count,
|
|
70
|
-
COUNT(CASE WHEN type = 'Other' THEN 1 END) as other_count,
|
|
71
|
-
COUNT(CASE WHEN annual_revenue >= 1000000 THEN 1 END) as high_value_count,
|
|
72
|
-
COUNT(CASE WHEN "createdAt" >= CURRENT_DATE - INTERVAL '30 days' THEN 1 END) as recent_count,
|
|
73
|
-
COUNT(CASE WHEN owner_id = \${ctx.user?.id || 0} THEN 1 END) as my_accounts_count
|
|
74
|
-
FROM account
|
|
75
|
-
)
|
|
76
|
-
SELECT * FROM account_stats
|
|
77
|
-
\`,
|
|
78
|
-
dataSourceKey: 'main',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Use SQLResource
|
|
83
|
-
ctx.useResource('SQLResource');
|
|
84
|
-
ctx.resource.setDataSourceKey('main');
|
|
85
|
-
ctx.resource.setFilterByTk(ctx.model.uid);
|
|
86
|
-
|
|
87
|
-
// Query statistics data
|
|
88
|
-
await ctx.resource.refresh();
|
|
89
|
-
const stats = ctx.resource.getData()[0] || {};
|
|
90
|
-
|
|
91
|
-
// Map statistics data
|
|
92
|
-
const statMapping = {
|
|
93
|
-
'all': stats.total || 0,
|
|
94
|
-
'customer': stats.customer_count || 0,
|
|
95
|
-
'partner': stats.partner_count || 0,
|
|
96
|
-
'vendor': stats.vendor_count || 0,
|
|
97
|
-
'prospect': stats.prospect_count || 0,
|
|
98
|
-
'other': stats.other_count || 0,
|
|
99
|
-
'high_value': stats.high_value_count || 0,
|
|
100
|
-
'recent': stats.recent_count || 0,
|
|
101
|
-
'my_accounts': stats.my_accounts_count || 0
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// Apply filter
|
|
105
|
-
function applyFilter(filterKey) {
|
|
106
|
-
const config = filterConfigs.find(c => c.key === filterKey);
|
|
107
|
-
if (!config) return;
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
const targetModel = ctx.engine.getModel(accountBlockUid);
|
|
111
|
-
if (!targetModel) {
|
|
112
|
-
ctx.message.warning(\`Target block not found (UID: \${accountBlockUid})\`);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Clear previous filters
|
|
117
|
-
if (targetModel.resource.filters && targetModel.resource.filters[ctx.model.uid]) {
|
|
118
|
-
delete targetModel.resource.filters[ctx.model.uid];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Apply new filter
|
|
122
|
-
if (config.filter) {
|
|
123
|
-
targetModel.resource.addFilterGroup(ctx.model.uid, config.filter);
|
|
124
|
-
if (filterKey === 'all') {
|
|
125
|
-
ctx.message.info('Showing all accounts');
|
|
126
|
-
} else {
|
|
127
|
-
ctx.message.success(\`Applied filter: \${config.label}\`);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Refresh target block
|
|
132
|
-
targetModel.resource.refresh();
|
|
133
|
-
} catch (error) {
|
|
134
|
-
ctx.message.error('Filter failed: ' + error.message);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Calculate visible filters based on container width
|
|
139
|
-
function calculateVisibleFilters() {
|
|
140
|
-
// Estimate button width (average ~120px per button + gap)
|
|
141
|
-
const containerWidth = ctx.element.offsetWidth || 800;
|
|
142
|
-
const buttonWidth = 120;
|
|
143
|
-
const gap = 6;
|
|
144
|
-
const padding = 16;
|
|
145
|
-
const moreButtonWidth = 80;
|
|
146
|
-
|
|
147
|
-
// Calculate how many buttons can fit
|
|
148
|
-
const availableWidth = containerWidth - padding - moreButtonWidth;
|
|
149
|
-
const maxVisible = Math.floor(availableWidth / (buttonWidth + gap));
|
|
150
|
-
|
|
151
|
-
// Return at least 3, max all
|
|
152
|
-
return Math.min(Math.max(3, maxVisible), filterConfigs.length);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Render function
|
|
156
|
-
function render() {
|
|
157
|
-
// Calculate how many filters to show based on container width
|
|
158
|
-
const maxVisible = calculateVisibleFilters();
|
|
159
|
-
const needsMore = filterConfigs.length > maxVisible;
|
|
160
|
-
|
|
161
|
-
// Determine filters to display
|
|
162
|
-
const displayFilters = isExpanded ? filterConfigs : filterConfigs.slice(0, maxVisible);
|
|
163
|
-
|
|
164
|
-
ctx.element.innerHTML = \`
|
|
165
|
-
<div style="padding: 8px; background: white; border-radius: 8px;">
|
|
166
|
-
<div style="display: flex; gap: 6px; flex-wrap: wrap;">
|
|
167
|
-
\${displayFilters.map(config => {
|
|
168
|
-
const count = statMapping[config.key] || 0;
|
|
169
|
-
const isActive = selectedFilter === config.key;
|
|
170
|
-
|
|
171
|
-
return \`
|
|
172
|
-
<button class="filter-btn" data-key="\${config.key}" style="
|
|
173
|
-
position: relative;
|
|
174
|
-
display: inline-flex;
|
|
175
|
-
align-items: center;
|
|
176
|
-
justify-content: center;
|
|
177
|
-
gap: 5px;
|
|
178
|
-
height: 32px;
|
|
179
|
-
padding: 0px 12px;
|
|
180
|
-
font-size: 14px;
|
|
181
|
-
font-weight: 400;
|
|
182
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
183
|
-
white-space: nowrap;
|
|
184
|
-
text-align: center;
|
|
185
|
-
border: 1px solid \${isActive ? 'transparent' : '#d9d9d9'};
|
|
186
|
-
border-radius: 6px;
|
|
187
|
-
background: \${isActive ? '#1677ff' : '#fff'};
|
|
188
|
-
color: \${isActive ? '#fff' : 'rgba(0,0,0,0.88)'};
|
|
189
|
-
box-shadow: \${isActive ? '0 2px 0 rgba(5,145,255,0.1)' : 'none'};
|
|
190
|
-
cursor: pointer;
|
|
191
|
-
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
192
|
-
user-select: none;
|
|
193
|
-
touch-action: manipulation;
|
|
194
|
-
outline: none;
|
|
195
|
-
-webkit-appearance: button;
|
|
196
|
-
box-sizing: border-box;
|
|
197
|
-
">
|
|
198
|
-
<i class="fas \${config.icon}" style="
|
|
199
|
-
font-size: 13px;
|
|
200
|
-
opacity: \${isActive ? '1' : '0.75'};
|
|
201
|
-
"></i>
|
|
202
|
-
<span>\${config.label}</span>
|
|
203
|
-
<span style="
|
|
204
|
-
background: \${isActive ? 'rgba(255,255,255,0.25)' : '#f0f0f0'};
|
|
205
|
-
color: \${isActive ? '#fff' : 'rgba(0,0,0,0.65)'};
|
|
206
|
-
padding: 0 5px;
|
|
207
|
-
height: 18px;
|
|
208
|
-
line-height: 18px;
|
|
209
|
-
border-radius: 9px;
|
|
210
|
-
font-size: 12px;
|
|
211
|
-
font-weight: 400;
|
|
212
|
-
min-width: 20px;
|
|
213
|
-
text-align: center;
|
|
214
|
-
display: inline-block;
|
|
215
|
-
">\${count}</span>
|
|
216
|
-
</button>
|
|
217
|
-
\`;
|
|
218
|
-
}).join('')}
|
|
219
|
-
|
|
220
|
-
\${needsMore ? \`
|
|
221
|
-
<button class="filter-btn" id="toggle-more" style="
|
|
222
|
-
position: relative;
|
|
223
|
-
display: inline-flex;
|
|
224
|
-
align-items: center;
|
|
225
|
-
justify-content: center;
|
|
226
|
-
gap: 5px;
|
|
227
|
-
height: 32px;
|
|
228
|
-
padding: 0px 12px;
|
|
229
|
-
font-size: 14px;
|
|
230
|
-
font-weight: 400;
|
|
231
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
232
|
-
white-space: nowrap;
|
|
233
|
-
text-align: center;
|
|
234
|
-
border: 1px solid #d9d9d9;
|
|
235
|
-
border-radius: 6px;
|
|
236
|
-
background: #fff;
|
|
237
|
-
color: #1677ff;
|
|
238
|
-
box-shadow: none;
|
|
239
|
-
cursor: pointer;
|
|
240
|
-
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
241
|
-
user-select: none;
|
|
242
|
-
touch-action: manipulation;
|
|
243
|
-
outline: none;
|
|
244
|
-
-webkit-appearance: button;
|
|
245
|
-
box-sizing: border-box;
|
|
246
|
-
">
|
|
247
|
-
<i class="fas fa-chevron-\${isExpanded ? 'up' : 'down'}" style="
|
|
248
|
-
font-size: 12px;
|
|
249
|
-
opacity: 0.75;
|
|
250
|
-
"></i>
|
|
251
|
-
<span>\${isExpanded ? 'Less' : 'More'}</span>
|
|
252
|
-
</button>
|
|
253
|
-
\` : ''}
|
|
254
|
-
</div>
|
|
255
|
-
</div>
|
|
256
|
-
|
|
257
|
-
<style>
|
|
258
|
-
.filter-btn:hover:not([style*="background: #1677ff"]) {
|
|
259
|
-
border-color: #4096ff !important;
|
|
260
|
-
color: #1677ff !important;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.filter-btn:active {
|
|
264
|
-
transform: scale(0.98);
|
|
265
|
-
}
|
|
266
|
-
</style>
|
|
267
|
-
\`;
|
|
268
|
-
|
|
269
|
-
// Bind events
|
|
270
|
-
bindEvents();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Bind events
|
|
274
|
-
function bindEvents() {
|
|
275
|
-
const container = ctx.element.querySelector('div');
|
|
276
|
-
if (container) {
|
|
277
|
-
container.addEventListener('click', (e) => {
|
|
278
|
-
const btn = e.target.closest('.filter-btn');
|
|
279
|
-
if (btn && !btn.id) {
|
|
280
|
-
const key = btn.dataset.key;
|
|
281
|
-
selectedFilter = selectedFilter === key ? 'all' : key;
|
|
282
|
-
applyFilter(selectedFilter);
|
|
283
|
-
render();
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Expand/collapse more
|
|
287
|
-
if (e.target.closest('#toggle-more')) {
|
|
288
|
-
isExpanded = !isExpanded;
|
|
289
|
-
render();
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Handle window resize
|
|
296
|
-
let resizeTimeout;
|
|
297
|
-
window.addEventListener('resize', () => {
|
|
298
|
-
clearTimeout(resizeTimeout);
|
|
299
|
-
resizeTimeout = setTimeout(() => {
|
|
300
|
-
render();
|
|
301
|
-
}, 250);
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
// Listen for data refresh
|
|
305
|
-
ctx.resource.on('refresh', () => {
|
|
306
|
-
const newStats = ctx.resource.getData()[0] || {};
|
|
307
|
-
|
|
308
|
-
// Update statistics data
|
|
309
|
-
Object.assign(stats, newStats);
|
|
310
|
-
|
|
311
|
-
// Update mapping
|
|
312
|
-
statMapping['all'] = newStats.total || 0;
|
|
313
|
-
statMapping['customer'] = newStats.customer_count || 0;
|
|
314
|
-
statMapping['partner'] = newStats.partner_count || 0;
|
|
315
|
-
statMapping['vendor'] = newStats.vendor_count || 0;
|
|
316
|
-
statMapping['prospect'] = newStats.prospect_count || 0;
|
|
317
|
-
statMapping['other'] = newStats.other_count || 0;
|
|
318
|
-
statMapping['high_value'] = newStats.high_value_count || 0;
|
|
319
|
-
statMapping['recent'] = newStats.recent_count || 0;
|
|
320
|
-
statMapping['my_accounts'] = newStats.my_accounts_count || 0;
|
|
321
|
-
|
|
322
|
-
render();
|
|
323
|
-
});`
|
|
324
|
-
};
|
|
@@ -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,309 +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 contacts_filter_ant_style_exports = {};
|
|
28
|
-
__export(contacts_filter_ant_style_exports, {
|
|
29
|
-
default: () => contacts_filter_ant_style_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(contacts_filter_ant_style_exports);
|
|
32
|
-
var contacts_filter_ant_style_default = {
|
|
33
|
-
name: "contacts_filter_ant_style",
|
|
34
|
-
content: String.raw`// Contacts Filter Block - Ant Design Style
|
|
35
|
-
// Configure block UID (needs to be replaced with actual UID)
|
|
36
|
-
const contactBlockUid = 'YOUR_CONTACT_BLOCK_UID'; // Replace with actual contact 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: 'sales_dept', label: 'Sales', icon: 'fa-chart-line', filter: { department: 'Sales' } },
|
|
49
|
-
{ key: 'tech_dept', label: 'Technical', icon: 'fa-code', filter: { department: 'Technical' } },
|
|
50
|
-
{ key: 'manager_level', label: 'Managers', icon: 'fa-user-tie', filter: { title: { $in: ['Manager', 'Director', 'VP'] } } },
|
|
51
|
-
{ key: 'recent', label: 'Recent', icon: 'fa-clock', filter: { updatedAt: { $gte: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString() } } },
|
|
52
|
-
{ key: 'my_contacts', label: 'My Contacts', icon: 'fa-user', filter: { owner_id: ctx.user?.id } }
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
// Save SQL configuration
|
|
56
|
-
if (ctx.flowSettingsEnabled) {
|
|
57
|
-
await ctx.sql.save({
|
|
58
|
-
uid: ctx.model.uid,
|
|
59
|
-
sql: \`
|
|
60
|
-
WITH contact_stats AS (
|
|
61
|
-
SELECT
|
|
62
|
-
COUNT(*) as total,
|
|
63
|
-
COUNT(CASE WHEN department = 'Sales' THEN 1 END) as sales_count,
|
|
64
|
-
COUNT(CASE WHEN department = 'Technical' THEN 1 END) as tech_count,
|
|
65
|
-
COUNT(CASE WHEN title IN ('Manager', 'Director', 'VP') THEN 1 END) as manager_count,
|
|
66
|
-
COUNT(CASE WHEN "updatedAt" >= CURRENT_DATE - INTERVAL '7 days' THEN 1 END) as recent_count,
|
|
67
|
-
COUNT(CASE WHEN owner_id = \${ctx.user?.id || 0} THEN 1 END) as my_contacts_count
|
|
68
|
-
FROM contact
|
|
69
|
-
)
|
|
70
|
-
SELECT * FROM contact_stats
|
|
71
|
-
\`,
|
|
72
|
-
dataSourceKey: 'main',
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Use SQLResource
|
|
77
|
-
ctx.useResource('SQLResource');
|
|
78
|
-
ctx.resource.setDataSourceKey('main');
|
|
79
|
-
ctx.resource.setFilterByTk(ctx.model.uid);
|
|
80
|
-
|
|
81
|
-
// Query statistics data
|
|
82
|
-
await ctx.resource.refresh();
|
|
83
|
-
const stats = ctx.resource.getData()[0] || {};
|
|
84
|
-
|
|
85
|
-
// Map statistics data
|
|
86
|
-
const statMapping = {
|
|
87
|
-
'all': stats.total || 0,
|
|
88
|
-
'sales_dept': stats.sales_count || 0,
|
|
89
|
-
'tech_dept': stats.tech_count || 0,
|
|
90
|
-
'manager_level': stats.manager_count || 0,
|
|
91
|
-
'recent': stats.recent_count || 0,
|
|
92
|
-
'my_contacts': stats.my_contacts_count || 0
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// Apply filter
|
|
96
|
-
function applyFilter(filterKey) {
|
|
97
|
-
const config = filterConfigs.find(c => c.key === filterKey);
|
|
98
|
-
if (!config) return;
|
|
99
|
-
|
|
100
|
-
try {
|
|
101
|
-
const targetModel = ctx.engine.getModel(contactBlockUid);
|
|
102
|
-
if (!targetModel) {
|
|
103
|
-
ctx.message.warning(\`Target block not found (UID: \${contactBlockUid})\`);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Clear previous filters
|
|
108
|
-
if (targetModel.resource.filters && targetModel.resource.filters[ctx.model.uid]) {
|
|
109
|
-
delete targetModel.resource.filters[ctx.model.uid];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Apply new filter
|
|
113
|
-
if (config.filter) {
|
|
114
|
-
targetModel.resource.addFilterGroup(ctx.model.uid, config.filter);
|
|
115
|
-
if (filterKey === 'all') {
|
|
116
|
-
ctx.message.info('Showing all contacts');
|
|
117
|
-
} else {
|
|
118
|
-
ctx.message.success(\`Applied filter: \${config.label}\`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Refresh target block
|
|
123
|
-
targetModel.resource.refresh();
|
|
124
|
-
} catch (error) {
|
|
125
|
-
ctx.message.error('Filter failed: ' + error.message);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Calculate visible filters based on container width
|
|
130
|
-
function calculateVisibleFilters() {
|
|
131
|
-
const containerWidth = ctx.element.offsetWidth || 800;
|
|
132
|
-
const buttonWidth = 120;
|
|
133
|
-
const gap = 6;
|
|
134
|
-
const padding = 16;
|
|
135
|
-
const moreButtonWidth = 80;
|
|
136
|
-
|
|
137
|
-
const availableWidth = containerWidth - padding - moreButtonWidth;
|
|
138
|
-
const maxVisible = Math.floor(availableWidth / (buttonWidth + gap));
|
|
139
|
-
|
|
140
|
-
return Math.min(Math.max(3, maxVisible), filterConfigs.length);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Render function
|
|
144
|
-
function render() {
|
|
145
|
-
// Calculate how many filters to show based on container width
|
|
146
|
-
const maxVisible = calculateVisibleFilters();
|
|
147
|
-
const needsMore = filterConfigs.length > maxVisible;
|
|
148
|
-
|
|
149
|
-
// Determine filters to display
|
|
150
|
-
const displayFilters = isExpanded ? filterConfigs : filterConfigs.slice(0, maxVisible);
|
|
151
|
-
|
|
152
|
-
ctx.element.innerHTML = \`
|
|
153
|
-
<div style="padding: 8px; background: white; border-radius: 8px;">
|
|
154
|
-
<div style="display: flex; gap: 6px; flex-wrap: wrap;">
|
|
155
|
-
\${displayFilters.map(config => {
|
|
156
|
-
const count = statMapping[config.key] || 0;
|
|
157
|
-
const isActive = selectedFilter === config.key;
|
|
158
|
-
|
|
159
|
-
return \`
|
|
160
|
-
<button class="filter-btn" data-key="\${config.key}" style="
|
|
161
|
-
position: relative;
|
|
162
|
-
display: inline-flex;
|
|
163
|
-
align-items: center;
|
|
164
|
-
justify-content: center;
|
|
165
|
-
gap: 5px;
|
|
166
|
-
height: 32px;
|
|
167
|
-
padding: 0px 12px;
|
|
168
|
-
font-size: 14px;
|
|
169
|
-
font-weight: 400;
|
|
170
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
171
|
-
white-space: nowrap;
|
|
172
|
-
text-align: center;
|
|
173
|
-
border: 1px solid \${isActive ? 'transparent' : '#d9d9d9'};
|
|
174
|
-
border-radius: 6px;
|
|
175
|
-
background: \${isActive ? '#1677ff' : '#fff'};
|
|
176
|
-
color: \${isActive ? '#fff' : 'rgba(0,0,0,0.88)'};
|
|
177
|
-
box-shadow: \${isActive ? '0 2px 0 rgba(5,145,255,0.1)' : 'none'};
|
|
178
|
-
cursor: pointer;
|
|
179
|
-
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
180
|
-
user-select: none;
|
|
181
|
-
touch-action: manipulation;
|
|
182
|
-
outline: none;
|
|
183
|
-
-webkit-appearance: button;
|
|
184
|
-
box-sizing: border-box;
|
|
185
|
-
">
|
|
186
|
-
<i class="fas \${config.icon}" style="
|
|
187
|
-
font-size: 13px;
|
|
188
|
-
opacity: \${isActive ? '1' : '0.75'};
|
|
189
|
-
"></i>
|
|
190
|
-
<span>\${config.label}</span>
|
|
191
|
-
<span style="
|
|
192
|
-
background: \${isActive ? 'rgba(255,255,255,0.25)' : '#f0f0f0'};
|
|
193
|
-
color: \${isActive ? '#fff' : 'rgba(0,0,0,0.65)'};
|
|
194
|
-
padding: 0 5px;
|
|
195
|
-
height: 18px;
|
|
196
|
-
line-height: 18px;
|
|
197
|
-
border-radius: 9px;
|
|
198
|
-
font-size: 12px;
|
|
199
|
-
font-weight: 400;
|
|
200
|
-
min-width: 20px;
|
|
201
|
-
text-align: center;
|
|
202
|
-
display: inline-block;
|
|
203
|
-
">\${count}</span>
|
|
204
|
-
</button>
|
|
205
|
-
\`;
|
|
206
|
-
}).join('')}
|
|
207
|
-
|
|
208
|
-
\${needsMore ? \`
|
|
209
|
-
<button class="filter-btn" id="toggle-more" style="
|
|
210
|
-
position: relative;
|
|
211
|
-
display: inline-flex;
|
|
212
|
-
align-items: center;
|
|
213
|
-
justify-content: center;
|
|
214
|
-
gap: 5px;
|
|
215
|
-
height: 32px;
|
|
216
|
-
padding: 0px 12px;
|
|
217
|
-
font-size: 14px;
|
|
218
|
-
font-weight: 400;
|
|
219
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
220
|
-
white-space: nowrap;
|
|
221
|
-
text-align: center;
|
|
222
|
-
border: 1px solid #d9d9d9;
|
|
223
|
-
border-radius: 6px;
|
|
224
|
-
background: #fff;
|
|
225
|
-
color: #1677ff;
|
|
226
|
-
box-shadow: none;
|
|
227
|
-
cursor: pointer;
|
|
228
|
-
transition: all 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
229
|
-
user-select: none;
|
|
230
|
-
touch-action: manipulation;
|
|
231
|
-
outline: none;
|
|
232
|
-
-webkit-appearance: button;
|
|
233
|
-
box-sizing: border-box;
|
|
234
|
-
">
|
|
235
|
-
<i class="fas fa-chevron-\${isExpanded ? 'up' : 'down'}" style="
|
|
236
|
-
font-size: 12px;
|
|
237
|
-
opacity: 0.75;
|
|
238
|
-
"></i>
|
|
239
|
-
<span>\${isExpanded ? 'Less' : 'More'}</span>
|
|
240
|
-
</button>
|
|
241
|
-
\` : ''}
|
|
242
|
-
</div>
|
|
243
|
-
</div>
|
|
244
|
-
|
|
245
|
-
<style>
|
|
246
|
-
.filter-btn:hover:not([style*="background: #1677ff"]) {
|
|
247
|
-
border-color: #4096ff !important;
|
|
248
|
-
color: #1677ff !important;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.filter-btn:active {
|
|
252
|
-
transform: scale(0.98);
|
|
253
|
-
}
|
|
254
|
-
</style>
|
|
255
|
-
\`;
|
|
256
|
-
|
|
257
|
-
// Bind events
|
|
258
|
-
bindEvents();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Bind events
|
|
262
|
-
function bindEvents() {
|
|
263
|
-
const container = ctx.element.querySelector('div');
|
|
264
|
-
if (container) {
|
|
265
|
-
container.addEventListener('click', (e) => {
|
|
266
|
-
const btn = e.target.closest('.filter-btn');
|
|
267
|
-
if (btn && !btn.id) {
|
|
268
|
-
const key = btn.dataset.key;
|
|
269
|
-
selectedFilter = selectedFilter === key ? 'all' : key;
|
|
270
|
-
applyFilter(selectedFilter);
|
|
271
|
-
render();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// Expand/collapse more
|
|
275
|
-
if (e.target.closest('#toggle-more')) {
|
|
276
|
-
isExpanded = !isExpanded;
|
|
277
|
-
render();
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// Handle window resize
|
|
284
|
-
let resizeTimeout;
|
|
285
|
-
window.addEventListener('resize', () => {
|
|
286
|
-
clearTimeout(resizeTimeout);
|
|
287
|
-
resizeTimeout = setTimeout(() => {
|
|
288
|
-
render();
|
|
289
|
-
}, 250);
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
// Listen for data refresh
|
|
293
|
-
ctx.resource.on('refresh', () => {
|
|
294
|
-
const newStats = ctx.resource.getData()[0] || {};
|
|
295
|
-
|
|
296
|
-
// Update statistics data
|
|
297
|
-
Object.assign(stats, newStats);
|
|
298
|
-
|
|
299
|
-
// Update mapping
|
|
300
|
-
statMapping['all'] = newStats.total || 0;
|
|
301
|
-
statMapping['sales_dept'] = newStats.sales_count || 0;
|
|
302
|
-
statMapping['tech_dept'] = newStats.tech_count || 0;
|
|
303
|
-
statMapping['manager_level'] = newStats.manager_count || 0;
|
|
304
|
-
statMapping['recent'] = newStats.recent_count || 0;
|
|
305
|
-
statMapping['my_contacts'] = newStats.my_contacts_count || 0;
|
|
306
|
-
|
|
307
|
-
render();
|
|
308
|
-
});`
|
|
309
|
-
};
|
|
@@ -1,15 +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
|
-
'en-US': {
|
|
11
|
-
name: string;
|
|
12
|
-
content: string;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
export default _default;
|