@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.
Files changed (175) hide show
  1. package/dist/{server/ai-employees/built-in/data-modeling/prompt.d.ts → ai/ai-employees/cole.d.ts} +1 -3
  2. package/dist/{server/ai-employees/built-in/nocobase-assistant/prompt.js → ai/ai-employees/cole.js} +15 -7
  3. package/dist/{server/ai-employees/built-in/data-organizer/prompt.d.ts → ai/ai-employees/dara.d.ts} +1 -3
  4. package/dist/{server/ai-employees/built-in/data-visualization/prompt.js → ai/ai-employees/dara.js} +21 -13
  5. package/dist/{server/ai-employees/built-in/data-visualization/prompt.d.ts → ai/ai-employees/dex.d.ts} +1 -3
  6. package/dist/{server/ai-employees/built-in/data-organizer/prompt.js → ai/ai-employees/dex.js} +15 -7
  7. package/dist/ai/ai-employees/ellis.d.ts +10 -0
  8. package/dist/{server/ai-employees/built-in/email-assistant/prompt.js → ai/ai-employees/ellis.js} +19 -11
  9. package/dist/ai/ai-employees/lexi.d.ts +10 -0
  10. package/dist/{server/ai-employees/built-in/translator/prompt.js → ai/ai-employees/lexi.js} +15 -7
  11. package/dist/ai/ai-employees/vera.d.ts +10 -0
  12. package/dist/{server/ai-employees/built-in/research-analyst/prompt.js → ai/ai-employees/vera.js} +15 -7
  13. package/dist/ai/ai-employees/viz.d.ts +10 -0
  14. package/dist/{server/ai-employees/built-in/insights-analyst/prompt.js → ai/ai-employees/viz.js} +15 -7
  15. package/dist/ai/skills/document-search/SKILLS.md +69 -0
  16. package/dist/ai/tools/chartGenerator.js +14 -3
  17. package/dist/ai/tools/formFiller.js +13 -2
  18. package/dist/{server/ai-employees/built-in/ai-coding/prompt.d.ts → ai/tools/getSkill.d.ts} +1 -3
  19. package/dist/{server/ai-employees/built-in/data-modeling/index.js → ai/tools/getSkill.js} +39 -32
  20. package/dist/ai/tools/suggestions.js +13 -2
  21. package/dist/client/{a06081a2b06f1c14.js → 200ac94fc7f6e97b.js} +1 -1
  22. package/dist/client/27539a4356faebb1.js +10 -0
  23. package/dist/client/2db4faf814179140.js +10 -0
  24. package/dist/client/{521c94db45b1e031.js → 4f9117811ffc7ab3.js} +1 -1
  25. package/dist/client/{c49557cc10afc6b2.js → 5af11e24bcb39ac4.js} +1 -1
  26. package/dist/client/62bf6ed27c8de0df.js +10 -0
  27. package/dist/client/6dc8c9b641452067.js +10 -0
  28. package/dist/client/8169eb2b48edf6c7.js +10 -0
  29. package/dist/client/81f6436fd9322dc1.js +10 -0
  30. package/dist/client/{33811690df6f43ba.js → 85af3d6d85eb5b2b.js} +1 -1
  31. package/dist/client/87bc4d3cb55e4006.js +10 -0
  32. package/dist/client/9ac11803370a9625.js +10 -0
  33. package/dist/client/9c00efb8eb0b4d69.js +10 -0
  34. package/dist/client/{f74949b95f9bbb91.js → a4948d5b70172a69.js} +1 -1
  35. package/dist/client/ai-employees/admin/SkillSettings.d.ts +7 -5
  36. 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
  37. package/dist/client/ai-employees/admin/mcp/MCPSettings.d.ts +10 -0
  38. package/dist/client/ai-employees/admin/mcp/MCPToolsList.d.ts +19 -0
  39. package/dist/client/ai-employees/admin/mcp/context.d.ts +15 -0
  40. package/dist/client/ai-employees/admin/mcp/schemas.d.ts +1286 -0
  41. package/dist/client/ai-employees/chatbox/utils.d.ts +3 -7
  42. package/dist/client/ai-employees/types.d.ts +5 -4
  43. package/dist/client/c83c2cae956ba914.js +10 -0
  44. package/dist/client/{6fcc98eb80deed47.js → d4e2ed9fa44a82b2.js} +1 -1
  45. package/dist/client/{5be6710cc905ec12.js → f944d487b7ff1f00.js} +1 -1
  46. package/dist/client/index.js +2 -2
  47. package/dist/client/repositories/AIConfigRepository.d.ts +8 -1
  48. package/dist/collections/ai-employees.js +2 -1
  49. package/dist/collections/ai-mcp-clients.d.ts +51 -0
  50. package/dist/collections/ai-mcp-clients.js +111 -0
  51. package/dist/externalVersion.js +14 -14
  52. package/dist/locale/en-US.json +65 -8
  53. package/dist/locale/zh-CN.json +66 -9
  54. package/dist/node_modules/fast-glob/package.json +1 -1
  55. package/dist/node_modules/flexsearch/package.json +1 -1
  56. package/dist/node_modules/fs-extra/package.json +1 -1
  57. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  58. package/dist/node_modules/openai/package.json +1 -1
  59. package/dist/node_modules/zod/package.json +1 -1
  60. package/dist/server/ai-employees/ai-employee.d.ts +5 -1
  61. package/dist/server/ai-employees/ai-employee.js +90 -13
  62. package/dist/server/ai-employees/middleware/index.d.ts +1 -0
  63. package/dist/server/ai-employees/middleware/index.js +2 -0
  64. package/dist/server/ai-employees/middleware/skill-tools.d.ts +12 -0
  65. package/dist/server/ai-employees/middleware/skill-tools.js +74 -0
  66. package/dist/server/ai-employees/prompts.d.ts +6 -1
  67. package/dist/server/ai-employees/prompts.js +9 -1
  68. package/dist/server/ai-employees/templates/form-assistant.d.ts +2 -2
  69. package/dist/server/ai-employees/templates/form-assistant.js +2 -2
  70. package/dist/server/ai-employees/utils.js +2 -2
  71. package/dist/server/{ai-employees/built-in/ai-coding/document/basic/flow-resource.d.ts → collections/ai-mcp-clients.d.ts} +1 -4
  72. package/dist/server/{ai-employees/built-in/ai-coding/prompt.js → collections/ai-mcp-clients.js} +12 -10
  73. 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
  74. package/dist/server/{migrations/20250923221107-setup-build-in.js → collections/ai-skills.js} +46 -13
  75. package/dist/server/manager/ai-coding-manager.d.ts +1 -2
  76. package/dist/server/manager/ai-coding-manager.js +0 -41
  77. package/dist/server/manager/built-in-manager.d.ts +2 -4
  78. package/dist/server/manager/built-in-manager.js +7 -118
  79. package/dist/server/migrations/20260306000001-migrate-skill-settings-tools.js +68 -0
  80. package/dist/server/plugin.d.ts +0 -1
  81. package/dist/server/plugin.js +17 -8
  82. package/dist/server/resource/aiEmployees.js +5 -7
  83. 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
  84. package/dist/server/resource/aiMcpClients.js +78 -0
  85. package/dist/server/{ai-employees/built-in/ai-coding/document/example/js-column/index.d.ts → resource/aiSkills.d.ts} +3 -7
  86. package/dist/server/resource/aiSkills.js +71 -0
  87. package/dist/server/resource/aiTools.js +4 -6
  88. package/dist/server/tools/docs.js +2 -2
  89. package/dist/server/tools/workflow-caller.js +1 -0
  90. package/package.json +2 -2
  91. package/dist/client/16dbe01d9077bb74.js +0 -10
  92. package/dist/client/180c8b1051a4f36e.js +0 -10
  93. package/dist/client/41229e007006e7f6.js +0 -10
  94. package/dist/client/41950da4c64caf73.js +0 -10
  95. package/dist/client/585ba360c7c57caf.js +0 -10
  96. package/dist/client/9f62a4c5136dfe8b.js +0 -10
  97. package/dist/client/b7f721f8dabb54e5.js +0 -10
  98. package/dist/client/bc471dd60174458c.js +0 -10
  99. package/dist/client/c40ed1a900aefb67.js +0 -10
  100. package/dist/server/ai-employees/built-in/ai-coding/document/basic/flow-resource.js +0 -256
  101. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/index.js +0 -48
  102. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_accounts_en.js +0 -452
  103. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_contacts_en.js +0 -363
  104. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_opportunities_en.js +0 -270
  105. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.d.ts +0 -13
  106. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_quotations_en.js +0 -219
  107. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.d.ts +0 -13
  108. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-column/js_columns_for_tickets_en.js +0 -409
  109. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.d.ts +0 -13
  110. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/accounts_filter_ant_style.js +0 -324
  111. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.d.ts +0 -13
  112. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/contacts_filter_ant_style.js +0 -309
  113. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/index.d.ts +0 -15
  114. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/index.js +0 -50
  115. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.d.ts +0 -13
  116. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/leads_filter_ant_style.js +0 -345
  117. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.d.ts +0 -13
  118. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/opportunities_filter_ant_style.js +0 -381
  119. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.d.ts +0 -13
  120. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/product_categories_ant_style.js +0 -545
  121. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.d.ts +0 -13
  122. package/dist/server/ai-employees/built-in/ai-coding/document/example/js-filter/tickets_filter_ant_style.js +0 -346
  123. package/dist/server/ai-employees/built-in/ai-coding/document/js-action.d.ts +0 -13
  124. package/dist/server/ai-employees/built-in/ai-coding/document/js-action.js +0 -102
  125. package/dist/server/ai-employees/built-in/ai-coding/document/js-block.d.ts +0 -13
  126. package/dist/server/ai-employees/built-in/ai-coding/document/js-block.js +0 -314
  127. package/dist/server/ai-employees/built-in/ai-coding/document/js-column.d.ts +0 -13
  128. package/dist/server/ai-employees/built-in/ai-coding/document/js-column.js +0 -113
  129. package/dist/server/ai-employees/built-in/ai-coding/document/js-field.d.ts +0 -13
  130. package/dist/server/ai-employees/built-in/ai-coding/document/js-field.js +0 -498
  131. package/dist/server/ai-employees/built-in/ai-coding/document/js-item.d.ts +0 -13
  132. package/dist/server/ai-employees/built-in/ai-coding/document/js-item.js +0 -184
  133. package/dist/server/ai-employees/built-in/ai-coding/index.d.ts +0 -37
  134. package/dist/server/ai-employees/built-in/ai-coding/index.js +0 -99
  135. package/dist/server/ai-employees/built-in/ai-coding/profile.d.ts +0 -27
  136. package/dist/server/ai-employees/built-in/ai-coding/profile.js +0 -60
  137. package/dist/server/ai-employees/built-in/ai-coding/prompt_en.md +0 -110
  138. package/dist/server/ai-employees/built-in/data-modeling/index.d.ts +0 -37
  139. package/dist/server/ai-employees/built-in/data-modeling/profile.d.ts +0 -27
  140. package/dist/server/ai-employees/built-in/data-modeling/profile.js +0 -60
  141. package/dist/server/ai-employees/built-in/data-modeling/prompt.js +0 -283
  142. package/dist/server/ai-employees/built-in/data-organizer/index.d.ts +0 -37
  143. package/dist/server/ai-employees/built-in/data-organizer/index.js +0 -63
  144. package/dist/server/ai-employees/built-in/data-organizer/profile.d.ts +0 -27
  145. package/dist/server/ai-employees/built-in/data-organizer/profile.js +0 -60
  146. package/dist/server/ai-employees/built-in/data-visualization/index.d.ts +0 -37
  147. package/dist/server/ai-employees/built-in/data-visualization/index.js +0 -58
  148. package/dist/server/ai-employees/built-in/data-visualization/profile.d.ts +0 -27
  149. package/dist/server/ai-employees/built-in/data-visualization/profile.js +0 -60
  150. package/dist/server/ai-employees/built-in/email-assistant/index.d.ts +0 -34
  151. package/dist/server/ai-employees/built-in/email-assistant/index.js +0 -50
  152. package/dist/server/ai-employees/built-in/email-assistant/profile.d.ts +0 -27
  153. package/dist/server/ai-employees/built-in/email-assistant/profile.js +0 -60
  154. package/dist/server/ai-employees/built-in/email-assistant/prompt.d.ts +0 -12
  155. package/dist/server/ai-employees/built-in/insights-analyst/index.d.ts +0 -37
  156. package/dist/server/ai-employees/built-in/insights-analyst/index.js +0 -63
  157. package/dist/server/ai-employees/built-in/insights-analyst/profile.d.ts +0 -27
  158. package/dist/server/ai-employees/built-in/insights-analyst/profile.js +0 -60
  159. package/dist/server/ai-employees/built-in/insights-analyst/prompt.d.ts +0 -12
  160. package/dist/server/ai-employees/built-in/nocobase-assistant/index.d.ts +0 -34
  161. package/dist/server/ai-employees/built-in/nocobase-assistant/index.js +0 -50
  162. package/dist/server/ai-employees/built-in/nocobase-assistant/profile.d.ts +0 -27
  163. package/dist/server/ai-employees/built-in/nocobase-assistant/profile.js +0 -60
  164. package/dist/server/ai-employees/built-in/nocobase-assistant/prompt.d.ts +0 -12
  165. package/dist/server/ai-employees/built-in/research-analyst/index.d.ts +0 -37
  166. package/dist/server/ai-employees/built-in/research-analyst/index.js +0 -63
  167. package/dist/server/ai-employees/built-in/research-analyst/profile.d.ts +0 -27
  168. package/dist/server/ai-employees/built-in/research-analyst/profile.js +0 -60
  169. package/dist/server/ai-employees/built-in/research-analyst/prompt.d.ts +0 -12
  170. package/dist/server/ai-employees/built-in/translator/index.d.ts +0 -37
  171. package/dist/server/ai-employees/built-in/translator/index.js +0 -67
  172. package/dist/server/ai-employees/built-in/translator/profile.d.ts +0 -27
  173. package/dist/server/ai-employees/built-in/translator/profile.js +0 -60
  174. package/dist/server/ai-employees/built-in/translator/prompt.d.ts +0 -12
  175. /package/dist/server/migrations/{20250923221107-setup-build-in.d.ts → 20260306000001-migrate-skill-settings-tools.d.ts} +0 -0
