tadcode-wpsjs 1.2.1 → 1.3.0

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/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  在部署远程代码的情况下,可以远程调用`WpsjsGlobal`,实现对支持`AirScript`的多维表,智能表格等远程操作。如果你对`AirScript`,感兴趣,也能帮助你学习`WpsjsGlobal`。
8
8
 
9
+ In the case of deploying remote code, WpsjsGlobal can be remotely called to achieve remote operations on multidimensional tables, smart tables, and other tables that support AirScript. If you are interested in AirScript, it can also help you learn WpsjsGlobal.
10
+
9
11
  原理是使用代理收集调用信息,之后让远程代码进行调用并且返回结果。
10
12
  远程代码在`tadcode-wpsjs/remoteCode`目录的`index.js`文件中。
11
13
  将其复制粘贴到对应`webhook`的脚本中才能支持`WpsjsGlobal`对象的调用。
@@ -53,7 +55,7 @@ const data = await wpsjsGlobal.Application.Sheet.GetSheets()
53
55
  console.log(data)
54
56
  ```
55
57
 
56
- ### 重命名(远程赋值操作)
58
+ ### 多维表的重命名(赋值操作)
57
59
 
58
60
  ```ts
59
61
  import { initRemoteCallWpsjsGlobal,setValue } from 'tadcode-wpsjs'
@@ -68,6 +70,23 @@ const sheet = wpsjsGlobal.Application.Sheets(1)
68
70
  await setValue(sheet,'Name','table1001')
69
71
  ```
70
72
 
73
+ ### 修改记录区域字体颜色(赋值操作,此写法可以复用对象)
74
+
75
+ ```ts
76
+ import type { Font } from 'application:datatable'
77
+ import { initRemoteCallWpsjsGlobal,setValue } from 'tadcode-wpsjs'
78
+ /* 脚本令牌 具体获取方式参考上面 */
79
+ const scriptToken = 'xxxx'
80
+ /* webhook url地址 具体获取方式参考上面 */
81
+ const webhookURL = 'xxxx'
82
+ const wpsjsGlobal = initRemoteCallWpsjsGlobal({ scriptToken, webhookURL, })
83
+
84
+ const range = wpsjsGlobal.Application.ActiveSheet.RecordRange([1, 2], [1, 2]).Font as unknown as Font
85
+ range.Color = '#ff00ff'
86
+ /* 注意:赋值操作依旧远程操作。此函数会拿到最后一次赋值操作的promise */
87
+ await setValueOk()
88
+ ```
89
+
71
90
  ### 执行脚本并且返回(不用部署remoteCode代码)
72
91
 
73
92
  ```ts
@@ -81,13 +100,13 @@ const data =await result.json()
81
100
  console.log(data)
