@lark-project/js-sdk 2.0.1-alpha.9 → 2.0.2-dev.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/CHANGELOG.md CHANGED
@@ -1,4 +1,17 @@
1
1
  # Change Log
2
+ ## 2.0.6 (2024/09/12)
3
+ - 「Add」新增 Fullscreen Modal
4
+
5
+ ## 2.0.5 (2024/08/13)
6
+ - 「Add」新增 Button Context
7
+
8
+ ## 2.0.4(2024/08/06)
9
+ - 「Add」新增 WorkItemFinder
10
+
11
+ ## 2.0.3(2024/07/22)
12
+ - 「Add」新增 Control Context
13
+ - 「Add」新增 NotSupportedError
14
+
2
15
  ## 2.0.2(2024/07/11)
3
16
  - 「Add」新增 ContainerModal
4
17
  - 「Add」新增 Intercept
package/dist/es/index.js CHANGED
@@ -260,9 +260,9 @@ _a12 = IMPL_KEY;
260
260
  */
261
261
  RichTextEditor[_a12] = "richTextEditor";
262
262
 
263
- // src/biz/Utils.ts
263
+ // src/biz/WorkItemFinder.ts
264
264
  var _a13;
265
- var Utils = class extends BaseModel {
265
+ var WorkItemFinder = class extends BaseModel {
266
266
  /**
267
267
  * @internal
268
268
  */
@@ -274,10 +274,42 @@ _a13 = IMPL_KEY;
274
274
  /**
275
275
  * @internal
276
276
  */
277
- Utils[_a13] = "utils";
277
+ WorkItemFinder[_a13] = "workItemFinder";
278
278
 
279
- // src/features/ContainerModal.ts
279
+ // src/biz/Utils.ts
280
280
  var _a14;
281
+ var Utils = class extends BaseModel {
282
+ /**
283
+ * @internal
284
+ */
285
+ static load() {
286
+ throw new Error("not implemented");
287
+ }
288
+ };
289
+ _a14 = IMPL_KEY;
290
+ /**
291
+ * @internal
292
+ */
293
+ Utils[_a14] = "utils";
294
+
295
+ // src/biz/Broadcast.ts
296
+ var _a15;
297
+ var Broadcast = class extends BaseModel {
298
+ /**
299
+ * @internal
300
+ */
301
+ static load() {
302
+ throw new Error("not implemented");
303
+ }
304
+ };
305
+ _a15 = IMPL_KEY;
306
+ /**
307
+ * @internal
308
+ */
309
+ Broadcast[_a15] = "broadcast";
310
+
311
+ // src/features/ContainerModal.ts
312
+ var _a16;
281
313
  var ContainerModal = class extends BaseModel {
282
314
  /**
283
315
  * 加载数据
@@ -286,14 +318,14 @@ var ContainerModal = class extends BaseModel {
286
318
  throw new Error("not implemented");
287
319
  }
288
320
  };
289
- _a14 = IMPL_KEY;
321
+ _a16 = IMPL_KEY;
290
322
  /**
291
323
  * @internal
292
324
  */
293
- ContainerModal[_a14] = "ContainerModal";
325
+ ContainerModal[_a16] = "ContainerModal";
294
326
 
295
327
  // src/features/Intercept.ts
296
- var _a15;
328
+ var _a17;
297
329
  var Intercept = class extends BaseModel {
298
330
  /**
299
331
  * 加载数据
@@ -302,14 +334,14 @@ var Intercept = class extends BaseModel {
302
334
  throw new Error("not implemented");
303
335
  }
304
336
  };
305
- _a15 = IMPL_KEY;
337
+ _a17 = IMPL_KEY;
306
338
  /**
307
339
  * @internal
308
340
  */
309
- Intercept[_a15] = "Intercept";
341
+ Intercept[_a17] = "Intercept";
310
342
 
311
343
  // src/features/Control.ts
312
- var _a16;
344
+ var _a18;
313
345
  var Control = class extends BaseModel {
314
346
  /**
315
347
  * 加载数据
@@ -318,11 +350,27 @@ var Control = class extends BaseModel {
318
350
  throw new Error("not implemented");
319
351
  }
320
352
  };
321
- _a16 = IMPL_KEY;
353
+ _a18 = IMPL_KEY;
322
354
  /**
323
355
  * @internal
324
356
  */
325
- Control[_a16] = "Control";
357
+ Control[_a18] = "Control";
358
+
359
+ // src/features/Button.ts
360
+ var _a19;
361
+ var Button = class extends BaseModel {
362
+ /**
363
+ * 加载数据
364
+ */
365
+ static load() {
366
+ throw new Error("not implemented");
367
+ }
368
+ };
369
+ _a19 = IMPL_KEY;
370
+ /**
371
+ * @internal
372
+ */
373
+ Button[_a19] = "Button";
326
374
 
327
375
  // src/client.ts
328
376
  function getImplClass(decl, impls) {
@@ -353,6 +401,13 @@ var _SDKClient = class {
353
401
  get control() {
354
402
  return getImplValue(Control, this._meegoBizHub);
355
403
  }
404
+ /**
405
+ * 按钮点位容器特有能力
406
+ * only 2.0
407
+ */
408
+ get button() {
409
+ return getImplValue(Button, this._meegoBizHub);
410
+ }
356
411
  /**
357
412
  * 应用导航
358
413
  */
@@ -384,6 +439,13 @@ var _SDKClient = class {
384
439
  get richTextEditor() {
385
440
  return getImplValue(RichTextEditor, this._meegoBizHub);
386
441
  }
442
+ /**
443
+ * 工作项实例筛选器
444
+ * only web 2.0
445
+ */
446
+ get workItemFinder() {
447
+ return getImplValue(WorkItemFinder, this._meegoBizHub);
448
+ }
387
449
  /**
388
450
  * 模态框
389
451
  */
@@ -459,7 +521,7 @@ var SDKClient = _SDKClient;
459
521
  /**
460
522
  * SDK 版本号
461
523
  */
462
- SDKClient.version = "2.0.1-alpha.9";
524
+ SDKClient.version = "2.0.2-dev.0";
463
525
 
464
526
  // src/types/biz.ts
465
527
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -593,11 +655,24 @@ var InvalidParamsError = class extends CustomError {
593
655
  }
594
656
  };
595
657
 
658
+ // src/errors/NotSupportedError.ts
659
+ var NotSupportedError = class extends CustomError {
660
+ constructor(options) {
661
+ super({
662
+ message: "the api is not supported",
663
+ originMessage: options.originMessage
664
+ });
665
+ this.name = "NotSupportedError";
666
+ }
667
+ };
668
+
596
669
  // src/index.ts
597
670
  var src_default = SDKClient;
598
671
  export {
599
672
  ActionSheet,
600
673
  AttributeType,
674
+ Broadcast,
675
+ Button,
601
676
  ButtonScene,
602
677
  Clipboard,
603
678
  ContainerModal,
@@ -617,6 +692,7 @@ export {
617
692
  NoAuthError,
618
693
  NodeStatus,
619
694
  NotFoundError,
695
+ NotSupportedError,
620
696
  OutOfLimitError,
621
697
  RichTextEditor,
622
698
  SDKClient,
@@ -625,6 +701,7 @@ export {
625
701
  Toast,
626
702
  Utils,
627
703
  WorkItem,
704
+ WorkItemFinder,
628
705
  WorkObject,
629
706
  src_default as default
630
707
  };
package/dist/lib/index.js CHANGED
@@ -50,6 +50,8 @@ var src_exports = {};
50
50
  __export(src_exports, {
51
51
  ActionSheet: () => ActionSheet,
52
52
  AttributeType: () => AttributeType,
53
+ Broadcast: () => Broadcast,
54
+ Button: () => Button,
53
55
  ButtonScene: () => ButtonScene,
54
56
  Clipboard: () => Clipboard,
55
57
  ContainerModal: () => ContainerModal,
@@ -69,6 +71,7 @@ __export(src_exports, {
69
71
  NoAuthError: () => NoAuthError,
70
72
  NodeStatus: () => NodeStatus,
71
73
  NotFoundError: () => NotFoundError,
74
+ NotSupportedError: () => NotSupportedError,
72
75
  OutOfLimitError: () => OutOfLimitError,
73
76
  RichTextEditor: () => RichTextEditor,
74
77
  SDKClient: () => SDKClient,
@@ -77,6 +80,7 @@ __export(src_exports, {
77
80
  Toast: () => Toast,
78
81
  Utils: () => Utils,
79
82
  WorkItem: () => WorkItem,
83
+ WorkItemFinder: () => WorkItemFinder,
80
84
  WorkObject: () => WorkObject,
81
85
  default: () => src_default
82
86
  });
@@ -314,9 +318,9 @@ _a12 = IMPL_KEY;
314
318
  */
315
319
  RichTextEditor[_a12] = "richTextEditor";
316
320
 
317
- // src/biz/Utils.ts
321
+ // src/biz/WorkItemFinder.ts
318
322
  var _a13;
319
- var Utils = class extends BaseModel {
323
+ var WorkItemFinder = class extends BaseModel {
320
324
  /**
321
325
  * @internal
322
326
  */
@@ -328,10 +332,42 @@ _a13 = IMPL_KEY;
328
332
  /**
329
333
  * @internal
330
334
  */
331
- Utils[_a13] = "utils";
335
+ WorkItemFinder[_a13] = "workItemFinder";
332
336
 
333
- // src/features/ContainerModal.ts
337
+ // src/biz/Utils.ts
334
338
  var _a14;
339
+ var Utils = class extends BaseModel {
340
+ /**
341
+ * @internal
342
+ */
343
+ static load() {
344
+ throw new Error("not implemented");
345
+ }
346
+ };
347
+ _a14 = IMPL_KEY;
348
+ /**
349
+ * @internal
350
+ */
351
+ Utils[_a14] = "utils";
352
+
353
+ // src/biz/Broadcast.ts
354
+ var _a15;
355
+ var Broadcast = class extends BaseModel {
356
+ /**
357
+ * @internal
358
+ */
359
+ static load() {
360
+ throw new Error("not implemented");
361
+ }
362
+ };
363
+ _a15 = IMPL_KEY;
364
+ /**
365
+ * @internal
366
+ */
367
+ Broadcast[_a15] = "broadcast";
368
+
369
+ // src/features/ContainerModal.ts
370
+ var _a16;
335
371
  var ContainerModal = class extends BaseModel {
336
372
  /**
337
373
  * 加载数据
@@ -340,14 +376,14 @@ var ContainerModal = class extends BaseModel {
340
376
  throw new Error("not implemented");
341
377
  }
342
378
  };
343
- _a14 = IMPL_KEY;
379
+ _a16 = IMPL_KEY;
344
380
  /**
345
381
  * @internal
346
382
  */
347
- ContainerModal[_a14] = "ContainerModal";
383
+ ContainerModal[_a16] = "ContainerModal";
348
384
 
349
385
  // src/features/Intercept.ts
350
- var _a15;
386
+ var _a17;
351
387
  var Intercept = class extends BaseModel {
352
388
  /**
353
389
  * 加载数据
@@ -356,14 +392,14 @@ var Intercept = class extends BaseModel {
356
392
  throw new Error("not implemented");
357
393
  }
358
394
  };
359
- _a15 = IMPL_KEY;
395
+ _a17 = IMPL_KEY;
360
396
  /**
361
397
  * @internal
362
398
  */
363
- Intercept[_a15] = "Intercept";
399
+ Intercept[_a17] = "Intercept";
364
400
 
365
401
  // src/features/Control.ts
366
- var _a16;
402
+ var _a18;
367
403
  var Control = class extends BaseModel {
368
404
  /**
369
405
  * 加载数据
@@ -372,11 +408,27 @@ var Control = class extends BaseModel {
372
408
  throw new Error("not implemented");
373
409
  }
374
410
  };
375
- _a16 = IMPL_KEY;
411
+ _a18 = IMPL_KEY;
376
412
  /**
377
413
  * @internal
378
414
  */
379
- Control[_a16] = "Control";
415
+ Control[_a18] = "Control";
416
+
417
+ // src/features/Button.ts
418
+ var _a19;
419
+ var Button = class extends BaseModel {
420
+ /**
421
+ * 加载数据
422
+ */
423
+ static load() {
424
+ throw new Error("not implemented");
425
+ }
426
+ };
427
+ _a19 = IMPL_KEY;
428
+ /**
429
+ * @internal
430
+ */
431
+ Button[_a19] = "Button";
380
432
 
381
433
  // src/client.ts
382
434
  function getImplClass(decl, impls) {
@@ -407,6 +459,13 @@ var _SDKClient = class {
407
459
  get control() {
408
460
  return getImplValue(Control, this._meegoBizHub);
409
461
  }
462
+ /**
463
+ * 按钮点位容器特有能力
464
+ * only 2.0
465
+ */
466
+ get button() {
467
+ return getImplValue(Button, this._meegoBizHub);
468
+ }
410
469
  /**
411
470
  * 应用导航
412
471
  */
@@ -438,6 +497,13 @@ var _SDKClient = class {
438
497
  get richTextEditor() {
439
498
  return getImplValue(RichTextEditor, this._meegoBizHub);
440
499
  }
500
+ /**
501
+ * 工作项实例筛选器
502
+ * only web 2.0
503
+ */
504
+ get workItemFinder() {
505
+ return getImplValue(WorkItemFinder, this._meegoBizHub);
506
+ }
441
507
  /**
442
508
  * 模态框
443
509
  */
@@ -513,7 +579,7 @@ var SDKClient = _SDKClient;
513
579
  /**
514
580
  * SDK 版本号
515
581
  */
516
- SDKClient.version = "2.0.1-alpha.9";
582
+ SDKClient.version = "2.0.2-dev.0";
517
583
 
518
584
  // src/types/biz.ts
519
585
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -647,12 +713,25 @@ var InvalidParamsError = class extends CustomError {
647
713
  }
648
714
  };
649
715
 
716
+ // src/errors/NotSupportedError.ts
717
+ var NotSupportedError = class extends CustomError {
718
+ constructor(options) {
719
+ super({
720
+ message: "the api is not supported",
721
+ originMessage: options.originMessage
722
+ });
723
+ this.name = "NotSupportedError";
724
+ }
725
+ };
726
+
650
727
  // src/index.ts
651
728
  var src_default = SDKClient;
652
729
  // Annotate the CommonJS export names for ESM import in node:
653
730
  0 && (module.exports = {
654
731
  ActionSheet,
655
732
  AttributeType,
733
+ Broadcast,
734
+ Button,
656
735
  ButtonScene,
657
736
  Clipboard,
658
737
  ContainerModal,
@@ -672,6 +751,7 @@ var src_default = SDKClient;
672
751
  NoAuthError,
673
752
  NodeStatus,
674
753
  NotFoundError,
754
+ NotSupportedError,
675
755
  OutOfLimitError,
676
756
  RichTextEditor,
677
757
  SDKClient,
@@ -680,5 +760,6 @@ var src_default = SDKClient;
680
760
  Toast,
681
761
  Utils,
682
762
  WorkItem,
763
+ WorkItemFinder,
683
764
  WorkObject
684
765
  });
@@ -328,10 +328,10 @@ declare enum ButtonScene {
328
328
  workItemNode = 4
329
329
  }
330
330
  /**
331
- * 按钮构成
332
- * 可被配置于详情页工具栏,视图页、视图工具栏、用于操作单个或多个工作项
331
+ * 工作项实例按钮上下文
332
+ * 适用场景:工作项-更多 / 节点-更多 / 节点流转
333
333
  */
334
- interface ButtonFeatureContext {
334
+ interface WorkItemButtonFeatureContext {
335
335
  /**
336
336
  * 空间标识
337
337
  */
@@ -345,10 +345,24 @@ interface ButtonFeatureContext {
345
345
  */
346
346
  workItemId: number;
347
347
  /**
348
- * 按钮位置
348
+ * 按钮所属节点标识
349
+ * 适用场景:节点-更多 / 节点流转
350
+ */
351
+ nodeId?: string;
352
+ }
353
+ /**
354
+ * 新建按钮上下文
355
+ */
356
+ interface CreateButtonFeatureContext {
357
+ /**
358
+ * 空间标识
349
359
  */
350
- buttonScene: ButtonScene;
360
+ spaceId: string;
351
361
  }
362
+ /**
363
+ * 按钮构成
364
+ */
365
+ type ButtonFeatureContext = WorkItemButtonFeatureContext | CreateButtonFeatureContext;
352
366
  /**
353
367
  * 内嵌页面构成
354
368
  * 一个单独的导航入口+内嵌页面
@@ -461,9 +475,20 @@ interface InterceptFeatureContext<T> {
461
475
  eventType: InterceptEvent;
462
476
  workItems: Array<BriefWorkItem & {
463
477
  /**
464
- * 当前触发事件
478
+ * 当前触发事件,不同事件类型对应不同的 changedValue
465
479
  */
466
- changedValue?: any;
480
+ changedValue?: {
481
+ fieldInfo?: Array<{
482
+ fieldKey: string;
483
+ fieldType?: string;
484
+ alias?: string;
485
+ beforeFieldValue?: unknown;
486
+ afterFieldValue?: unknown;
487
+ }>;
488
+ nodeInfo?: any;
489
+ subTaskInfo?: any;
490
+ transitionInfo?: any;
491
+ };
467
492
  }>;
468
493
  customData: T;
469
494
  }
@@ -472,6 +497,7 @@ interface InterceptFeatureContext<T> {
472
497
  * @internal
473
498
  */
474
499
  type unwatch = () => void;
500
+ type Off = unwatch;
475
501
 
476
502
  type IIgnore = string | RegExp | ((value: string) => boolean);
477
503
  interface IPluginCustomBuildConfig {
@@ -545,6 +571,12 @@ declare abstract class Context extends BaseModel {
545
571
  * @param callback
546
572
  */
547
573
  abstract watch(callback: (nextValue: Context) => void): unwatch;
574
+ /**
575
+ * only web 2.0
576
+ * 用于获取插件内设置的上下文数据
577
+ * 例如:在 sdk.modal.open 时传入的 context,可以通过该方法来获取
578
+ */
579
+ abstract getCustomContext<Context>(): Promise<Context>;
548
580
  }
549
581
 
550
582
  /**
@@ -982,9 +1014,9 @@ declare abstract class ActionSheet extends BaseModel {
982
1014
  }
983
1015
 
984
1016
  /**
985
- * Modal 展示配置
1017
+ * Modal confirm 展示配置
986
1018
  */
987
- interface ModalOptions {
1019
+ interface ModalConfirmOptions {
988
1020
  /**
989
1021
  * 标题
990
1022
  * title 和 content 不可同时为空
@@ -1011,6 +1043,40 @@ interface ModalOptions {
1011
1043
  */
1012
1044
  cancelText?: string;
1013
1045
  }
1046
+ /**
1047
+ * Modal 展示配置
1048
+ */
1049
+ interface ModalOptions<Context> {
1050
+ /**
1051
+ * 宽度
1052
+ * 默认: 448
1053
+ */
1054
+ width?: number;
1055
+ /**
1056
+ * 高度
1057
+ */
1058
+ height?: number;
1059
+ /**
1060
+ * 是否全屏
1061
+ * 全屏时 width / height 无效
1062
+ */
1063
+ fullScreen?: boolean;
1064
+ /**
1065
+ * 是否允许通过点击遮罩来关闭对话框
1066
+ */
1067
+ maskClosable?: boolean;
1068
+ /**
1069
+ * 传入 Modal 内的上下文数据
1070
+ * 注:传入的数据在 Modal 内是通过 sdk.containerModal.getContext() 来获取的
1071
+ */
1072
+ context?: Context;
1073
+ /**
1074
+ * 响应弹窗内调用的 sdk.containerModal.submit 方法
1075
+ * @param params 弹窗内调用的 sdk.containerModal.submit 的方法时传入的自定义参数
1076
+ * @returns 调用 sdk.containerModal.submit 返回的自定义值
1077
+ */
1078
+ onSubmit?: (params: unknown) => Promise<unknown>;
1079
+ }
1014
1080
  /**
1015
1081
  * @public
1016
1082
  * Modal 用于等待用户响应、告知用户重要信息或在不丢失上下文的情况下展示更多信息
@@ -1025,16 +1091,25 @@ declare abstract class Modal extends BaseModel {
1025
1091
  */
1026
1092
  private static load;
1027
1093
  /**
1028
- * 打开模态框
1094
+ * 使用模态框 confirm
1029
1095
  * @param options
1030
1096
  * @param callback
1031
1097
  * confirmed 点击了确认
1032
1098
  * canceled 点击了取消
1033
1099
  */
1034
- abstract show(options: string | ModalOptions, callback: (result: {
1100
+ abstract confirm(options: string | ModalConfirmOptions, callback: (result: {
1035
1101
  confirmed: boolean;
1036
1102
  canceled: boolean;
1037
1103
  }) => void): Promise<void>;
1104
+ /**
1105
+ * only web 2.0
1106
+ * 打开自定义内容的模态框
1107
+ * @param options
1108
+ * @returns 当前打开 Modal 的关闭方法
1109
+ */
1110
+ abstract open<Context>(options: ModalOptions<Context>): Promise<{
1111
+ close: () => void;
1112
+ }>;
1038
1113
  }
1039
1114
 
1040
1115
  /**
@@ -1106,7 +1181,62 @@ declare abstract class RichTextEditor extends BaseModel {
1106
1181
  abstract show(options: RichTextEditorOptions, callback: (result: {
1107
1182
  confirmed: boolean;
1108
1183
  canceled: boolean;
1109
- content?: RichTextEditorContent;
1184
+ nextValue?: RichTextEditorContent;
1185
+ }) => void): Promise<void>;
1186
+ }
1187
+
1188
+ /**
1189
+ * WorkItemFinder 配置
1190
+ */
1191
+ interface WorkItemFinderOptions {
1192
+ /**
1193
+ * 空间标识
1194
+ */
1195
+ spaceId: string;
1196
+ /**
1197
+ * 工作项类型标识
1198
+ */
1199
+ workObjectId: string;
1200
+ /**
1201
+ * 筛选器标题,仅用于展示
1202
+ */
1203
+ title?: string;
1204
+ /**
1205
+ * 搜索条件标识
1206
+ * 如为空则生成新 key,不为空则会覆写
1207
+ * searchId 与 workObjectId | spaceId 不匹配则会异常
1208
+ */
1209
+ searchId?: string;
1210
+ /**
1211
+ * 默认 true,控制 searchId 的筛选条件是否回填到筛选器
1212
+ */
1213
+ backfill?: boolean;
1214
+ }
1215
+ /**
1216
+ * @public
1217
+ * WorkItemFinder 用于生成工作项实例筛选条件的面板
1218
+ */
1219
+ declare abstract class WorkItemFinder extends BaseModel {
1220
+ /**
1221
+ * @internal
1222
+ */
1223
+ protected static [IMPL_KEY]: string;
1224
+ /**
1225
+ * @internal
1226
+ */
1227
+ private static load;
1228
+ /**
1229
+ * 打开工作项实例筛选条件面板
1230
+ * @param options
1231
+ * @param callback
1232
+ * confirmed 点击了确认
1233
+ * canceled 点击了取消
1234
+ * searchId 当点击确认时,返回筛选条件标识 searchId
1235
+ */
1236
+ abstract open(options: WorkItemFinderOptions, callback: (result: {
1237
+ confirmed: boolean;
1238
+ canceled: boolean;
1239
+ searchId?: string;
1110
1240
  }) => void): Promise<void>;
1111
1241
  }
1112
1242
 
@@ -1143,6 +1273,35 @@ declare abstract class Utils extends BaseModel {
1143
1273
  }>;
1144
1274
  }
1145
1275
 
1276
+ interface IBroadcastDetailPageWorkItemValueChangedEvent {
1277
+ workItems: Array<{
1278
+ id: number;
1279
+ spaceId: string;
1280
+ workObjectId: string;
1281
+ changedKeys: Array<AttributeType | string>;
1282
+ }>;
1283
+ }
1284
+ /**
1285
+ * @public
1286
+ * 事件中心
1287
+ */
1288
+ declare abstract class Broadcast extends BaseModel {
1289
+ /**
1290
+ * @internal
1291
+ */
1292
+ protected static [IMPL_KEY]: string;
1293
+ /**
1294
+ * @internal
1295
+ */
1296
+ private static load;
1297
+ /**
1298
+ * 监听详情页工作项值变化
1299
+ * @param watchKeys 监听的工作项属性 / 字段 ID 列表
1300
+ * @param callback 当监听值发生变化时触发
1301
+ */
1302
+ abstract onDetailPageWorkItemValueChanged(watchKeys: Array<string | AttributeType>, callback: (changed: IBroadcastDetailPageWorkItemValueChangedEvent) => void): Off;
1303
+ }
1304
+
1146
1305
  /**
1147
1306
  * @public
1148
1307
  * 插件容器模态框
@@ -1156,10 +1315,16 @@ declare abstract class ContainerModal extends BaseModel {
1156
1315
  * 加载数据
1157
1316
  */
1158
1317
  static load(): Promise<ContainerModal>;
1318
+ /**
1319
+ * only web 2.0
1320
+ * 只存在于 modal.open 打开的容器内
1321
+ * submit 调用的是 sdk.modal.open 传入的 onSubmit 方法
1322
+ */
1323
+ abstract submit?: <Params, Result>(params: Params) => Promise<Result>;
1159
1324
  /**
1160
1325
  * 关闭插件当前激活的容器模态框
1161
1326
  */
1162
- abstract closeModal: Promise<void>;
1327
+ abstract close(): Promise<void>;
1163
1328
  }
1164
1329
 
1165
1330
  /**
@@ -1178,7 +1343,7 @@ declare abstract class Intercept extends BaseModel {
1178
1343
  /**
1179
1344
  * 获取当前触发的拦截事件上下文
1180
1345
  */
1181
- abstract getEventCtx<T = any>(): Promise<InterceptFeatureContext<T>>;
1346
+ abstract getContext<T = any>(): Promise<InterceptFeatureContext<T>>;
1182
1347
  }
1183
1348
 
1184
1349
  /**
@@ -1195,9 +1360,39 @@ declare abstract class Control extends BaseModel {
1195
1360
  */
1196
1361
  static load(): Promise<Control>;
1197
1362
  /**
1198
- * 获取当前控件的上下文
1363
+ * 获取当前控件所在的上下文
1199
1364
  */
1200
1365
  abstract getContext(): Promise<ControlFeatureContext>;
1366
+ /**
1367
+ * 获取新建工作项表单项的值
1368
+ * @param keys 需要获取的工作项属性 / 字段 ID 列表,一次限制读取 10 个 keys
1369
+ */
1370
+ abstract getCreateWorkItemFormItemValues(keys: Array<string | AttributeType>): Promise<Record<string | AttributeType, any>>;
1371
+ /**
1372
+ * 监听新建工作项表单项值变化
1373
+ * @param watchKeys 需要监听的工作项属性 / 字段 ID 列表,一次限制读取 10 个 keys
1374
+ * @param callback 当监听值发生变化时触发,changedKeys 为变化的 keys
1375
+ */
1376
+ abstract onCreateWorkItemFormValueChanged(watchKeys: Array<string | AttributeType>, callback: (changedKeys: Array<string | AttributeType>) => void): Off;
1377
+ }
1378
+
1379
+ /**
1380
+ * @public
1381
+ * 按钮
1382
+ */
1383
+ declare abstract class Button extends BaseModel {
1384
+ /**
1385
+ * @internal
1386
+ */
1387
+ protected static [IMPL_KEY]: string;
1388
+ /**
1389
+ * 加载数据
1390
+ */
1391
+ static load(): Promise<Button>;
1392
+ /**
1393
+ * 获取当前按钮的上下文
1394
+ */
1395
+ abstract getContext(): Promise<ButtonFeatureContext>;
1201
1396
  }
1202
1397
 
1203
1398
  /**
@@ -1232,6 +1427,11 @@ declare class SDKClient {
1232
1427
  * only 2.0
1233
1428
  */
1234
1429
  get control(): Control;
1430
+ /**
1431
+ * 按钮点位容器特有能力
1432
+ * only 2.0
1433
+ */
1434
+ get button(): Button;
1235
1435
  /**
1236
1436
  * 应用导航
1237
1437
  */
@@ -1253,6 +1453,11 @@ declare class SDKClient {
1253
1453
  * only 2.0
1254
1454
  */
1255
1455
  get richTextEditor(): RichTextEditor;
1456
+ /**
1457
+ * 工作项实例筛选器
1458
+ * only web 2.0
1459
+ */
1460
+ get workItemFinder(): WorkItemFinder;
1256
1461
  /**
1257
1462
  * 模态框
1258
1463
  */
@@ -1359,6 +1564,16 @@ declare class InvalidParamsError extends CustomError {
1359
1564
  });
1360
1565
  }
1361
1566
 
1567
+ /**
1568
+ * @public
1569
+ * API 在当前环境不支持
1570
+ */
1571
+ declare class NotSupportedError extends CustomError {
1572
+ constructor(options: {
1573
+ originMessage: string;
1574
+ });
1575
+ }
1576
+
1362
1577
  /**
1363
1578
  * 用于飞书项目插件读取系统数据的 JSSDK
1364
1579
  *
@@ -1368,4 +1583,4 @@ declare class InvalidParamsError extends CustomError {
1368
1583
  * @packageDocumentation
1369
1584
  */
1370
1585
 
1371
- export { ActionSheet, ActionSheetOptions, AttributeType, BizLine, BriefField, BriefNode, BriefSpace, BriefTemplate, BriefView, BriefWorkItem, BriefWorkObject, ButtonFeatureContext, ButtonScene, Clipboard, ColorScheme, ContainerModal, Context, Control, ControlFeatureContext, Field, FieldType, FlowMode, IMPL_KEY, IPluginCustomBuildConfig, IntegrationFeatureContext, Intercept, InterceptEvent, InterceptFeatureContext, InternalError, InvalidParamsError, Language, MEEGO_BIZ_HUB, Modal, ModalOptions, Navigation, NoAuthError, NodeStatus, NotFoundError, OutOfLimitError, PageFeatureContext, RichTextEditor, RichTextEditorContent, RichTextEditorOptions, Role, RoleOwners, SDKClient, SDKClientOptions, Space, Storage, TabFeatureContext, Toast, ToastOptions, User, Utils, ViewFeatureContext, WorkItem, WorkItemCreateFormPreset, WorkObject, SDKClient as default, unwatch };
1586
+ export { ActionSheet, ActionSheetOptions, AttributeType, BizLine, BriefField, BriefNode, BriefSpace, BriefTemplate, BriefView, BriefWorkItem, BriefWorkObject, Broadcast, Button, ButtonFeatureContext, ButtonScene, Clipboard, ColorScheme, ContainerModal, Context, Control, ControlFeatureContext, CreateButtonFeatureContext, Field, FieldType, FlowMode, IBroadcastDetailPageWorkItemValueChangedEvent, IMPL_KEY, IPluginCustomBuildConfig, IntegrationFeatureContext, Intercept, InterceptEvent, InterceptFeatureContext, InternalError, InvalidParamsError, Language, MEEGO_BIZ_HUB, Modal, ModalConfirmOptions, Navigation, NoAuthError, NodeStatus, NotFoundError, NotSupportedError, Off, OutOfLimitError, PageFeatureContext, RichTextEditor, RichTextEditorContent, RichTextEditorOptions, Role, RoleOwners, SDKClient, SDKClientOptions, Space, Storage, TabFeatureContext, Toast, ToastOptions, User, Utils, ViewFeatureContext, WorkItem, WorkItemButtonFeatureContext, WorkItemCreateFormPreset, WorkItemFinder, WorkItemFinderOptions, WorkObject, SDKClient as default, unwatch };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-project/js-sdk",
3
- "version": "2.0.1-alpha.9",
3
+ "version": "2.0.2-dev.0",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"