@@ -1,219 +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_columns_for_quotations_en_exports = {};
28
- __export(js_columns_for_quotations_en_exports, {
29
- default: () => js_columns_for_quotations_en_default
30
- });
31
- module.exports = __toCommonJS(js_columns_for_quotations_en_exports);
32
- var js_columns_for_quotations_en_default = {
33
- name: "js_columns_for_quotations",
34
- content: String.raw`# NocoBase JS Column Examples - Quotations Table
35
-
36
- ## Overview
37
- Practical JavaScript column examples for the quotations table in CRM systems. These aggregated columns integrate amount calculations, status workflows, and validity management to enhance quotation management efficiency.
38
-
39
- ## Selected JS Column Examples
40
-
41
- ## 1. Quotation Number Card
42
-
43
- Displays quotation number, name, and status with highlighted important information.
44
-
45
- \`\`\`javascript
46
- // Quotation number card - Code, name, status
47
- const code = ctx.record?.code || 'N/A';
48
- const name = ctx.record?.name || 'Untitled Quote';
49
- const status = ctx.record?.status || 'Draft';
50
-
51
- // Status configuration - Minimalist style
52
- const statusConfig = {
53
- 'Draft': { color: '#8c8c8c', label: 'Draft' },
54
- 'Pending Approval': { color: '#faad14', label: 'Pending' },
55
- 'Approved': { color: '#1677ff', label: 'Approved' },
56
- 'Rejected': { color: '#ff4d4f', label: 'Rejected' },
57
- 'Sent to Client': { color: '#13c2c2', label: 'Sent' },
58
- 'Accepted': { color: '#52c41a', label: 'Accepted' }
59
- };
60
-
61
- const config = statusConfig[status] || statusConfig['Draft'];
62
-
63
- ctx.element.innerHTML = \`
64
- <div style="
65
- display: flex;
66
- flex-direction: column;
67
- gap: 3px;
68
- padding: 0;
69
- ">
70
- <div style="
71
- font-family: 'SF Mono', Monaco, monospace;
72
- font-size: 12px;
73
- font-weight: 600;
74
- color: #000;
75
- overflow: hidden;
76
- text-overflow: ellipsis;
77
- white-space: nowrap;
78
- " title="\${code}">
79
- \${code}
80
- </div>
81
- <div style="
82
- color: #666;
83
- font-size: 11px;
84
- overflow: hidden;
85
- text-overflow: ellipsis;
86
- white-space: nowrap;
87
- " title="\${name}">
88
- \${name}
89
- </div>
90
- <div style="
91
- display: inline-flex;
92
- align-items: center;
93
- padding: 2px 6px;
94
- background: \${config.color}15;
95
- color: \${config.color};
96
- border-radius: 3px;
97
- font-size: 10px;
98
- font-weight: 500;
99
- align-self: flex-start;
100
- ">
101
- \${config.label}
102
- </div>
103
- </div>
104
- \`;
105
- \`\`\`
106
-
107
- ## 2. Amount Summary Panel
108
-
109
- Displays detailed fees and total amount with clear price breakdown.
110
-
111
- \`\`\`javascript
112
- // Amount summary panel - Display fee breakdown
113
- const subTotal = ctx.record?.sub_total || 0;
114
- const taxAmount = ctx.record?.tax_amount || 0;
115
- const taxRate = ctx.record?.tax_rate || 0;
116
- const shippingHandling = ctx.record?.shipping_handling || 0;
117
- const totalAmount = ctx.record?.total_amount || 0;
118
-
119
- // Simple formatting function
120
- const formatCurrency = (amount) => {
121
- const num = parseFloat(amount) || 0;
122
- return '$' + num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
123
- };
124
-
125
- // Calculate discount percentage (if any)
126
- const expectedTotal = subTotal + taxAmount + shippingHandling;
127
- const discount = subTotal > 0 && totalAmount < expectedTotal
128
- ? ((expectedTotal - totalAmount) / subTotal * 100).toFixed(1)
129
- : 0;
130
-
131
- ctx.element.innerHTML = \`
132
- <div style="
133
- display: flex;
134
- flex-direction: column;
135
- gap: 4px;
136
- padding: 0;
137
- min-width: 140px;
138
- ">
139
- <div style="display: flex; justify-content: space-between; align-items: center;">
140
- <span style="color: #8c8c8c; font-size: 11px;">Subtotal</span>
141
- <span style="color: #000; font-size: 11px;">
142
- \${formatCurrency(subTotal)}
143
- </span>
144
- </div>
145
-
146
- \${taxAmount > 0 ? \`
147
- <div style="display: flex; justify-content: space-between; align-items: center;">
148
- <span style="color: #8c8c8c; font-size: 11px;">
149
- Tax\${taxRate > 0 ? \` \${(taxRate * 100).toFixed(1)}%\` : ''}
150
- </span>
151
- <span style="color: #595959; font-size: 11px;">
152
- \${formatCurrency(taxAmount)}
153
- </span>
154
- </div>
155
- \` : ''}
156
-
157
- \${shippingHandling > 0 ? \`
158
- <div style="display: flex; justify-content: space-between; align-items: center;">
159
- <span style="color: #8c8c8c; font-size: 11px;">Shipping</span>
160
- <span style="color: #595959; font-size: 11px;">
161
- \${formatCurrency(shippingHandling)}
162
- </span>
163
- </div>
164
- \` : ''}
165
-
166
- \${discount > 0 ? \`
167
- <div style="display: flex; justify-content: space-between; align-items: center;">
168
- <span style="color: #ff4d4f; font-size: 11px;">Discount</span>
169
- <span style="color: #ff4d4f; font-size: 11px;">
170
- -\${discount}%
171
- </span>
172
- </div>
173
- \` : ''}
174
-
175
- <div style="
176
- border-top: 1px solid #e5e7eb;
177
- padding-top: 4px;
178
- margin-top: 2px;
179
- display: flex;
180
- justify-content: space-between;
181
- align-items: center;
182
- ">
183
- <span style="color: #000; font-size: 12px; font-weight: 600;">Total</span>
184
- <span style="
185
- color: #000;
186
- font-size: 14px;
187
- font-weight: 600;
188
- ">\${formatCurrency(totalAmount)}</span>
189
- </div>
190
- </div>
191
- \`;
192
- \`\`\`
193
-
194
- ## Usage Instructions
195
-
196
- ### Configuration in NocoBase
197
- 1. Navigate to the quotations table configuration interface
198
- 2. Add a new column and select "JavaScript" type
199
- 3. Paste the corresponding code into the code editor
200
- 4. Save and refresh the table to see the effects
201
-
202
- ### Data Dependencies
203
- - **Amount fields**: Ensure sub_total, tax_amount, shipping_handling, total_amount have correct values
204
- - **Related data**: account, opportunity, contact require proper relationship configuration
205
- - **Date fields**: valid_date for validity calculation
206
- - **Status field**: status for approval workflow display
207
-
208
- ### Performance Optimization
209
- - Complete amount calculations at database level when possible
210
- - Query only necessary fields for related data
211
- - Consider caching for complex progress bar rendering
212
-
213
- ### Customization Tips
214
- - **Amount display**: Use internationalized formats, consider different currency requirements
215
- - **Status management**: Clearly define status flow rules
216
- - **Validity reminders**: Set reasonable reminder thresholds
217
- - **Related display**: Show only the most critical related information
218
- - **Responsive design**: Ensure proper display across different screen widths`
219
- };
@@ -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,409 +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_columns_for_tickets_en_exports = {};
28
- __export(js_columns_for_tickets_en_exports, {
29
- default: () => js_columns_for_tickets_en_default
30
- });
31
- module.exports = __toCommonJS(js_columns_for_tickets_en_exports);
32
- var js_columns_for_tickets_en_default = {
33
- name: "js_columns_for_tickets",
34
- content: String.raw`# NocoBase JS Column Examples - Tickets Table
35
-
36
- ## Overview
37
- Practical JavaScript column examples for the tickets table in ticketing systems. These aggregated columns integrate ticket status, SLA monitoring, and processing progress to enhance ticket management efficiency.
38
-
39
- ## Selected JS Column Examples
40
-
41
- ## 1. Ticket Overview Card
42
-
43
- Displays ticket subject, priority, and current status with color and icon differentiation for importance.
44
-
45
- \`\`\`javascript
46
- // Ticket overview card
47
- const subject = ctx.record?.subject || 'No Subject';
48
- const description = ctx.record?.description || '';
49
- const status = ctx.record?.status || 'New';
50
- const priority = ctx.record?.priority || 'Medium';
51
- const ticketId = ctx.record?.id || '';
52
-
53
- // Status configuration
54
- const statusConfig = {
55
- 'New': { color: '#1677ff', icon: '🆕', label: 'New' },
56
- 'Open': { color: '#52c41a', icon: '📂', label: 'Open' },
57
- 'Pending': { color: '#faad14', icon: '⏸️', label: 'Pending' },
58
- 'On Hold': { color: '#fa8c16', icon: '⏳', label: 'On Hold' },
59
- 'Solved': { color: '#13c2c2', icon: '✅', label: 'Solved' },
60
- 'Closed': { color: '#8c8c8c', icon: '🔒', label: 'Closed' }
61
- };
62
-
63
- // Priority configuration
64
- const priorityConfig = {
65
- 'Low': { color: '#52c41a', icon: '↓', label: 'Low' },
66
- 'Medium': { color: '#1677ff', icon: '→', label: 'Medium' },
67
- 'High': { color: '#fa8c16', icon: '↑', label: 'High' },
68
- 'Urgent': { color: '#ff4d4f', icon: '⚡', label: 'Urgent' }
69
- };
70
-
71
- const statusInfo = statusConfig[status] || statusConfig['New'];
72
- const priorityInfo = priorityConfig[priority] || priorityConfig['Medium'];
73
-
74
- // Truncate description to first 50 characters
75
- const truncateText = (text, maxLength = 50) => {
76
- if (!text) return '';
77
- return text.length > maxLength ? text.substring(0, maxLength) + '...' : text;
78
- };
79
-
80
- ctx.element.innerHTML = \`
81
- <div style="
82
- border: 1px solid #f0f0f0;
83
- border-radius: 8px;
84
- padding: 12px;
85
- background: white;
86
- box-shadow: 0 1px 2px rgba(0,0,0,0.04);
87
- ">
88
- <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;">
89
- <div style="display:flex;align-items:center;gap:8px;">
90
- <span style="
91
- font-size:11px;
92
- color:#8c8c8c;
93
- font-family:monospace;
94
- ">#\${ticketId}</span>
95
- <span style="
96
- display:inline-flex;
97
- align-items:center;
98
- padding:2px 8px;
99
- border-radius:4px;
100
- background:\${priorityInfo.color}20;
101
- color:\${priorityInfo.color};
102
- font-size:11px;
103
- font-weight:500;
104
- ">
105
- <span style="margin-right:3px;">\${priorityInfo.icon}</span>
106
- \${priorityInfo.label}
107
- </span>
108
- </div>
109
- <span style="
110
- display:inline-flex;
111
- align-items:center;
112
- gap:4px;
113
- padding:3px 8px;
114
- border-radius:12px;
115
- background:\${statusInfo.color}15;
116
- color:\${statusInfo.color};
117
- font-size:11px;
118
- font-weight:500;
119
- ">
120
- \${statusInfo.icon} \${statusInfo.label}
121
- </span>
122
- </div>
123
- <div style="
124
- font-weight:500;
125
- color:#262626;
126
- font-size:14px;
127
- margin-bottom:6px;
128
- overflow:hidden;
129
- text-overflow:ellipsis;
130
- white-space:nowrap;
131
- ">\${subject}</div>
132
- \${description ? \`
133
- <div style="
134
- color:#8c8c8c;
135
- font-size:12px;
136
- line-height:1.4;
137
- ">\${truncateText(description)}</div>
138
- \` : ''}
139
- </div>
140
- \`;
141
- \`\`\`
142
-
143
- ## 2. SLA Monitor Panel
144
-
145
- Real-time monitoring of SLA status, showing remaining time and overdue alerts.
146
-
147
- \`\`\`javascript
148
- // SLA monitor panel
149
- const techSlaDue = ctx.record?.tech_sla_due;
150
- const salesSlaDue = ctx.record?.sales_sla_due;
151
- const slaPaused = ctx.record?.sla_paused;
152
- const firstResponded = ctx.record?.first_responded_at;
153
- const status = ctx.record?.status;
154
-
155
- // Calculate remaining time
156
- const calculateTimeRemaining = (dueDate) => {
157
- if (!dueDate) return null;
158
- const now = new Date();
159
- const due = new Date(dueDate);
160
- const diff = due - now;
161
-
162
- if (diff < 0) {
163
- // Overdue
164
- const overdue = Math.abs(diff);
165
- const hours = Math.floor(overdue / (1000 * 60 * 60));
166
- const minutes = Math.floor((overdue % (1000 * 60 * 60)) / (1000 * 60));
167
- return {
168
- isOverdue: true,
169
- text: hours > 0 ? \`Overdue \${hours}h \${minutes}m\` : \`Overdue \${minutes}m\`,
170
- color: '#ff4d4f'
171
- };
172
- } else {
173
- // Not overdue
174
- const hours = Math.floor(diff / (1000 * 60 * 60));
175
- const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
176
- let color = '#52c41a';
177
- if (hours < 1) color = '#faad14';
178
- if (hours < 0.5) color = '#fa8c16';
179
- return {
180
- isOverdue: false,
181
- text: hours > 0 ? \`\${hours}h \${minutes}m left\` : \`\${minutes}m left\`,
182
- color: color
183
- };
184
- }
185
- };
186
-
187
- // Check if closed
188
- const isClosed = status === 'Closed' || status === 'Solved';
189
-
190
- // Get SLA status
191
- const getSlaStatus = () => {
192
- if (slaPaused) {
193
- return { text: 'Paused', color: '#8c8c8c', icon: '⏸️' };
194
- }
195
- if (isClosed) {
196
- return { text: 'Completed', color: '#52c41a', icon: '✅' };
197
- }
198
- if (firstResponded) {
199
- return { text: 'Responded', color: '#13c2c2', icon: '💬' };
200
- }
201
- return { text: 'Pending', color: '#1677ff', icon: '⏰' };
202
- };
203
-
204
- const techSla = techSlaDue ? calculateTimeRemaining(techSlaDue) : null;
205
- const salesSla = salesSlaDue ? calculateTimeRemaining(salesSlaDue) : null;
206
- const slaStatus = getSlaStatus();
207
-
208
- ctx.element.innerHTML = \`
209
- <div style="
210
- display:flex;
211
- flex-direction:column;
212
- gap:8px;
213
- padding:8px;
214
- background:#fafafa;
215
- border-radius:6px;
216
- ">
217
- <div style="
218
- display:flex;
219
- align-items:center;
220
- justify-content:space-between;
221
- padding-bottom:6px;
222
- border-bottom:1px solid #f0f0f0;
223
- ">
224
- <span style="
225
- font-size:11px;
226
- color:#595959;
227
- font-weight:500;
228
- ">SLA Status</span>
229
- <span style="
230
- display:inline-flex;
231
- align-items:center;
232
- gap:4px;
233
- padding:2px 6px;
234
- border-radius:4px;
235
- background:\${slaStatus.color}15;
236
- color:\${slaStatus.color};
237
- font-size:11px;
238
- ">
239
- \${slaStatus.icon} \${slaStatus.text}
240
- </span>
241
- </div>
242
-
243
- \${techSla ? \`
244
- <div style="display:flex;align-items:center;justify-content:space-between;">
245
- <span style="font-size:11px;color:#8c8c8c;">Technical</span>
246
- <span style="
247
- font-size:11px;
248
- color:\${techSla.color};
249
- font-weight:\${techSla.isOverdue ? 'bold' : 'normal'};
250
- ">
251
- \${techSla.isOverdue ? '🔴' : '⏱️'} \${techSla.text}
252
- </span>
253
- </div>
254
- \` : ''}
255
-
256
- \${salesSla ? \`
257
- <div style="display:flex;align-items:center;justify-content:space-between;">
258
- <span style="font-size:11px;color:#8c8c8c;">Sales</span>
259
- <span style="
260
- font-size:11px;
261
- color:\${salesSla.color};
262
- font-weight:\${salesSla.isOverdue ? 'bold' : 'normal'};
263
- ">
264
- \${salesSla.isOverdue ? '🔴' : '⏱️'} \${salesSla.text}
265
- </span>
266
- </div>
267
- \` : ''}
268
-
269
- \${!techSla && !salesSla ? \`
270
- <div style="
271
- text-align:center;
272
- color:#bfbfbf;
273
- font-size:11px;
274
- padding:4px;
275
- ">No SLA configured</div>
276
- \` : ''}
277
- </div>
278
- \`;
279
- \`\`\`
280
-
281
- ## 3. Customer & Product Info Card
282
-
283
- Displays related customer, product, and order information.
284
-
285
- \`\`\`javascript
286
- // Customer & product info card
287
- const customer = ctx.record?.associated_customer_information;
288
- const product = ctx.record?.product;
289
- const orderNumber = ctx.record?.extracted_order_number;
290
- const serialNumber = ctx.record?.extracted_serial_number;
291
- const model = ctx.record?.extracted_model;
292
-
293
- // Get customer name and email
294
- const customerName = customer?.name || 'Unlinked customer';
295
- const customerEmail = customer?.email || '';
296
- const customerPhone = customer?.phone || '';
297
-
298
- // Get product info
299
- const productName = product?.name || 'Unlinked product';
300
- const productSku = product?.sku || '';
301
-
302
- ctx.element.innerHTML = \`
303
- <div style="
304
- border:1px solid #f0f0f0;
305
- border-radius:8px;
306
- padding:10px;
307
- background:white;
308
- ">
309
- <div style="margin-bottom:8px;">
310
- <div style="display:flex;align-items:center;gap:6px;margin-bottom:6px;">
311
- <span style="font-size:12px;color:#8c8c8c;">👤 Customer:</span>
312
- <strong style="font-size:13px;color:#262626;">\${customerName}</strong>
313
- </div>
314
- \${customerEmail ? \`
315
- <div style="display:flex;align-items:center;gap:6px;margin-left:20px;">
316
- <span style="font-size:10px;color:#bfbfbf;">📧</span>
317
- <a href="mailto:\${customerEmail}" style="
318
- font-size:11px;
319
- color:#1677ff;
320
- text-decoration:none;
321
- ">\${customerEmail}</a>
322
- </div>
323
- \` : ''}
324
- \${customerPhone ? \`
325
- <div style="display:flex;align-items:center;gap:6px;margin-left:20px;">
326
- <span style="font-size:10px;color:#bfbfbf;">📞</span>
327
- <span style="font-size:11px;color:#595959;">\${customerPhone}</span>
328
- </div>
329
- \` : ''}
330
- </div>
331
-
332
- <div style="
333
- padding-top:8px;
334
- border-top:1px solid #fafafa;
335
- ">
336
- <div style="display:flex;align-items:center;gap:6px;margin-bottom:4px;">
337
- <span style="font-size:12px;color:#8c8c8c;">📦 Product:</span>
338
- <strong style="font-size:13px;color:#262626;">\${productName}</strong>
339
- \${productSku ? \`
340
- <span style="
341
- font-size:10px;
342
- color:#8c8c8c;
343
- padding:1px 4px;
344
- background:#f5f5f5;
345
- border-radius:2px;
346
- ">\${productSku}</span>
347
- \` : ''}
348
- </div>
349
-
350
- \${orderNumber || serialNumber || model ? \`
351
- <div style="
352
- margin-top:6px;
353
- padding:4px 6px;
354
- background:#f5f5f5;
355
- border-radius:4px;
356
- ">
357
- \${orderNumber ? \`
358
- <div style="display:flex;align-items:center;gap:6px;margin-bottom:3px;">
359
- <span style="font-size:10px;color:#8c8c8c;">Order:</span>
360
- <span style="font-size:11px;color:#262626;font-family:monospace;">\${orderNumber}</span>
361
- </div>
362
- \` : ''}
363
- \${serialNumber ? \`
364
- <div style="display:flex;align-items:center;gap:6px;margin-bottom:3px;">
365
- <span style="font-size:10px;color:#8c8c8c;">Serial:</span>
366
- <span style="font-size:11px;color:#262626;font-family:monospace;">\${serialNumber}</span>
367
- </div>
368
- \` : ''}
369
- \${model ? \`
370
- <div style="display:flex;align-items:center;gap:6px;">
371
- <span style="font-size:10px;color:#8c8c8c;">Model:</span>
372
- <span style="font-size:11px;color:#262626;">\${model}</span>
373
- </div>
374
- \` : ''}
375
- </div>
376
- \` : ''}
377
- </div>
378
- </div>
379
- \`;
380
- \`\`\`
381
-
382
- ## Usage Instructions
383
-
384
- ### Configuration in NocoBase
385
- 1. Navigate to the tickets table configuration interface
386
- 2. Add a new column and select "JavaScript" type
387
- 3. Paste the corresponding code into the code editor
388
- 4. Save and refresh the table to see the effects
389
-
390
- ### Data Dependencies
391
- - **Base fields**: subject, description, status, priority
392
- - **SLA fields**: tech_sla_due, sales_sla_due, first_responded_at, sla_paused
393
- - **Time fields**: createdAt, updatedAt, closed_at
394
- - **Related fields**: associated_customer_information, product, assignee_user
395
- - **Extended fields**: problem_type, source, language, satisfaction_survey
396
-
397
- ### Performance Optimization
398
- - Cache results for complex calculations
399
- - Query only necessary fields for related data
400
- - Consider pagination for large datasets
401
- - Optimize real-time calculations like SLA countdown
402
-
403
- ### Customization Tips
404
- - **Priority levels**: Adjust priority colors and icons based on business rules
405
- - **SLA thresholds**: Configure warning times based on service level agreements
406
- - **Status workflow**: Ensure status transitions follow business logic
407
- - **Customer info**: Display only essential customer details to maintain privacy
408
- - **Response formats**: Adapt time formats to regional preferences`
409
- };
@@ -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;