82
101
  ```
83
102
 
84
- ## 支持
85
-
86
- 如果对你有用请在[gitcode](https://gitcode.com/caisijian/tadcode-wpsjs)给个`star`
87
-
88
103
  ## 基于wps官方文档
89
104
  - [**AirScript文档**](https://airsheet.wps.cn/docs/apitoken/intro.html)
90
105
  - [**WPS多维表格:“开发”功能使用说明文档**](https://365.kdocs.cn/l/ctzsgDlAGF0l)
91
106
  - [**执行AirScript脚本操作使用指南**](https://365.kdocs.cn/l/cdQOqc6TZuMk)
92
107
  - [**快速入门多维表“开发”**](https://365.kdocs.cn/l/ctx1jAV1xJhR)
93
108
  - [**WPS开放平台dbsheet-Api部分**](https://365.kdocs.cn/3rd/open/documents/app-integration-dev/guide/dbsheet/Api/api-instro)
109
+
110
+ ## 支持
111
+
112
+ 如果对你有用请在[gitcode](https://gitcode.com/caisijian/tadcode-wpsjs)给个`star`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tadcode-wpsjs",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "hot": "NODE_ENV=development bun --hot ignore/index.ts",
@@ -0,0 +1,10 @@
1
+ declare module 'application:datatable' {
2
+ // Font 接口
3
+ interface Font {
4
+ // 属性
5
+ Color: string;
6
+ }
7
+
8
+ // 导出 Font 类型
9
+ export type { Font };
10
+ }
@@ -0,0 +1,57 @@
1
+ declare module 'application:datatable' {
2
+ // 基础类型定义
3
+ interface HookParams {
4
+ recordId: string;
5
+ activeFieldId?: string;
6
+ isShowComment?: boolean;
7
+ }
8
+
9
+ interface Hook {
10
+ InvokeSingle(callback: (params: HookParams) => boolean): void;
11
+ }
12
+
13
+ // Navigator 类型(根据文档引用)
14
+ interface Navigator {
15
+ // Navigator属性
16
+ }
17
+
18
+ // NoticeBar 类型(根据文档引用)
19
+ interface NoticeBar {
20
+ // NoticeBar属性
21
+ }
22
+
23
+ // FormViewUI 类型(根据文档引用)
24
+ interface FormViewUI {
25
+ // FormViewUI属性
26
+ }
27
+
28
+ // GanttViewUI 类型(根据文档引用)
29
+ interface GanttViewUI {
30
+ // GanttViewUI属性
31
+ }
32
+
33
+ // GridViewUI 类型(根据文档引用)
34
+ interface GridViewUI {
35
+ // GridViewUI属性
36
+ }
37
+
38
+ // Window 接口
39
+ interface Window {
40
+ // 属性
41
+ readonly Navigator: Navigator;
42
+ readonly NoticeBar: NoticeBar;
43
+ readonly FormViewUI: FormViewUI;
44
+ readonly GanttViewUI: GanttViewUI;
45
+ readonly GridViewUI: GridViewUI;
46
+
47
+ // 方法
48
+ SetLayout(isClassic: boolean): void;
49
+ BailHook(CmbId: string): Hook;
50
+ DisplayRecord(RecodId?: string): void;
51
+ HiddenAllRecord(): void;
52
+ InterceptCopyRecordLink?(): void; // 文档中有列出但无详细说明
53
+ }
54
+
55
+ // 导出 Window 类型
56
+ export type { Window };
57
+ }
@@ -9,6 +9,7 @@ declare module 'application:datatable' {
9
9
  Sheets,
10
10
  Sheet,
11
11
  View,
12
+ Window
12
13
  } from "application:datatable"
13
14
 
14
15
  interface Application {
@@ -21,6 +22,7 @@ declare module 'application:datatable' {
21
22
  Sheets: Sheets,
22
23
  ActiveSheet: Sheet,
23
24
  ActiveView: View,
25
+ Window: Window,
24
26
  }
25
27
 
26
28
  export type { Application }
package/return.wpsjs.json DELETED
@@ -1,72 +0,0 @@
1
- {
2
- "data": {
3
- "logs": [
4
- {
5
- "filename": "<system>",
6
- "timestamp": "04:19:17.543",
7
- "unix_time": 1772396357543,
8
- "level": "info",
9
- "args": [
10
- "脚本环境(1.0)初始化..."
11
- ]
12
- },
13
- {
14
- "filename": "<system>",
15
- "timestamp": "04:19:18.519",
16
- "unix_time": 1772396358519,
17
- "level": "info",
18
- "args": [
19
- "已开始执行"
20
- ]
21
- },
22
- {
23
- "filename": "未命名脚本文件.js:9:15",
24
- "timestamp": "04:19:18.537",
25
- "unix_time": 1772396358537,
26
- "level": "info",
27
- "args": [
28
- "[\"Application\"]"
29
- ]
30
- },
31
- {
32
- "filename": "未命名脚本文件.js:9:15",
33
- "timestamp": "04:19:18.537",
34
- "unix_time": 1772396358537,
35
- "level": "info",
36
- "args": [
37
- "[\"ActiveView\"]"
38
- ]
39
- },
40
- {
41
- "filename": "未命名脚本文件.js:9:15",
42
- "timestamp": "04:19:18.539",
43
- "unix_time": 1772396358539,
44
- "level": "info",
45
- "args": [
46
- "[\"Records\"]"
47
- ]
48
- },
49
- {
50
- "filename": "未命名脚本文件.js:9:15",
51
- "timestamp": "04:19:18.542",
52
- "unix_time": 1772396358542,
53
- "level": "info",
54
- "args": [
55
- "[\"Select\"]"
56
- ]
57
- }
58
- ],
59
- "result": null
60
- },
61
- "error": "Cannot read properties of undefined (reading 'getRecordViewRow')",
62
- "error_details": {
63
- "name": "TypeError",
64
- "msg": "Cannot read properties of undefined (reading 'getRecordViewRow')",
65
- "stack": [
66
- "",
67
- " at 未命名脚本文件.js:18:31"
68
- ],
69
- "unix_time": 1772396358544
70
- },
71
- "status": "finished"
72
- }