@opentiny/tiny-vue-mcp 0.0.1-alpha.3 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/grid/index.js +7 -7
- package/package.json +1 -1
- package/src/grid/index.ts +6 -5
package/dist/src/grid/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { z as o } from "zod";
|
|
2
2
|
import { defineComponentTool as s } from "../utils/defineComponentTool.js";
|
|
3
3
|
import { t as r } from "../utils/locale.js";
|
|
4
|
-
const
|
|
4
|
+
const b = () => s({
|
|
5
5
|
name: "grid_component_tools",
|
|
6
6
|
description: r("ai.grid.description"),
|
|
7
7
|
tools: {
|
|
8
8
|
scrollToRow: {
|
|
9
9
|
paramsSchema: o.number().optional().describe(r("ai.grid.scrollToRow")),
|
|
10
10
|
cb: (t, e) => {
|
|
11
|
-
const a = t.
|
|
11
|
+
const a = t.getTableData().tableData[e];
|
|
12
12
|
if (a)
|
|
13
13
|
return t.scrollToRow(a), { type: "text", text: "success" };
|
|
14
14
|
}
|
|
@@ -16,14 +16,14 @@ const p = () => s({
|
|
|
16
16
|
getTableData: {
|
|
17
17
|
paramsSchema: o.boolean().optional().describe(r("ai.grid.getTableData")),
|
|
18
18
|
cb: (t) => {
|
|
19
|
-
const e = t.
|
|
19
|
+
const e = t.getTableData().tableData;
|
|
20
20
|
return { type: "text", text: JSON.stringify(e) };
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
setSelection: {
|
|
24
24
|
paramsSchema: o.number().optional().describe(r("ai.grid.setSelection")),
|
|
25
25
|
cb: (t, e) => {
|
|
26
|
-
const a = t.
|
|
26
|
+
const a = t.getTableData().tableData[e];
|
|
27
27
|
if (a)
|
|
28
28
|
return t.setSelection(a, !0), { type: "text", text: "success" };
|
|
29
29
|
}
|
|
@@ -40,7 +40,7 @@ const p = () => s({
|
|
|
40
40
|
paramsSchema: o.record(o.any()).optional().describe(r("ai.grid.updateRow")),
|
|
41
41
|
cb: (t, e) => {
|
|
42
42
|
if (e && typeof e.tiny_mcp_index == "number") {
|
|
43
|
-
const a = t.
|
|
43
|
+
const a = t.getTableData().tableData[e.tiny_mcp_index];
|
|
44
44
|
if (a)
|
|
45
45
|
return Object.assign(a, e), { type: "text", text: "success" };
|
|
46
46
|
}
|
|
@@ -50,12 +50,12 @@ const p = () => s({
|
|
|
50
50
|
removeRow: {
|
|
51
51
|
paramsSchema: o.number().optional().describe(r("ai.grid.removeRow")),
|
|
52
52
|
cb: (t, e) => {
|
|
53
|
-
const a = t.
|
|
53
|
+
const a = t.getTableData().tableData[e];
|
|
54
54
|
return a ? (t.remove(a), { type: "text", text: "success" }) : { type: "text", text: "failed" };
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
export {
|
|
60
|
-
|
|
60
|
+
b as getGridConfig
|
|
61
61
|
};
|
package/package.json
CHANGED
package/src/grid/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const getGridConfig = () =>
|
|
|
17
17
|
scrollToRow: {
|
|
18
18
|
paramsSchema: z.number().optional().describe(t('ai.grid.scrollToRow')),
|
|
19
19
|
cb: (instance, value) => {
|
|
20
|
-
const tableData = instance.
|
|
20
|
+
const tableData = instance.getTableData().tableData
|
|
21
21
|
const targetRow = tableData[value]
|
|
22
22
|
if (targetRow) {
|
|
23
23
|
instance.scrollToRow(targetRow)
|
|
@@ -28,14 +28,15 @@ export const getGridConfig = () =>
|
|
|
28
28
|
getTableData: {
|
|
29
29
|
paramsSchema: z.boolean().optional().describe(t('ai.grid.getTableData')),
|
|
30
30
|
cb: (instance) => {
|
|
31
|
-
const tableData = instance.
|
|
31
|
+
const tableData = instance.getTableData().tableData
|
|
32
|
+
|
|
32
33
|
return { type: 'text', text: JSON.stringify(tableData) }
|
|
33
34
|
}
|
|
34
35
|
},
|
|
35
36
|
setSelection: {
|
|
36
37
|
paramsSchema: z.number().optional().describe(t('ai.grid.setSelection')),
|
|
37
38
|
cb: (instance, value) => {
|
|
38
|
-
const tableData = instance.
|
|
39
|
+
const tableData = instance.getTableData().tableData
|
|
39
40
|
const targetRow = tableData[value]
|
|
40
41
|
if (targetRow) {
|
|
41
42
|
instance.setSelection(targetRow, true)
|
|
@@ -61,7 +62,7 @@ export const getGridConfig = () =>
|
|
|
61
62
|
paramsSchema: z.record(z.any()).optional().describe(t('ai.grid.updateRow')),
|
|
62
63
|
cb: (instance, value) => {
|
|
63
64
|
if (value && typeof value.tiny_mcp_index === 'number') {
|
|
64
|
-
const tableData = instance.
|
|
65
|
+
const tableData = instance.getTableData().tableData
|
|
65
66
|
const targetRow = tableData[value.tiny_mcp_index]
|
|
66
67
|
if (targetRow) {
|
|
67
68
|
Object.assign(targetRow, value)
|
|
@@ -74,7 +75,7 @@ export const getGridConfig = () =>
|
|
|
74
75
|
removeRow: {
|
|
75
76
|
paramsSchema: z.number().optional().describe(t('ai.grid.removeRow')),
|
|
76
77
|
cb: (instance, value) => {
|
|
77
|
-
const tableData = instance.
|
|
78
|
+
const tableData = instance.getTableData().tableData
|
|
78
79
|
const targetRow = tableData[value]
|
|
79
80
|
if (targetRow) {
|
|
80
81
|
instance.remove(targetRow)
|