tadcode-wpsjs 1.1.0 → 1.2.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.
@@ -0,0 +1,73 @@
1
+ declare module 'application:datatable' {
2
+ import type { RecordRange } from 'application:datatable'
3
+ // 基础类型定义
4
+ type FieldType =
5
+ | 'SingleLineText'
6
+ | 'MultiLineText'
7
+ | 'Date'
8
+ | 'SingleSelect'
9
+ | 'Number'
10
+ | 'Rating'
11
+
12
+ type ViewType = 'Grid' | 'Kanban' | 'Gallery' | 'Form' | 'Query' | 'Gantt'
13
+
14
+ interface EventContext {
15
+ Destroy(): void
16
+ }
17
+
18
+ interface OnDeleteEventData {
19
+ sheetId: number
20
+ }
21
+
22
+ interface OnRenameEventData {
23
+ Sheet: Sheet
24
+ originValue: string
25
+ value: string
26
+ }
27
+
28
+ // FieldDescriptors 类型(根据文档引用)
29
+ interface FieldDescriptors { }
30
+
31
+ // Views 类型(根据之前Views文档)
32
+ interface Views {
33
+ readonly ActiveView: any
34
+ readonly Count: number
35
+ Add(Type: ViewType, Name: string): any
36
+ Delete(Index: number | string): void
37
+ Item(Index: number | string): any
38
+ ItemById(Id: string): any
39
+ OnCreate(callback: (data: any) => void): EventContext
40
+ }
41
+
42
+ // Sheet 接口
43
+ interface Sheet {
44
+ // 属性
45
+ FieldDescriptors: FieldDescriptors
46
+ Icon: string
47
+ readonly Id: number
48
+ Name: string
49
+ readonly RecordRange: RecordRange
50
+ readonly Views: Views
51
+
52
+ // 方法
53
+ AddDescription(Value: string): boolean
54
+ AppendFromCloud(FileId: string): boolean
55
+ AppendFromLocal(File: File): boolean
56
+ Copy(Value?: boolean): Sheet
57
+ CreateFields(Fields: Array<{ name: string; type: FieldType; max?: number }>): void
58
+ Delete(HideTip?: boolean): boolean
59
+ DeleteFields(FiledIds: string[]): void
60
+ FieldId(Name: string): string
61
+ GetFields(): any // Fields类型
62
+ Share(): boolean
63
+ UpdateFields(Fields: Array<{ id: string; name: string; type: FieldType }>): any // Fields类型
64
+
65
+ // 事件
66
+ OnCreateRecord(callback: (data: RecordRange) => void): EventContext
67
+ OnDelete(callback: (data: OnDeleteEventData) => void): EventContext
68
+ OnRename(callback: (data: OnRenameEventData) => void): EventContext
69
+ }
70
+
71
+ // 导出 Sheet 类型
72
+ export type { Sheet }
73
+ }
@@ -0,0 +1,62 @@
1
+ declare module 'application:datatable' {
2
+ interface Sheet {
3
+ description: string,
4
+ fields: {
5
+ arraySupport: boolean,
6
+ autoFillSourceField: string,
7
+ customConfig: string,
8
+ defaultValueType: string,
9
+ description: string,
10
+ id: string,
11
+ name: string,
12
+ numberFormat: string,
13
+ syncField: boolean,
14
+ type: string,
15
+ uniqueValue: boolean
16
+ loadLegalHoliday: number,
17
+ items: {
18
+ color: number,
19
+ id: string,
20
+ value: string
21
+ }[],
22
+ allowAddItemWhenInputting: true,
23
+ autoAddItem: boolean,
24
+ }[],
25
+ icon: string,
26
+ id: number,
27
+ name: number,
28
+ primaryFieldId: number,
29
+ recordsCount: number,
30
+ sheetType: string,
31
+ subType: string,
32
+ syncFieldSourceId: string,
33
+ syncFieldSourceNameId: string,
34
+ syncType: None,
35
+ views: {
36
+ id: string,
37
+ name: string,
38
+ notice: string,
39
+ recordsCount: number,
40
+ type: ViewType
41
+ }[]
42
+ }
43
+
44
+ interface SheetFuncOptions {
45
+ SheetId: number
46
+ Name: string
47
+ Views: {
48
+ name: string
49
+ type: ViewType
50
+ }[]
51
+ Fields: { name: string, type: FieldTypeKeys }[]
52
+ }
53
+
54
+ interface SheetApi {
55
+ CreateSheet(options: Omit<SheetFuncOptions, SheetId>): Sheet
56
+ GetSheets(): Sheet[]
57
+ UpdateSheet(options: Pick<SheetFuncOptions, SheetId | Name>): boolean
58
+ DeleteSheet(options: Pick<SheetFuncOptions, SheetId>): Pick<Sheet, id>
59
+ }
60
+
61
+ export type { SheetApi }
62
+ }
@@ -0,0 +1,88 @@
1
+ declare module 'application:datatable' {
2
+ // 基础类型定义
3
+ type SheetType = 'xlEtFlexPaperSheet' | 'xlEtDataBaseSheet' | 'xlDbDashBoardSheet'
4
+
5
+ type FieldType =
6
+ | 'SingleLineText'
7
+ | 'MultiLineText'
8
+ | 'Date'
9
+ | 'SingleSelect'
10
+ | 'Number'
11
+ | 'Rating'
12
+
13
+ type ViewType = 'Grid' | 'Kanban' | 'Gallery' | 'Form' | 'Gantt' | 'Query' | 'Calendar'
14
+
15
+ // 接口定义
16
+ interface ListItem {
17
+ value: string
18
+ color: number
19
+ }
20
+
21
+ interface FieldArgs {
22
+ fieldName: string
23
+ fieldWidth: number
24
+ listItems?: ListItem[]
25
+ numberFormat?: string
26
+ maxRating?: number
27
+ }
28
+
29
+ interface Field {
30
+ fieldType: FieldType
31
+ args: FieldArgs
32
+ }
33
+
34
+ interface View {
35
+ name: string
36
+ type: ViewType
37
+ }
38
+
39
+ interface Config {
40
+ fields?: Field[]
41
+ name?: string
42
+ views?: View[]
43
+ }
44
+
45
+ interface EventContext {
46
+ Destroy(): void
47
+ }
48
+
49
+ interface OnCreateSheetEventData {
50
+ Sheet: Sheet
51
+ }
52
+
53
+ // Sheet 接口
54
+ interface Sheet {
55
+ readonly Id: number
56
+ Name: string
57
+ Type: SheetType
58
+ // 其他Sheet属性根据文档补充
59
+ }
60
+
61
+ // Sheets 接口
62
+ interface Sheets {
63
+ // 属性
64
+ readonly Count: number
65
+
66
+ // 方法
67
+ Add(Before: number | string | null, After: number | string | null, Type: SheetType, Config?: Config): Sheet
68
+ Add(params: { Before?: number | string | null; After?: number | string | null; Type: SheetType; Config?: Config }): Sheet
69
+
70
+ Delete(Index: number | string): boolean
71
+
72
+ Move(From: number | string, Before: number | string | null, After: number | string | null): boolean
73
+
74
+ Item(Index: number | string): Sheet
75
+
76
+ ItemById(Id: number | string): Sheet
77
+
78
+ GetActiveSheetIndex(): number
79
+
80
+ GetActiveSheetId(): number
81
+
82
+ // 事件
83
+ OnCreateSheet(callback: (data: OnCreateSheetEventData) => void): EventContext
84
+ }
85
+
86
+ // 只导出 Sheets 类型
87
+ export type { Sheets }
88
+ }
@@ -0,0 +1,51 @@
1
+ declare module 'application:datatable' {
2
+ import type { RecordRange, Records } from 'application:datatable'
3
+ // 基础类型定义
4
+ type ViewType = 'Grid' | 'Kanban' | 'Gallery' | 'Form' | 'Query' | 'Gantt' | 'Calendar'
5
+
6
+ interface EventContext {
7
+ Destroy(): void
8
+ }
9
+
10
+ interface OnDeleteViewEventData {
11
+ sheetId: number
12
+ viewId: string
13
+ }
14
+
15
+ interface OnRenameViewEventData {
16
+ View: View
17
+ originValue: string
18
+ value: string
19
+ }
20
+
21
+ // View 接口
22
+ interface View {
23
+ // 属性
24
+ Description: string
25
+ readonly Fields: any
26
+ readonly Filters: any
27
+ readonly Groups: any
28
+ readonly Id: string
29
+ IsFavView: boolean
30
+ IsPersonal: boolean
31
+ Name: string
32
+ readonly RecordRange: RecordRange
33
+ readonly Records: Records
34
+ readonly Selection: any
35
+ Sorts: any
36
+ readonly Type: ViewType
37
+ readonly ViewShare: any
38
+
39
+ // 方法
40
+ Activate(): void
41
+ Copy(): View
42
+ Delete(): boolean
43
+
44
+ // 事件
45
+ OnDelete(callback: (data: OnDeleteViewEventData) => void): EventContext
46
+ OnRename(callback: (data: OnRenameViewEventData) => void): EventContext
47
+ }
48
+
49
+ // 导出 View 类型
50
+ export type { View }
51
+ }
@@ -0,0 +1,26 @@
1
+ declare module 'application:datatable' {
2
+ type ViewType = 'Grid' | 'Kanban' | 'Gallery' | 'Form' | 'Gantt'
3
+
4
+ interface View {
5
+ id: string
6
+ name: string
7
+ recordsCount: number
8
+ type: ViewType
9
+ }
10
+
11
+ interface ViewFuncOptions {
12
+ SheetId: number
13
+ ViewId: string
14
+ Name: string
15
+ ViewType: ViewType
16
+ }
17
+
18
+ interface ViewApi {
19
+ CreateView(options: Pick<ViewFuncOptions, 'SheetId' | 'Name' | 'ViewType'>): View
20
+ GetViews(options: Pick<ViewFuncOptions, 'SheetId'>): View[]
21
+ UpdateView(options: Pick<ViewFuncOptions, 'SheetId' | 'Name' | 'ViewId'>): View
22
+ DeleteView(options: Pick<ViewFuncOptions, 'SheetId' | 'ViewId'>): Pick<View, 'id'>
23
+ }
24
+
25
+ export type { ViewApi }
26
+ }
@@ -0,0 +1,36 @@
1
+ declare module 'application:datatable' {
2
+ // 基础类型定义
3
+ type ViewType = 'Grid' | 'Kanban' | 'Gallery' | 'Form' | 'Query' | 'Gantt'
4
+
5
+ interface EventContext {
6
+ Destroy(): void
7
+ }
8
+
9
+ // View 接口(根据之前View文档)
10
+ interface View {
11
+ readonly Id: string
12
+ Name: string
13
+ Type: ViewType
14
+ RowHeight?: number // GridView特有
15
+ // 其他属性根据View文档
16
+ }
17
+
18
+ // Views 接口
19
+ interface Views {
20
+ // 属性
21
+ readonly ActiveView: View
22
+ readonly Count: number
23
+
24
+ // 方法
25
+ Add(Type: ViewType, Name: string): View
26
+ Delete(Index: number | string): void
27
+ Item(Index: number | string): View
28
+ ItemById(Id: string): View
29
+
30
+ // 事件
31
+ OnCreate(callback: (data: View) => void): EventContext
32
+ }
33
+
34
+ // 导出 Views 类型
35
+ export type { Views }
36
+ }
@@ -0,0 +1,28 @@
1
+ declare module 'application:datatable' {
2
+ import type { RecordRange } from 'application:datatable'
3
+
4
+ interface UserInfo {
5
+ id: string
6
+ name: string
7
+ }
8
+
9
+ interface FileInfo {
10
+ id: string
11
+ name: string
12
+ officeType: string
13
+ creator: {
14
+ id: string
15
+ name: string
16
+ avatar_url: string
17
+ logined: boolean
18
+ attrs: {
19
+ real_userid: string
20
+ }
21
+ real_id: string
22
+ }
23
+ size: number
24
+ groupId: string
25
+ docType: number
26
+ version: number
27
+ }
28
+ }
@@ -0,0 +1,27 @@
1
+ declare module 'application:datatable' {
2
+ import type {
3
+ SheetApi,
4
+ ViewApi,
5
+ FieldApi,
6
+ RecordApi,
7
+ SelectionApi,
8
+
9
+ Sheets,
10
+ Sheet,
11
+ View,
12
+ } from "application:datatable"
13
+
14
+ interface Application {
15
+ Sheet: SheetApi,
16
+ View: ViewApi,
17
+ Field: FieldApi,
18
+ Record: RecordApi,
19
+ Selection: SelectionApi,
20
+
21
+ Sheets: Sheets,
22
+ ActiveSheet: Sheet,
23
+ ActiveView: View,
24
+ }
25
+
26
+ export type { Application }
27
+ }
@@ -0,0 +1,36 @@
1
+ declare module 'tadcode-wpsjs:global' {
2
+ import type { Application as DBApplication } from 'application:datatable'
3
+ import type { WithPromise } from 'tadcode-wpsjs:typetools'
4
+ import type { KSDrive } from 'tadcode-wpsjs:global'
5
+
6
+ type WpsjsGlobalApi = WithPromise<WpsjsGlobal>
7
+
8
+ interface InfoItem {
9
+ method: keyof typeof Reflect
10
+ arguments: string[]
11
+ }
12
+
13
+ interface WpsjsGlobal {
14
+ Application: DBApplication
15
+ KSDrive: KSDrive
16
+ }
17
+ }
18
+
19
+ declare module 'tadcode-wpsjs' {
20
+ const { execution,
21
+ initRemoteCallWpsjsGlobal,
22
+ queryTask,
23
+ setValue,
24
+ setValueOk,
25
+ writeLogFileToCurrent,
26
+ } = await import('../index.ts')
27
+
28
+ export {
29
+ execution,
30
+ initRemoteCallWpsjsGlobal,
31
+ queryTask,
32
+ setValue,
33
+ setValueOk,
34
+ writeLogFileToCurrent,
35
+ }
36
+ }
package/types/index.d.ts CHANGED
@@ -1,63 +1,4 @@
1
- import type { WithPromise } from './type-tools'
2
- import type DB_Application from './DB_Application'
3
- import type KSheet_Application from './KSheet_Application'
4
- import type KSDrive from './KSDrive'
5
-
6
- interface WpsjsGlobal {
7
- KSDrive: KSDrive
8
- Application: KSheet_Application & DB_Application
9
- }
10
-
11
- type WpsjsGlobalApi = WithPromise<WpsjsGlobal>
12
-
13
- interface InfoItem {
14
- method: keyof typeof Reflect
15
- arguments: string[]
16
- }
17
-
18
- /* 基本 */
19
- interface RemoteCallWpsjsGlobalReturn {
20
- data: {
21
- logs: {
22
- filename: string
23
- timestamp: string
24
- unix_time: number
25
- level: 'info' | 'error' | 'warn'
26
- args: string[]
27
- }[]
28
- result: unknown
29
- task_id: string
30
- }
31
- error: string
32
- error_details: {
33
- name: string
34
- msg: string
35
- stack: string[]
36
- unix_time: number
37
- }
38
- status: 'finished'
39
- task_id: string
40
- task_type: string
41
- }
42
-
43
- /* token 过期 */
44
- interface RemoteCallWpsjsGlobalReturn {
45
- errno: 10000
46
- msg: string
47
- reason: string
48
- result: ApiTokenExpired
49
- }
50
-
51
- export {
52
- WpsjsGlobal,
53
- WpsjsGlobalApi,
54
- InfoItem,
55
- RemoteCallWpsjsGlobalReturn,
56
- }
57
-
58
- export type * from './DB_Application'
59
- export type { default as DB_Application } from './DB_Application'
60
- export type * from './KSDrive'
61
- export type { default as KSDrive } from './KSDrive'
62
- export type * from './KSheet_Application'
63
- export type { default as KSheet_Application } from './KSheet_Application'
1
+ /// <reference path="global.d.ts" />
2
+ /// <reference path="KSDrive.d.ts" />
3
+ /// <reference path="return.response.d.ts" />
4
+ /// <reference path="TypeTools.d.ts" />
@@ -0,0 +1,34 @@
1
+ declare module 'tadcode-wpsjs:global' {
2
+ /* 基本 */
3
+ interface RemoteCallWpsjsGlobalReturn {
4
+ data: {
5
+ logs: {
6
+ filename: string
7
+ timestamp: string
8
+ unix_time: number
9
+ level: 'info' | 'error' | 'warn'
10
+ args: string[]
11
+ }[]
12
+ result: unknown
13
+ task_id: string
14
+ }
15
+ error: string
16
+ error_details: {
17
+ name: string
18
+ msg: string
19
+ stack: string[]
20
+ unix_time: number
21
+ }
22
+ status: 'finished'
23
+ task_id: string
24
+ task_type: string
25
+ }
26
+
27
+ /* token 过期 */
28
+ interface RemoteCallWpsjsGlobalReturn {
29
+ errno: 10000
30
+ msg: string
31
+ reason: string
32
+ result: ApiTokenExpired
33
+ }
34
+ }
@@ -1,49 +0,0 @@
1
- import type DBSheet from './DB_Application_Sheet'
2
- import type DBView from './DB_Application_View'
3
- import type DBField from './DB_Application_Field'
4
- import type DBRecord from './DB_Application_Record'
5
- import type DBSelection from './DB_Application_Selection'
6
-
7
- interface DBUserInfo {
8
- id: string
9
- name: string
10
- }
11
-
12
- interface DBFileInfo {
13
- id: string
14
- name: string
15
- officeType: string
16
- creator: {
17
- id: string
18
- name: string
19
- avatar_url: string
20
- logined: boolean
21
- attrs: {
22
- real_userid: string
23
- }
24
- real_id: string
25
- }
26
- size: number
27
- groupId: string
28
- docType: number
29
- version: number
30
- }
31
-
32
- export type * from './DB_Application_Sheet'
33
- export type * from './DB_Application_View'
34
- export type * from './DB_Application_Field'
35
- export type * from './DB_Application_Record'
36
- export type * from './DB_Application_Selection'
37
-
38
- export type { DBSheet, DBView, DBField, DBRecord, DBSelection }
39
-
40
- export default interface DB_Application {
41
- Sheet: DBSheet
42
- View: DBView
43
- Field: DBField
44
- Record: DBRecord
45
- Selection: DBSelection
46
- UserInfo: DBUserInfo
47
- FileInfo: DBFileInfo
48
- }
49
-