@pc-nexus/models 0.5.0-next.9 → 0.8.0-next.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/fesm2022/pc-nexus-models.mjs +31 -37
- package/fesm2022/pc-nexus-models.mjs.map +1 -1
- package/package.json +1 -1
- package/types/pc-nexus-models.d.ts +267 -179
|
@@ -1,60 +1,54 @@
|
|
|
1
1
|
var NexusAppEnvironment;
|
|
2
2
|
(function (NexusAppEnvironment) {
|
|
3
|
-
NexusAppEnvironment["
|
|
4
|
-
NexusAppEnvironment["
|
|
3
|
+
NexusAppEnvironment["Development"] = "development";
|
|
4
|
+
NexusAppEnvironment["Production"] = "production";
|
|
5
5
|
})(NexusAppEnvironment || (NexusAppEnvironment = {}));
|
|
6
6
|
|
|
7
7
|
const SUPPORTED_LOCALE_CODES = ["zh-CN", "en-US"];
|
|
8
8
|
|
|
9
9
|
var NavigationTarget;
|
|
10
10
|
(function (NavigationTarget) {
|
|
11
|
-
NavigationTarget["
|
|
12
|
-
NavigationTarget["
|
|
13
|
-
NavigationTarget["
|
|
14
|
-
NavigationTarget["
|
|
15
|
-
NavigationTarget["
|
|
16
|
-
NavigationTarget["
|
|
17
|
-
NavigationTarget["
|
|
18
|
-
NavigationTarget["
|
|
19
|
-
NavigationTarget["
|
|
11
|
+
NavigationTarget["Workitem"] = "workitem";
|
|
12
|
+
NavigationTarget["Testcase"] = "testcase";
|
|
13
|
+
NavigationTarget["Page"] = "page";
|
|
14
|
+
NavigationTarget["Idea"] = "idea";
|
|
15
|
+
NavigationTarget["Ticket"] = "ticket";
|
|
16
|
+
NavigationTarget["Project"] = "project";
|
|
17
|
+
NavigationTarget["Library"] = "library";
|
|
18
|
+
NavigationTarget["Space"] = "space";
|
|
19
|
+
NavigationTarget["Product"] = "product";
|
|
20
20
|
})(NavigationTarget || (NavigationTarget = {}));
|
|
21
21
|
|
|
22
22
|
var NotifyType;
|
|
23
23
|
(function (NotifyType) {
|
|
24
|
-
NotifyType["
|
|
25
|
-
NotifyType["
|
|
26
|
-
NotifyType["
|
|
27
|
-
NotifyType["
|
|
24
|
+
NotifyType["Success"] = "success";
|
|
25
|
+
NotifyType["Error"] = "error";
|
|
26
|
+
NotifyType["Warning"] = "warning";
|
|
27
|
+
NotifyType["Info"] = "info";
|
|
28
28
|
})(NotifyType || (NotifyType = {}));
|
|
29
29
|
|
|
30
30
|
const NEXUS_CONTENT_UPDATE_EVENT = "nexus:content:update";
|
|
31
31
|
const NEXUS_CONTENT_CHANGE_EVENT = "nexus:content:change";
|
|
32
|
+
const NEXUS_CONFIG_READY_EVENT = "nexus:config:ready";
|
|
33
|
+
|
|
34
|
+
/** Host → Child:派发虚拟 DOM 节点事件 */
|
|
35
|
+
const HOST_DISPATCH_NATIVE_UI_EVENT = "hostDispatchToNativeUiEvent";
|
|
32
36
|
|
|
33
37
|
var HistoryAction;
|
|
34
38
|
(function (HistoryAction) {
|
|
35
|
-
HistoryAction["
|
|
36
|
-
HistoryAction["
|
|
37
|
-
HistoryAction["
|
|
39
|
+
HistoryAction["Pop"] = "POP";
|
|
40
|
+
HistoryAction["Push"] = "PUSH";
|
|
41
|
+
HistoryAction["Replace"] = "REPLACE";
|
|
38
42
|
})(HistoryAction || (HistoryAction = {}));
|
|
39
43
|
|
|
40
|
-
var
|
|
41
|
-
(function (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})(ViewportSize || (ViewportSize = {}));
|
|
49
|
-
|
|
50
|
-
var WorkItemTypeGroup;
|
|
51
|
-
(function (WorkItemTypeGroup) {
|
|
52
|
-
WorkItemTypeGroup[WorkItemTypeGroup["requirement"] = 1] = "requirement";
|
|
53
|
-
WorkItemTypeGroup[WorkItemTypeGroup["task"] = 2] = "task";
|
|
54
|
-
WorkItemTypeGroup[WorkItemTypeGroup["bug"] = 3] = "bug";
|
|
55
|
-
WorkItemTypeGroup[WorkItemTypeGroup["issue"] = 4] = "issue";
|
|
56
|
-
WorkItemTypeGroup[WorkItemTypeGroup["plan"] = 5] = "plan";
|
|
57
|
-
})(WorkItemTypeGroup || (WorkItemTypeGroup = {}));
|
|
44
|
+
var WorkitemTypeGroup;
|
|
45
|
+
(function (WorkitemTypeGroup) {
|
|
46
|
+
WorkitemTypeGroup[WorkitemTypeGroup["Requirement"] = 1] = "Requirement";
|
|
47
|
+
WorkitemTypeGroup[WorkitemTypeGroup["Task"] = 2] = "Task";
|
|
48
|
+
WorkitemTypeGroup[WorkitemTypeGroup["Bug"] = 3] = "Bug";
|
|
49
|
+
WorkitemTypeGroup[WorkitemTypeGroup["Issue"] = 4] = "Issue";
|
|
50
|
+
WorkitemTypeGroup[WorkitemTypeGroup["Plan"] = 5] = "Plan";
|
|
51
|
+
})(WorkitemTypeGroup || (WorkitemTypeGroup = {}));
|
|
58
52
|
|
|
59
53
|
/*
|
|
60
54
|
* Public API Surface of models
|
|
@@ -64,5 +58,5 @@ var WorkItemTypeGroup;
|
|
|
64
58
|
* Generated bundle index. Do not edit.
|
|
65
59
|
*/
|
|
66
60
|
|
|
67
|
-
export { HistoryAction, NEXUS_CONTENT_CHANGE_EVENT, NEXUS_CONTENT_UPDATE_EVENT, NavigationTarget, NexusAppEnvironment, NotifyType, SUPPORTED_LOCALE_CODES,
|
|
61
|
+
export { HOST_DISPATCH_NATIVE_UI_EVENT, HistoryAction, NEXUS_CONFIG_READY_EVENT, NEXUS_CONTENT_CHANGE_EVENT, NEXUS_CONTENT_UPDATE_EVENT, NavigationTarget, NexusAppEnvironment, NotifyType, SUPPORTED_LOCALE_CODES, WorkitemTypeGroup };
|
|
68
62
|
//# sourceMappingURL=pc-nexus-models.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pc-nexus-models.mjs","sources":["../../../../web/models/src/environment.ts","../../../../web/models/src/locale.ts","../../../../web/models/src/navigation.ts","../../../../web/models/src/notify.ts","../../../../web/models/src/richtext.ts","../../../../web/models/src/
|
|
1
|
+
{"version":3,"file":"pc-nexus-models.mjs","sources":["../../../../web/models/src/environment.ts","../../../../web/models/src/locale.ts","../../../../web/models/src/navigation.ts","../../../../web/models/src/notify.ts","../../../../web/models/src/richtext.ts","../../../../web/models/src/v-dom.ts","../../../../web/models/src/view.ts","../../../../web/models/src/workitem.ts","../../../../web/models/src/public-api.ts","../../../../web/models/src/pc-nexus-models.ts"],"sourcesContent":["export enum NexusAppEnvironment {\n Development = \"development\",\n Production = \"production\",\n}\n","export const SUPPORTED_LOCALE_CODES = [\"zh-CN\", \"en-US\"] as const;\n\nexport type SupportedLocaleCode = (typeof SUPPORTED_LOCALE_CODES)[number];\n\nexport interface Translator {\n translate: (key: string, params?: Record<string, any>) => TranslationsResourceContent | string;\n}\nexport interface GetTranslationsResult {\n locale: SupportedLocaleCode;\n translations: TranslationsResourceContent | null;\n}\n\nexport interface TranslationsResourceContent {\n [key: string]: string | TranslationsResourceContent;\n}\n","export enum NavigationTarget {\n Workitem = \"workitem\",\n Testcase = \"testcase\",\n Page = \"page\",\n Idea = \"idea\",\n Ticket = \"ticket\",\n Project = \"project\",\n Library = \"library\",\n Space = \"space\",\n Product = \"product\",\n}\n\ninterface NavigationTargetParams {\n target: NavigationTarget;\n id: string;\n}\n\nexport type NavigationLocation = NavigationTargetParams;\n","export enum NotifyType {\n Success = \"success\",\n Error = \"error\",\n Warning = \"warning\",\n Info = \"info\",\n}\n\nexport interface NotifyOptions {\n type: NotifyType;\n title?: string;\n description?: string;\n detail?: string | NotifyDetail;\n actions?: NotifyAction[];\n isAutoClose?: boolean;\n}\n\nexport interface NotifyRef {\n readonly close: () => void;\n}\n\nexport interface NotifyDetail {\n link?: string;\n content?: string;\n}\n\nexport interface NotifyAction {\n text: string;\n icon?: string;\n onClick: (event?: Event) => void;\n}\n","export const NEXUS_CONTENT_UPDATE_EVENT = \"nexus:content:update\";\nexport const NEXUS_CONTENT_CHANGE_EVENT = \"nexus:content:change\";\nexport const NEXUS_CONFIG_READY_EVENT = \"nexus:config:ready\";\n\nexport interface RichtextText {\n text: string;\n [key: string]: unknown;\n}\n\nexport interface RichtextElement {\n type: string;\n children: (RichtextDescendant | RichtextText)[];\n [key: string]: unknown;\n}\n\nexport type RichtextDescendant = RichtextElement;\nexport type RichtextContent = RichtextDescendant[];\n\nexport interface RichtextRendererRef {\n readonly iframe: HTMLIFrameElement;\n readonly update: (content: RichtextContent) => void;\n}\n\nexport interface RichtextEditorRef extends RichtextRendererRef {\n readonly destroy: () => void;\n}\n\nexport interface RichtextRendererOptions {\n content?: RichtextContent;\n}\n\nexport interface RichtextEditorOptions extends RichtextRendererOptions {\n onContentChange?: (content: RichtextContent) => void;\n}\n\nexport interface RichtextBridgeMessage {\n type: string;\n content?: any;\n timestamp?: number;\n source?: string;\n readonly?: boolean;\n}\n","export interface VirtualNodeSnapshot {\n kind: string;\n id: number;\n tagName?: string;\n namespace?: string | null;\n value?: string;\n attributes?: Record<string, string>;\n classes?: string[];\n styles?: Record<string, VirtualStyle>;\n properties?: Record<string, unknown>;\n listeners?: VirtualListener[];\n children?: VirtualNodeSnapshot[];\n}\n\nexport interface ReconcilePayload {\n version: number;\n snapshot: VirtualNodeSnapshot;\n}\n\nexport interface VirtualStyle {\n value: string;\n flags?: number;\n}\n\nexport interface VirtualListener {\n name: string;\n id: string;\n options?: unknown;\n}\n\nexport interface DispatchEventPayload {\n id: string;\n name: string;\n nodeId: number;\n /** 组件 output 等场景下的回调参数(如 Switch 的 checked 值) */\n detail?: unknown;\n}\n\n/** Host → Child:派发虚拟 DOM 节点事件 */\nexport const HOST_DISPATCH_NATIVE_UI_EVENT = \"hostDispatchToNativeUiEvent\";\n","export enum HistoryAction {\n Pop = \"POP\",\n Push = \"PUSH\",\n Replace = \"REPLACE\",\n}\n\nexport interface HistoryPath {\n pathname: string;\n search: string;\n hash: string;\n}\n\nexport type HistoryTo = string | Partial<HistoryPath>;\n\nexport type HistoryState = unknown;\n\nexport interface HistoryLocation extends HistoryPath {\n state: HistoryState;\n}\n\nexport interface HistoryUpdate {\n action: HistoryAction;\n location: HistoryLocation;\n}\n\nexport interface HistoryListener {\n (update: HistoryUpdate): void;\n}\n\nexport type UnlistenCallback = () => void;\n\nexport interface NexusHistory {\n action: HistoryAction;\n location: HistoryLocation;\n push(to: HistoryTo, state?: HistoryState): void;\n replace(to: HistoryTo, state?: HistoryState): void;\n go(delta: number): void;\n back(): void;\n forward(): void;\n listen(listener: HistoryListener): Promise<UnlistenCallback>;\n}\n","export enum WorkitemTypeGroup {\n Requirement = 1,\n Task = 2,\n Bug = 3,\n Issue = 4,\n Plan = 5,\n}\n\nexport interface Workitem {\n id: string;\n short_id: string;\n identifier: string;\n title: string;\n type_group?: WorkitemTypeGroup;\n type_id?: string;\n}\n\nexport interface WorkitemOpenCreateOptions {\n defaultValues?: {\n title?: string;\n project_id?: string;\n description?: string;\n };\n onSuccess?: (payload: Workitem) => void;\n}\n","/*\n * Public API Surface of models\n */\n\nexport * from \"./api\";\nexport * from \"./baseline\";\nexport * from \"./condition\";\nexport * from \"./context\";\nexport * from \"./dialog\";\nexport * from \"./environment\";\nexport * from \"./events\";\nexport * from \"./extension\";\nexport * from \"./idea\";\nexport * from \"./invoke\";\nexport * from \"./locale\";\nexport * from \"./navigation\";\nexport * from \"./notify\";\nexport * from \"./page\";\nexport * from \"./processor\";\nexport * from \"./remote\";\nexport * from \"./richtext\";\nexport * from \"./store\";\nexport * from \"./testcase\";\nexport * from \"./ticket\";\nexport * from \"./user\";\nexport * from \"./v-dom\";\nexport * from \"./view\";\nexport * from \"./viewport\";\nexport * from \"./workitem\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"IAAY;AAAZ,CAAA,UAAY,mBAAmB,EAAA;AAC3B,IAAA,mBAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAC3B,IAAA,mBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB;AAC7B,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,GAAA,EAAA,CAAA,CAAA;;MCAlB,sBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO;;ICA3C;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AACxB,IAAA,gBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,gBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,gBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,gBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,gBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,gBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,gBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACvB,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;;ICAhB;AAAZ,CAAA,UAAY,UAAU,EAAA;AAClB,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,UAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,UAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACjB,CAAC,EALW,UAAU,KAAV,UAAU,GAAA,EAAA,CAAA,CAAA;;ACAf,MAAM,0BAA0B,GAAG;AACnC,MAAM,0BAA0B,GAAG;AACnC,MAAM,wBAAwB,GAAG;;ACoCxC;AACO,MAAM,6BAA6B,GAAG;;ICvCjC;AAAZ,CAAA,UAAY,aAAa,EAAA;AACrB,IAAA,aAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACvB,CAAC,EAJW,aAAa,KAAb,aAAa,GAAA,EAAA,CAAA,CAAA;;ICAb;AAAZ,CAAA,UAAY,iBAAiB,EAAA;AACzB,IAAA,iBAAA,CAAA,iBAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAe;AACf,IAAA,iBAAA,CAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AACR,IAAA,iBAAA,CAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAO;AACP,IAAA,iBAAA,CAAA,iBAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAS;AACT,IAAA,iBAAA,CAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AACZ,CAAC,EANW,iBAAiB,KAAjB,iBAAiB,GAAA,EAAA,CAAA,CAAA;;ACA7B;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
|
+
interface InvokeResponseData {
|
|
2
|
+
status: number;
|
|
3
|
+
headers?: Record<string, string>;
|
|
4
|
+
body?: Record<string, any>;
|
|
5
|
+
}
|
|
6
|
+
type ApiInvokeOptions = Omit<RequestInit, "signal">;
|
|
7
|
+
|
|
8
|
+
interface Baseline {
|
|
9
|
+
id: string;
|
|
10
|
+
short_id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type ConditionPrimitive = string | number | boolean | null;
|
|
15
|
+
type ConditionValue = ConditionPrimitive | ConditionPrimitive[];
|
|
16
|
+
interface Conditions {
|
|
17
|
+
and?: Conditions;
|
|
18
|
+
or?: Conditions;
|
|
19
|
+
not?: Conditions;
|
|
20
|
+
hasPermission?: string;
|
|
21
|
+
isAdmin?: boolean;
|
|
22
|
+
isLoggedIn?: boolean;
|
|
23
|
+
[path: string]: ConditionValue | Conditions | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
1
26
|
declare enum NexusAppEnvironment {
|
|
2
|
-
|
|
3
|
-
|
|
27
|
+
Development = "development",
|
|
28
|
+
Production = "production"
|
|
4
29
|
}
|
|
5
30
|
|
|
6
31
|
declare const SUPPORTED_LOCALE_CODES: readonly ["zh-CN", "en-US"];
|
|
7
|
-
type
|
|
32
|
+
type SupportedLocaleCode = (typeof SUPPORTED_LOCALE_CODES)[number];
|
|
8
33
|
interface Translator {
|
|
9
|
-
translate: (key: string, params?: Record<string, any>) =>
|
|
34
|
+
translate: (key: string, params?: Record<string, any>) => TranslationsResourceContent | string;
|
|
10
35
|
}
|
|
11
36
|
interface GetTranslationsResult {
|
|
12
|
-
locale:
|
|
13
|
-
translations:
|
|
37
|
+
locale: SupportedLocaleCode;
|
|
38
|
+
translations: TranslationsResourceContent | null;
|
|
14
39
|
}
|
|
15
|
-
interface
|
|
16
|
-
[key: string]: string |
|
|
40
|
+
interface TranslationsResourceContent {
|
|
41
|
+
[key: string]: string | TranslationsResourceContent;
|
|
17
42
|
}
|
|
18
43
|
|
|
19
44
|
type ExtensionData = Record<string, any>;
|
|
20
|
-
interface
|
|
45
|
+
interface NexusAppContext<T = ExtensionData> {
|
|
21
46
|
app: {
|
|
22
47
|
id: string;
|
|
23
48
|
version: string;
|
|
@@ -29,7 +54,7 @@ interface NexusFullContext<T = ExtensionData> {
|
|
|
29
54
|
team: {
|
|
30
55
|
id: string;
|
|
31
56
|
url: string;
|
|
32
|
-
locale:
|
|
57
|
+
locale: SupportedLocaleCode;
|
|
33
58
|
timezone: string;
|
|
34
59
|
};
|
|
35
60
|
installation: {
|
|
@@ -37,7 +62,7 @@ interface NexusFullContext<T = ExtensionData> {
|
|
|
37
62
|
};
|
|
38
63
|
user: {
|
|
39
64
|
id: string;
|
|
40
|
-
locale:
|
|
65
|
+
locale: SupportedLocaleCode;
|
|
41
66
|
timezone: string;
|
|
42
67
|
};
|
|
43
68
|
extension: {
|
|
@@ -49,31 +74,12 @@ interface NexusFullContext<T = ExtensionData> {
|
|
|
49
74
|
};
|
|
50
75
|
}
|
|
51
76
|
|
|
52
|
-
type ConditionPrimitive = string | number | boolean | null;
|
|
53
|
-
type ConditionValue = ConditionPrimitive | ConditionPrimitive[];
|
|
54
|
-
interface Conditions {
|
|
55
|
-
and?: Conditions;
|
|
56
|
-
or?: Conditions;
|
|
57
|
-
not?: Conditions;
|
|
58
|
-
hasPermission?: string;
|
|
59
|
-
isAdmin?: boolean;
|
|
60
|
-
isLoggedIn?: boolean;
|
|
61
|
-
[path: string]: ConditionValue | Conditions | undefined;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
77
|
interface Viewport {
|
|
65
78
|
size?: ViewportSize;
|
|
66
79
|
}
|
|
67
|
-
|
|
68
|
-
small = "small",
|
|
69
|
-
medium = "medium",
|
|
70
|
-
large = "large",
|
|
71
|
-
xlarge = "xlarge",
|
|
72
|
-
max = "max",
|
|
73
|
-
fullscreen = "fullscreen"
|
|
74
|
-
}
|
|
80
|
+
type ViewportSize = "small" | "medium" | "large" | "xlarge" | "max" | "fullscreen";
|
|
75
81
|
|
|
76
|
-
interface
|
|
82
|
+
interface DialogOpenOptions {
|
|
77
83
|
resource: string;
|
|
78
84
|
size?: ViewportSize;
|
|
79
85
|
context?: Record<string, unknown>;
|
|
@@ -83,7 +89,7 @@ interface DialogOptions {
|
|
|
83
89
|
icon?: string;
|
|
84
90
|
}
|
|
85
91
|
interface DialogRef<T = unknown> {
|
|
86
|
-
close: (payload?: T) => void;
|
|
92
|
+
readonly close: (payload?: T) => void;
|
|
87
93
|
}
|
|
88
94
|
interface DialogConfirmOptions {
|
|
89
95
|
content: string;
|
|
@@ -103,11 +109,12 @@ interface ExtensionProperties<T extends Conditions = Conditions> {
|
|
|
103
109
|
function: string;
|
|
104
110
|
};
|
|
105
111
|
resource: string;
|
|
112
|
+
render?: string;
|
|
106
113
|
resource_upload_id: string;
|
|
107
114
|
title: string;
|
|
108
115
|
icon?: string;
|
|
109
116
|
viewport?: Viewport;
|
|
110
|
-
|
|
117
|
+
display?: T;
|
|
111
118
|
}
|
|
112
119
|
interface EgressItem {
|
|
113
120
|
addresses: string[];
|
|
@@ -129,21 +136,35 @@ interface NexusAppExtension<T extends ExtensionProperties = ExtensionProperties>
|
|
|
129
136
|
resource_ports?: Record<string, number>;
|
|
130
137
|
}
|
|
131
138
|
|
|
139
|
+
interface Idea {
|
|
140
|
+
id: string;
|
|
141
|
+
short_id: string;
|
|
142
|
+
identifier: string;
|
|
143
|
+
title: string;
|
|
144
|
+
}
|
|
145
|
+
interface IdeaOpenCreateOptions {
|
|
146
|
+
defaultValues?: {
|
|
147
|
+
title?: string;
|
|
148
|
+
product_id?: string;
|
|
149
|
+
};
|
|
150
|
+
onSuccess?: (payload: Idea) => void;
|
|
151
|
+
}
|
|
152
|
+
|
|
132
153
|
interface InvokeFunctionParams<T = unknown> {
|
|
133
154
|
function: string;
|
|
134
155
|
payload: T;
|
|
135
156
|
}
|
|
136
157
|
|
|
137
158
|
declare enum NavigationTarget {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
Workitem = "workitem",
|
|
160
|
+
Testcase = "testcase",
|
|
161
|
+
Page = "page",
|
|
162
|
+
Idea = "idea",
|
|
163
|
+
Ticket = "ticket",
|
|
164
|
+
Project = "project",
|
|
165
|
+
Library = "library",
|
|
166
|
+
Space = "space",
|
|
167
|
+
Product = "product"
|
|
147
168
|
}
|
|
148
169
|
interface NavigationTargetParams {
|
|
149
170
|
target: NavigationTarget;
|
|
@@ -152,10 +173,10 @@ interface NavigationTargetParams {
|
|
|
152
173
|
type NavigationLocation = NavigationTargetParams;
|
|
153
174
|
|
|
154
175
|
declare enum NotifyType {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
176
|
+
Success = "success",
|
|
177
|
+
Error = "error",
|
|
178
|
+
Warning = "warning",
|
|
179
|
+
Info = "info"
|
|
159
180
|
}
|
|
160
181
|
interface NotifyOptions {
|
|
161
182
|
type: NotifyType;
|
|
@@ -166,7 +187,7 @@ interface NotifyOptions {
|
|
|
166
187
|
isAutoClose?: boolean;
|
|
167
188
|
}
|
|
168
189
|
interface NotifyRef {
|
|
169
|
-
close: () => void;
|
|
190
|
+
readonly close: () => void;
|
|
170
191
|
}
|
|
171
192
|
interface NotifyDetail {
|
|
172
193
|
link?: string;
|
|
@@ -178,53 +199,91 @@ interface NotifyAction {
|
|
|
178
199
|
onClick: (event?: Event) => void;
|
|
179
200
|
}
|
|
180
201
|
|
|
202
|
+
interface Page {
|
|
203
|
+
id: string;
|
|
204
|
+
short_id: string;
|
|
205
|
+
name: string;
|
|
206
|
+
}
|
|
207
|
+
interface PageOpenCreateOptions {
|
|
208
|
+
onSuccess?: (payload: Page) => void;
|
|
209
|
+
}
|
|
210
|
+
|
|
181
211
|
type ProcessOptions = File | CustomProcessItem;
|
|
182
212
|
interface CustomProcessItem {
|
|
183
213
|
name: string;
|
|
184
214
|
icon?: string;
|
|
185
215
|
}
|
|
186
216
|
interface ProcessRef {
|
|
187
|
-
id: string;
|
|
188
|
-
setProgress(progress: number)
|
|
189
|
-
complete(payload?: {
|
|
217
|
+
readonly id: string;
|
|
218
|
+
readonly setProgress: (progress: number) => void;
|
|
219
|
+
readonly complete: (payload?: {
|
|
190
220
|
fileUrl?: string;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
cancel(): void;
|
|
221
|
+
}) => void;
|
|
222
|
+
readonly error: (message: string) => void;
|
|
223
|
+
readonly cancel: () => void;
|
|
195
224
|
}
|
|
196
225
|
|
|
197
|
-
|
|
226
|
+
type RemoteInvokeOptions = {
|
|
227
|
+
path: string;
|
|
228
|
+
} & Pick<RequestInit, "headers" | "body" | "method">;
|
|
229
|
+
type RemoteRequestOptions = {
|
|
230
|
+
path: string;
|
|
231
|
+
} & Omit<RequestInit, "signal">;
|
|
232
|
+
interface RemoteSerializedBlob {
|
|
233
|
+
__isBlobData: true;
|
|
234
|
+
data: string;
|
|
235
|
+
type: string;
|
|
236
|
+
name?: string;
|
|
237
|
+
}
|
|
238
|
+
interface RemoteSerializedFormDataEntry {
|
|
239
|
+
name: string;
|
|
240
|
+
value: string | RemoteSerializedBlob;
|
|
241
|
+
}
|
|
242
|
+
type RemoteRequestBody = string | RemoteSerializedFormDataEntry[];
|
|
243
|
+
interface RemoteRequestSerializedInit extends Omit<RequestInit, "body" | "headers" | "signal"> {
|
|
244
|
+
method: string;
|
|
245
|
+
headers?: Record<string, string>;
|
|
246
|
+
body?: RemoteRequestBody;
|
|
247
|
+
}
|
|
248
|
+
interface RemoteRequestPayload {
|
|
249
|
+
remoteKey: string;
|
|
250
|
+
path: string;
|
|
251
|
+
requestInit: RemoteRequestSerializedInit;
|
|
252
|
+
isMultipartFormData: boolean;
|
|
253
|
+
}
|
|
254
|
+
interface RemoteRequestResponseData {
|
|
198
255
|
status: number;
|
|
256
|
+
statusText?: string;
|
|
199
257
|
headers?: Record<string, string>;
|
|
200
|
-
body?:
|
|
258
|
+
body?: string;
|
|
259
|
+
isBinaryContent?: boolean;
|
|
201
260
|
}
|
|
202
|
-
type NexusRequestInit = Omit<RequestInit, "signal">;
|
|
203
261
|
|
|
204
262
|
declare const NEXUS_CONTENT_UPDATE_EVENT = "nexus:content:update";
|
|
205
263
|
declare const NEXUS_CONTENT_CHANGE_EVENT = "nexus:content:change";
|
|
264
|
+
declare const NEXUS_CONFIG_READY_EVENT = "nexus:config:ready";
|
|
206
265
|
interface RichtextText {
|
|
207
266
|
text: string;
|
|
208
267
|
[key: string]: unknown;
|
|
209
268
|
}
|
|
210
269
|
interface RichtextElement {
|
|
211
270
|
type: string;
|
|
212
|
-
children:
|
|
271
|
+
children: (RichtextDescendant | RichtextText)[];
|
|
213
272
|
[key: string]: unknown;
|
|
214
273
|
}
|
|
215
|
-
type
|
|
216
|
-
type RichtextContent =
|
|
274
|
+
type RichtextDescendant = RichtextElement;
|
|
275
|
+
type RichtextContent = RichtextDescendant[];
|
|
217
276
|
interface RichtextRendererRef {
|
|
218
|
-
iframe: HTMLIFrameElement;
|
|
219
|
-
update: (content: RichtextContent) => void;
|
|
277
|
+
readonly iframe: HTMLIFrameElement;
|
|
278
|
+
readonly update: (content: RichtextContent) => void;
|
|
220
279
|
}
|
|
221
280
|
interface RichtextEditorRef extends RichtextRendererRef {
|
|
222
|
-
destroy: () => void;
|
|
281
|
+
readonly destroy: () => void;
|
|
223
282
|
}
|
|
224
|
-
interface
|
|
283
|
+
interface RichtextRendererOptions {
|
|
225
284
|
content?: RichtextContent;
|
|
226
285
|
}
|
|
227
|
-
interface
|
|
286
|
+
interface RichtextEditorOptions extends RichtextRendererOptions {
|
|
228
287
|
onContentChange?: (content: RichtextContent) => void;
|
|
229
288
|
}
|
|
230
289
|
interface RichtextBridgeMessage {
|
|
@@ -234,157 +293,186 @@ interface RichtextBridgeMessage {
|
|
|
234
293
|
source?: string;
|
|
235
294
|
readonly?: boolean;
|
|
236
295
|
}
|
|
237
|
-
interface IframeResizerApi {
|
|
238
|
-
sendMessage: (message: unknown, targetOrigin?: string) => void;
|
|
239
|
-
}
|
|
240
296
|
|
|
241
|
-
interface
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
interface SelectMemberPopBaseOptions {
|
|
247
|
-
origin: HTMLElement;
|
|
248
|
-
}
|
|
249
|
-
interface MultipleSelectOptions extends SelectMemberPopBaseOptions {
|
|
250
|
-
multiple: true;
|
|
251
|
-
selection?: string[];
|
|
252
|
-
onConfirm?: (ids?: string[]) => Promise<void>;
|
|
253
|
-
}
|
|
254
|
-
interface SingleSelectOptions extends SelectMemberPopBaseOptions {
|
|
255
|
-
multiple?: false;
|
|
256
|
-
selection?: string;
|
|
257
|
-
onConfirm?: (id?: string) => Promise<void>;
|
|
258
|
-
}
|
|
259
|
-
type SelectMemberPopOptions = MultipleSelectOptions | SingleSelectOptions;
|
|
260
|
-
|
|
261
|
-
declare enum HistoryAction {
|
|
262
|
-
pop = "POP",
|
|
263
|
-
push = "PUSH",
|
|
264
|
-
replace = "REPLACE"
|
|
297
|
+
interface UploadResult {
|
|
298
|
+
success: boolean;
|
|
299
|
+
key: string;
|
|
300
|
+
status?: number;
|
|
301
|
+
error?: string;
|
|
265
302
|
}
|
|
266
|
-
interface
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
303
|
+
interface DownloadResult {
|
|
304
|
+
success: boolean;
|
|
305
|
+
key: string;
|
|
306
|
+
blob?: Blob;
|
|
307
|
+
name?: string;
|
|
308
|
+
status?: number;
|
|
309
|
+
error?: string;
|
|
271
310
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
go(n: number): void;
|
|
281
|
-
goBack(): void;
|
|
282
|
-
goForward(): void;
|
|
283
|
-
listen(listener: (location: LocationDescriptor, action: HistoryAction) => void): Promise<UnlistenCallback>;
|
|
311
|
+
interface GetMetadataResult {
|
|
312
|
+
key: string;
|
|
313
|
+
name: string;
|
|
314
|
+
mime_type: string;
|
|
315
|
+
checksum: string;
|
|
316
|
+
size: number;
|
|
317
|
+
created_at: string;
|
|
318
|
+
error?: string;
|
|
284
319
|
}
|
|
285
320
|
|
|
286
|
-
|
|
287
|
-
requirement = 1,
|
|
288
|
-
task = 2,
|
|
289
|
-
bug = 3,
|
|
290
|
-
issue = 4,
|
|
291
|
-
plan = 5
|
|
292
|
-
}
|
|
293
|
-
interface WorkItem {
|
|
321
|
+
interface Testcase {
|
|
294
322
|
id: string;
|
|
295
323
|
short_id: string;
|
|
296
324
|
identifier: string;
|
|
297
325
|
title: string;
|
|
298
|
-
type_group?: WorkItemTypeGroup;
|
|
299
|
-
type_id?: string;
|
|
300
326
|
}
|
|
301
|
-
interface
|
|
327
|
+
interface TestcaseOpenCreateOptions {
|
|
302
328
|
defaultValues?: {
|
|
303
329
|
title?: string;
|
|
304
|
-
|
|
305
|
-
description?: string;
|
|
330
|
+
library_id?: string;
|
|
306
331
|
};
|
|
307
|
-
onSuccess?: (payload:
|
|
332
|
+
onSuccess?: (payload: Testcase) => void;
|
|
308
333
|
}
|
|
309
334
|
|
|
310
|
-
interface
|
|
335
|
+
interface Ticket {
|
|
311
336
|
id: string;
|
|
312
337
|
short_id: string;
|
|
313
338
|
identifier: string;
|
|
314
339
|
title: string;
|
|
315
340
|
}
|
|
316
|
-
interface
|
|
341
|
+
interface TicketOpenCreateOptions {
|
|
317
342
|
defaultValues?: {
|
|
318
343
|
title?: string;
|
|
319
344
|
product_id?: string;
|
|
320
345
|
};
|
|
321
|
-
onSuccess?: (payload:
|
|
346
|
+
onSuccess?: (payload: Ticket) => void;
|
|
322
347
|
}
|
|
323
348
|
|
|
324
|
-
interface
|
|
349
|
+
interface UserInfo {
|
|
325
350
|
id: string;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
title: string;
|
|
351
|
+
display_name?: string;
|
|
352
|
+
name?: string;
|
|
329
353
|
}
|
|
330
|
-
interface
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
onSuccess?: (payload: TestCase) => void;
|
|
354
|
+
interface UserOpenDialogOptions {
|
|
355
|
+
title?: string;
|
|
356
|
+
selection?: string[];
|
|
357
|
+
onConfirm: (ids?: string[], users?: UserInfo[]) => Promise<void>;
|
|
358
|
+
onClose?: () => void;
|
|
336
359
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
id: string;
|
|
340
|
-
short_id: string;
|
|
341
|
-
identifier: string;
|
|
342
|
-
title: string;
|
|
360
|
+
interface SelectUserPopBaseOptions {
|
|
361
|
+
origin: HTMLElement;
|
|
343
362
|
}
|
|
344
|
-
interface
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
363
|
+
interface MultipleUserOpenPopoverOptions extends SelectUserPopBaseOptions {
|
|
364
|
+
multiple: true;
|
|
365
|
+
selection?: string[];
|
|
366
|
+
onConfirm: (ids?: string[], users?: UserInfo[]) => Promise<void>;
|
|
367
|
+
onClose?: () => void;
|
|
368
|
+
}
|
|
369
|
+
interface SingleUserOpenPopoverOptions extends SelectUserPopBaseOptions {
|
|
370
|
+
multiple?: false;
|
|
371
|
+
selection?: string;
|
|
372
|
+
onConfirm: (id?: string, user?: UserInfo) => Promise<void>;
|
|
373
|
+
onClose?: () => void;
|
|
374
|
+
}
|
|
375
|
+
type UserOpenPopoverOptions = MultipleUserOpenPopoverOptions | SingleUserOpenPopoverOptions;
|
|
376
|
+
interface UserOpenPopoverRef {
|
|
377
|
+
readonly close: () => void;
|
|
378
|
+
}
|
|
379
|
+
interface UserOpenDialogRef {
|
|
380
|
+
readonly close: () => void;
|
|
350
381
|
}
|
|
351
382
|
|
|
352
|
-
interface
|
|
353
|
-
|
|
354
|
-
|
|
383
|
+
interface VirtualNodeSnapshot {
|
|
384
|
+
kind: string;
|
|
385
|
+
id: number;
|
|
386
|
+
tagName?: string;
|
|
387
|
+
namespace?: string | null;
|
|
388
|
+
value?: string;
|
|
389
|
+
attributes?: Record<string, string>;
|
|
390
|
+
classes?: string[];
|
|
391
|
+
styles?: Record<string, VirtualStyle>;
|
|
392
|
+
properties?: Record<string, unknown>;
|
|
393
|
+
listeners?: VirtualListener[];
|
|
394
|
+
children?: VirtualNodeSnapshot[];
|
|
395
|
+
}
|
|
396
|
+
interface ReconcilePayload {
|
|
397
|
+
version: number;
|
|
398
|
+
snapshot: VirtualNodeSnapshot;
|
|
399
|
+
}
|
|
400
|
+
interface VirtualStyle {
|
|
401
|
+
value: string;
|
|
402
|
+
flags?: number;
|
|
403
|
+
}
|
|
404
|
+
interface VirtualListener {
|
|
355
405
|
name: string;
|
|
406
|
+
id: string;
|
|
407
|
+
options?: unknown;
|
|
356
408
|
}
|
|
357
|
-
interface
|
|
358
|
-
|
|
409
|
+
interface DispatchEventPayload {
|
|
410
|
+
id: string;
|
|
411
|
+
name: string;
|
|
412
|
+
nodeId: number;
|
|
413
|
+
/** 组件 output 等场景下的回调参数(如 Switch 的 checked 值) */
|
|
414
|
+
detail?: unknown;
|
|
359
415
|
}
|
|
416
|
+
/** Host → Child:派发虚拟 DOM 节点事件 */
|
|
417
|
+
declare const HOST_DISPATCH_NATIVE_UI_EVENT = "hostDispatchToNativeUiEvent";
|
|
360
418
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
error?: string;
|
|
366
|
-
blob: Blob;
|
|
419
|
+
declare enum HistoryAction {
|
|
420
|
+
Pop = "POP",
|
|
421
|
+
Push = "PUSH",
|
|
422
|
+
Replace = "REPLACE"
|
|
367
423
|
}
|
|
368
|
-
interface
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
status?: number;
|
|
373
|
-
error?: string;
|
|
424
|
+
interface HistoryPath {
|
|
425
|
+
pathname: string;
|
|
426
|
+
search: string;
|
|
427
|
+
hash: string;
|
|
374
428
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
createdAt?: string;
|
|
380
|
-
currentVersion?: string;
|
|
381
|
-
error?: string;
|
|
429
|
+
type HistoryTo = string | Partial<HistoryPath>;
|
|
430
|
+
type HistoryState = unknown;
|
|
431
|
+
interface HistoryLocation extends HistoryPath {
|
|
432
|
+
state: HistoryState;
|
|
382
433
|
}
|
|
383
|
-
interface
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
434
|
+
interface HistoryUpdate {
|
|
435
|
+
action: HistoryAction;
|
|
436
|
+
location: HistoryLocation;
|
|
437
|
+
}
|
|
438
|
+
interface HistoryListener {
|
|
439
|
+
(update: HistoryUpdate): void;
|
|
440
|
+
}
|
|
441
|
+
type UnlistenCallback = () => void;
|
|
442
|
+
interface NexusHistory {
|
|
443
|
+
action: HistoryAction;
|
|
444
|
+
location: HistoryLocation;
|
|
445
|
+
push(to: HistoryTo, state?: HistoryState): void;
|
|
446
|
+
replace(to: HistoryTo, state?: HistoryState): void;
|
|
447
|
+
go(delta: number): void;
|
|
448
|
+
back(): void;
|
|
449
|
+
forward(): void;
|
|
450
|
+
listen(listener: HistoryListener): Promise<UnlistenCallback>;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
declare enum WorkitemTypeGroup {
|
|
454
|
+
Requirement = 1,
|
|
455
|
+
Task = 2,
|
|
456
|
+
Bug = 3,
|
|
457
|
+
Issue = 4,
|
|
458
|
+
Plan = 5
|
|
459
|
+
}
|
|
460
|
+
interface Workitem {
|
|
461
|
+
id: string;
|
|
462
|
+
short_id: string;
|
|
463
|
+
identifier: string;
|
|
464
|
+
title: string;
|
|
465
|
+
type_group?: WorkitemTypeGroup;
|
|
466
|
+
type_id?: string;
|
|
467
|
+
}
|
|
468
|
+
interface WorkitemOpenCreateOptions {
|
|
469
|
+
defaultValues?: {
|
|
470
|
+
title?: string;
|
|
471
|
+
project_id?: string;
|
|
472
|
+
description?: string;
|
|
473
|
+
};
|
|
474
|
+
onSuccess?: (payload: Workitem) => void;
|
|
387
475
|
}
|
|
388
476
|
|
|
389
|
-
export { HistoryAction, NEXUS_CONTENT_CHANGE_EVENT, NEXUS_CONTENT_UPDATE_EVENT, NavigationTarget, NexusAppEnvironment, NotifyType, SUPPORTED_LOCALE_CODES,
|
|
390
|
-
export type { ConditionPrimitive, ConditionValue, Conditions,
|
|
477
|
+
export { HOST_DISPATCH_NATIVE_UI_EVENT, HistoryAction, NEXUS_CONFIG_READY_EVENT, NEXUS_CONTENT_CHANGE_EVENT, NEXUS_CONTENT_UPDATE_EVENT, NavigationTarget, NexusAppEnvironment, NotifyType, SUPPORTED_LOCALE_CODES, WorkitemTypeGroup };
|
|
478
|
+
export type { ApiInvokeOptions, Baseline, ConditionPrimitive, ConditionValue, Conditions, DialogConfirmOptions, DialogOpenOptions, DialogRef, DispatchEventPayload, DownloadResult, EgressItem, ExtensionData, ExtensionProperties, GetMetadataResult, GetTranslationsResult, HistoryListener, HistoryLocation, HistoryPath, HistoryState, HistoryTo, HistoryUpdate, Idea, IdeaOpenCreateOptions, InvokeFunctionParams, InvokeResponseData, MultipleUserOpenPopoverOptions, NavigationLocation, NexusAppContext, NexusAppExtension, NexusHistory, NotifyAction, NotifyDetail, NotifyOptions, NotifyRef, Page, PageOpenCreateOptions, ProcessOptions, ProcessRef, ReconcilePayload, RemoteInvokeOptions, RemoteRequestBody, RemoteRequestOptions, RemoteRequestPayload, RemoteRequestResponseData, RemoteRequestSerializedInit, RemoteSerializedBlob, RemoteSerializedFormDataEntry, RichtextBridgeMessage, RichtextContent, RichtextDescendant, RichtextEditorOptions, RichtextEditorRef, RichtextElement, RichtextRendererOptions, RichtextRendererRef, RichtextText, SingleUserOpenPopoverOptions, Subscription, SupportedLocaleCode, Testcase, TestcaseOpenCreateOptions, Ticket, TicketOpenCreateOptions, TranslationsResourceContent, Translator, UnlistenCallback, UploadResult, UserInfo, UserOpenDialogOptions, UserOpenDialogRef, UserOpenPopoverOptions, UserOpenPopoverRef, Viewport, ViewportSize, VirtualListener, VirtualNodeSnapshot, VirtualStyle, Workitem, WorkitemOpenCreateOptions };
|