@lark-project/js-sdk 2.0.1-alpha.9 → 2.0.2-dev.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/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
@@ -51,7 +51,7 @@ _a = IMPL_KEY;
51
51
  /**
52
52
  * @internal
53
53
  */
54
- Context[_a] = "Context";
54
+ Context[_a] = "context";
55
55
 
56
56
  // src/model/Space.ts
57
57
  var _a2;
@@ -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,91 @@ 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";
374
+
375
+ // src/features/Configuration.ts
376
+ var _a20;
377
+ var Configuration = class extends BaseModel {
378
+ /**
379
+ * 加载数据
380
+ */
381
+ static load() {
382
+ throw new Error("not implemented");
383
+ }
384
+ };
385
+ _a20 = IMPL_KEY;
386
+ /**
387
+ * @internal
388
+ */
389
+ Configuration[_a20] = "configuration";
390
+
391
+ // src/features/Page.ts
392
+ var _a21;
393
+ var Page = class extends BaseModel {
394
+ /**
395
+ * 加载数据
396
+ */
397
+ static load() {
398
+ throw new Error("not implemented");
399
+ }
400
+ };
401
+ _a21 = IMPL_KEY;
402
+ /**
403
+ * @internal
404
+ */
405
+ Page[_a21] = "page";
406
+
407
+ // src/features/Tab.ts
408
+ var _a22;
409
+ var Tab = class extends BaseModel {
410
+ /**
411
+ * 加载数据
412
+ */
413
+ static load() {
414
+ throw new Error("not implemented");
415
+ }
416
+ };
417
+ _a22 = IMPL_KEY;
418
+ /**
419
+ * @internal
420
+ */
421
+ Tab[_a22] = "tab";
422
+
423
+ // src/features/View.ts
424
+ var _a23;
425
+ var View = class extends BaseModel {
426
+ /**
427
+ * 加载数据
428
+ */
429
+ static load() {
430
+ throw new Error("not implemented");
431
+ }
432
+ };
433
+ _a23 = IMPL_KEY;
434
+ /**
435
+ * @internal
436
+ */
437
+ View[_a23] = "view";
326
438
 
327
439
  // src/client.ts
328
440
  function getImplClass(decl, impls) {
@@ -353,6 +465,41 @@ var _SDKClient = class {
353
465
  get control() {
354
466
  return getImplValue(Control, this._meegoBizHub);
355
467
  }
468
+ /**
469
+ * 按钮点位容器特有能力
470
+ * only 2.0
471
+ */
472
+ get button() {
473
+ return getImplValue(Button, this._meegoBizHub);
474
+ }
475
+ /**
476
+ * 配置点位容器特有能力
477
+ * only 2.0
478
+ */
479
+ get configuration() {
480
+ return getImplValue(Configuration, this._meegoBizHub);
481
+ }
482
+ /**
483
+ * 导航点位容器特有能力
484
+ * only 2.0
485
+ */
486
+ get page() {
487
+ return getImplValue(Page, this._meegoBizHub);
488
+ }
489
+ /**
490
+ * tab 点位容器特有能力
491
+ * only 2.0
492
+ */
493
+ get tab() {
494
+ return getImplValue(Tab, this._meegoBizHub);
495
+ }
496
+ /**
497
+ * 视图点位容器特有能力
498
+ * only 2.0
499
+ */
500
+ get view() {
501
+ return getImplValue(View, this._meegoBizHub);
502
+ }
356
503
  /**
357
504
  * 应用导航
358
505
  */
@@ -384,6 +531,13 @@ var _SDKClient = class {
384
531
  get richTextEditor() {
385
532
  return getImplValue(RichTextEditor, this._meegoBizHub);
386
533
  }
534
+ /**
535
+ * 工作项实例筛选器
536
+ * only web 2.0
537
+ */
538
+ get workItemFinder() {
539
+ return getImplValue(WorkItemFinder, this._meegoBizHub);
540
+ }
387
541
  /**
388
542
  * 模态框
389
543
  */
@@ -459,7 +613,7 @@ var SDKClient = _SDKClient;
459
613
  /**
460
614
  * SDK 版本号
461
615
  */
462
- SDKClient.version = "2.0.1-alpha.9";
616
+ SDKClient.version = "2.0.2-dev.1";
463
617
 
464
618
  // src/types/biz.ts
465
619
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -593,13 +747,27 @@ var InvalidParamsError = class extends CustomError {
593
747
  }
594
748
  };
595
749
 
750
+ // src/errors/NotSupportedError.ts
751
+ var NotSupportedError = class extends CustomError {
752
+ constructor(options) {
753
+ super({
754
+ message: "the api is not supported",
755
+ originMessage: options.originMessage
756
+ });
757
+ this.name = "NotSupportedError";
758
+ }
759
+ };
760
+
596
761
  // src/index.ts
597
762
  var src_default = SDKClient;
598
763
  export {
599
764
  ActionSheet,
600
765
  AttributeType,
766
+ Broadcast,
767
+ Button,
601
768
  ButtonScene,
602
769
  Clipboard,
770
+ Configuration,
603
771
  ContainerModal,
604
772
  Context,
605
773
  Control,
@@ -617,14 +785,19 @@ export {
617
785
  NoAuthError,
618
786
  NodeStatus,
619
787
  NotFoundError,
788
+ NotSupportedError,
620
789
  OutOfLimitError,
790
+ Page,
621
791
  RichTextEditor,
622
792
  SDKClient,
623
793
  Space,
624
794
  Storage,
795
+ Tab,
625
796
  Toast,
626
797
  Utils,
798
+ View,
627
799
  WorkItem,
800
+ WorkItemFinder,
628
801
  WorkObject,
629
802
  src_default as default
630
803
  };
package/dist/lib/index.js CHANGED
@@ -50,8 +50,11 @@ 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,
57
+ Configuration: () => Configuration,
55
58
  ContainerModal: () => ContainerModal,
56
59
  Context: () => Context,
57
60
  Control: () => Control,
@@ -69,14 +72,19 @@ __export(src_exports, {
69
72
  NoAuthError: () => NoAuthError,
70
73
  NodeStatus: () => NodeStatus,
71
74
  NotFoundError: () => NotFoundError,
75
+ NotSupportedError: () => NotSupportedError,
72
76
  OutOfLimitError: () => OutOfLimitError,
77
+ Page: () => Page,
73
78
  RichTextEditor: () => RichTextEditor,
74
79
  SDKClient: () => SDKClient,
75
80
  Space: () => Space,
76
81
  Storage: () => Storage,
82
+ Tab: () => Tab,
77
83
  Toast: () => Toast,
78
84
  Utils: () => Utils,
85
+ View: () => View,
79
86
  WorkItem: () => WorkItem,
87
+ WorkItemFinder: () => WorkItemFinder,
80
88
  WorkObject: () => WorkObject,
81
89
  default: () => src_default
82
90
  });
@@ -105,7 +113,7 @@ _a = IMPL_KEY;
105
113
  /**
106
114
  * @internal
107
115
  */
108
- Context[_a] = "Context";
116
+ Context[_a] = "context";
109
117
 
110
118
  // src/model/Space.ts
111
119
  var _a2;
@@ -314,9 +322,9 @@ _a12 = IMPL_KEY;
314
322
  */
315
323
  RichTextEditor[_a12] = "richTextEditor";
316
324
 
317
- // src/biz/Utils.ts
325
+ // src/biz/WorkItemFinder.ts
318
326
  var _a13;
319
- var Utils = class extends BaseModel {
327
+ var WorkItemFinder = class extends BaseModel {
320
328
  /**
321
329
  * @internal
322
330
  */
@@ -328,10 +336,42 @@ _a13 = IMPL_KEY;
328
336
  /**
329
337
  * @internal
330
338
  */
331
- Utils[_a13] = "utils";
339
+ WorkItemFinder[_a13] = "workItemFinder";
332
340
 
333
- // src/features/ContainerModal.ts
341
+ // src/biz/Utils.ts
334
342
  var _a14;
343
+ var Utils = class extends BaseModel {
344
+ /**
345
+ * @internal
346
+ */
347
+ static load() {
348
+ throw new Error("not implemented");
349
+ }
350
+ };
351
+ _a14 = IMPL_KEY;
352
+ /**
353
+ * @internal
354
+ */
355
+ Utils[_a14] = "utils";
356
+
357
+ // src/biz/Broadcast.ts
358
+ var _a15;
359
+ var Broadcast = class extends BaseModel {
360
+ /**
361
+ * @internal
362
+ */
363
+ static load() {
364
+ throw new Error("not implemented");
365
+ }
366
+ };
367
+ _a15 = IMPL_KEY;
368
+ /**
369
+ * @internal
370
+ */
371
+ Broadcast[_a15] = "broadcast";
372
+
373
+ // src/features/ContainerModal.ts
374
+ var _a16;
335
375
  var ContainerModal = class extends BaseModel {
336
376
  /**
337
377
  * 加载数据
@@ -340,14 +380,14 @@ var ContainerModal = class extends BaseModel {
340
380
  throw new Error("not implemented");
341
381
  }
342
382
  };
343
- _a14 = IMPL_KEY;
383
+ _a16 = IMPL_KEY;
344
384
  /**
345
385
  * @internal
346
386
  */
347
- ContainerModal[_a14] = "ContainerModal";
387
+ ContainerModal[_a16] = "containerModal";
348
388
 
349
389
  // src/features/Intercept.ts
350
- var _a15;
390
+ var _a17;
351
391
  var Intercept = class extends BaseModel {
352
392
  /**
353
393
  * 加载数据
@@ -356,14 +396,14 @@ var Intercept = class extends BaseModel {
356
396
  throw new Error("not implemented");
357
397
  }
358
398
  };
359
- _a15 = IMPL_KEY;
399
+ _a17 = IMPL_KEY;
360
400
  /**
361
401
  * @internal
362
402
  */
363
- Intercept[_a15] = "Intercept";
403
+ Intercept[_a17] = "intercept";
364
404
 
365
405
  // src/features/Control.ts
366
- var _a16;
406
+ var _a18;
367
407
  var Control = class extends BaseModel {
368
408
  /**
369
409
  * 加载数据
@@ -372,11 +412,91 @@ var Control = class extends BaseModel {
372
412
  throw new Error("not implemented");
373
413
  }
374
414
  };
375
- _a16 = IMPL_KEY;
415
+ _a18 = IMPL_KEY;
376
416
  /**
377
417
  * @internal
378
418
  */
379
- Control[_a16] = "Control";
419
+ Control[_a18] = "control";
420
+
421
+ // src/features/Button.ts
422
+ var _a19;
423
+ var Button = class extends BaseModel {
424
+ /**
425
+ * 加载数据
426
+ */
427
+ static load() {
428
+ throw new Error("not implemented");
429
+ }
430
+ };
431
+ _a19 = IMPL_KEY;
432
+ /**
433
+ * @internal
434
+ */
435
+ Button[_a19] = "button";
436
+
437
+ // src/features/Configuration.ts
438
+ var _a20;
439
+ var Configuration = class extends BaseModel {
440
+ /**
441
+ * 加载数据
442
+ */
443
+ static load() {
444
+ throw new Error("not implemented");
445
+ }
446
+ };
447
+ _a20 = IMPL_KEY;
448
+ /**
449
+ * @internal
450
+ */
451
+ Configuration[_a20] = "configuration";
452
+
453
+ // src/features/Page.ts
454
+ var _a21;
455
+ var Page = class extends BaseModel {
456
+ /**
457
+ * 加载数据
458
+ */
459
+ static load() {
460
+ throw new Error("not implemented");
461
+ }
462
+ };
463
+ _a21 = IMPL_KEY;
464
+ /**
465
+ * @internal
466
+ */
467
+ Page[_a21] = "page";
468
+
469
+ // src/features/Tab.ts
470
+ var _a22;
471
+ var Tab = class extends BaseModel {
472
+ /**
473
+ * 加载数据
474
+ */
475
+ static load() {
476
+ throw new Error("not implemented");
477
+ }
478
+ };
479
+ _a22 = IMPL_KEY;
480
+ /**
481
+ * @internal
482
+ */
483
+ Tab[_a22] = "tab";
484
+
485
+ // src/features/View.ts
486
+ var _a23;
487
+ var View = class extends BaseModel {
488
+ /**
489
+ * 加载数据
490
+ */
491
+ static load() {
492
+ throw new Error("not implemented");
493
+ }
494
+ };
495
+ _a23 = IMPL_KEY;
496
+ /**
497
+ * @internal
498
+ */
499
+ View[_a23] = "view";
380
500
 
381
501
  // src/client.ts
382
502
  function getImplClass(decl, impls) {
@@ -407,6 +527,41 @@ var _SDKClient = class {
407
527
  get control() {
408
528
  return getImplValue(Control, this._meegoBizHub);
409
529
  }
530
+ /**
531
+ * 按钮点位容器特有能力
532
+ * only 2.0
533
+ */
534
+ get button() {
535
+ return getImplValue(Button, this._meegoBizHub);
536
+ }
537
+ /**
538
+ * 配置点位容器特有能力
539
+ * only 2.0
540
+ */
541
+ get configuration() {
542
+ return getImplValue(Configuration, this._meegoBizHub);
543
+ }
544
+ /**
545
+ * 导航点位容器特有能力
546
+ * only 2.0
547
+ */
548
+ get page() {
549
+ return getImplValue(Page, this._meegoBizHub);
550
+ }
551
+ /**
552
+ * tab 点位容器特有能力
553
+ * only 2.0
554
+ */
555
+ get tab() {
556
+ return getImplValue(Tab, this._meegoBizHub);
557
+ }
558
+ /**
559
+ * 视图点位容器特有能力
560
+ * only 2.0
561
+ */
562
+ get view() {
563
+ return getImplValue(View, this._meegoBizHub);
564
+ }
410
565
  /**
411
566
  * 应用导航
412
567
  */
@@ -438,6 +593,13 @@ var _SDKClient = class {
438
593
  get richTextEditor() {
439
594
  return getImplValue(RichTextEditor, this._meegoBizHub);
440
595
  }
596
+ /**
597
+ * 工作项实例筛选器
598
+ * only web 2.0
599
+ */
600
+ get workItemFinder() {
601
+ return getImplValue(WorkItemFinder, this._meegoBizHub);
602
+ }
441
603
  /**
442
604
  * 模态框
443
605
  */
@@ -513,7 +675,7 @@ var SDKClient = _SDKClient;
513
675
  /**
514
676
  * SDK 版本号
515
677
  */
516
- SDKClient.version = "2.0.1-alpha.9";
678
+ SDKClient.version = "2.0.2-dev.1";
517
679
 
518
680
  // src/types/biz.ts
519
681
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -647,14 +809,28 @@ var InvalidParamsError = class extends CustomError {
647
809
  }
648
810
  };
649
811
 
812
+ // src/errors/NotSupportedError.ts
813
+ var NotSupportedError = class extends CustomError {
814
+ constructor(options) {
815
+ super({
816
+ message: "the api is not supported",
817
+ originMessage: options.originMessage
818
+ });
819
+ this.name = "NotSupportedError";
820
+ }
821
+ };
822
+
650
823
  // src/index.ts
651
824
  var src_default = SDKClient;
652
825
  // Annotate the CommonJS export names for ESM import in node:
653
826
  0 && (module.exports = {
654
827
  ActionSheet,
655
828
  AttributeType,
829
+ Broadcast,
830
+ Button,
656
831
  ButtonScene,
657
832
  Clipboard,
833
+ Configuration,
658
834
  ContainerModal,
659
835
  Context,
660
836
  Control,
@@ -672,13 +848,18 @@ var src_default = SDKClient;
672
848
  NoAuthError,
673
849
  NodeStatus,
674
850
  NotFoundError,
851
+ NotSupportedError,
675
852
  OutOfLimitError,
853
+ Page,
676
854
  RichTextEditor,
677
855
  SDKClient,
678
856
  Space,
679
857
  Storage,
858
+ Tab,
680
859
  Toast,
681
860
  Utils,
861
+ View,
682
862
  WorkItem,
863
+ WorkItemFinder,
683
864
  WorkObject
684
865
  });
@@ -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,34 @@ 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
+ * 空间标识
359
+ */
360
+ spaceId: string;
361
+ /**
362
+ * 工作项类型标识
363
+ * 适用场景:新建按钮出现在视图页时,该字段才有数据
364
+ */
365
+ workObjectId?: string;
366
+ /**
367
+ * 视图标识
368
+ * 适用场景:新建按钮出现在视图页时,该字段才有数据
349
369
  */
350
- buttonScene: ButtonScene;
370
+ viewId?: string;
351
371
  }
372
+ /**
373
+ * 按钮构成
374
+ */
375
+ type ButtonFeatureContext = WorkItemButtonFeatureContext | CreateButtonFeatureContext;
352
376
  /**
353
377
  * 内嵌页面构成
354
378
  * 一个单独的导航入口+内嵌页面
@@ -359,6 +383,15 @@ interface PageFeatureContext {
359
383
  */
360
384
  spaceId: string;
361
385
  }
386
+ /**
387
+ * 配置页面构成
388
+ */
389
+ interface ConfigFeatureContext {
390
+ /**
391
+ * 空间标识
392
+ */
393
+ spaceId: string;
394
+ }
362
395
  /**
363
396
  * 详情页 Tab 构成
364
397
  * 工作项详情页中的 Tab 页面
@@ -374,6 +407,7 @@ interface TabFeatureContext {
374
407
  workObjectId: string;
375
408
  /**
376
409
  * 工作项实例唯一标识
410
+ * 适用场景:仅在工作项实例场景下,该字段才有数据,在工作项配置侧该字段为空
377
411
  */
378
412
  workItemId: number;
379
413
  }
@@ -418,6 +452,11 @@ interface ControlFeatureContext {
418
452
  * 详情页可能为空,不推荐强依赖 UUID 读取自有数据
419
453
  */
420
454
  UUID?: string;
455
+ /**
456
+ * 当前节点标识
457
+ * 适用场景:详情页为节点流时,且当前控件位于节点表单内,该字段才有数据
458
+ */
459
+ nodeId?: string;
421
460
  }
422
461
  /**
423
462
  * 拦截事件类型
@@ -461,9 +500,20 @@ interface InterceptFeatureContext<T> {
461
500
  eventType: InterceptEvent;
462
501
  workItems: Array<BriefWorkItem & {
463
502
  /**
464
- * 当前触发事件
503
+ * 当前触发事件,不同事件类型对应不同的 changedValue
465
504
  */
466
- changedValue?: any;
505
+ changedValue?: {
506
+ fieldInfo?: Array<{
507
+ fieldKey: string;
508
+ fieldType?: string;
509
+ alias?: string;
510
+ beforeFieldValue?: unknown;
511
+ afterFieldValue?: unknown;
512
+ }>;
513
+ nodeInfo?: any;
514
+ subTaskInfo?: any;
515
+ transitionInfo?: any;
516
+ };
467
517
  }>;
468
518
  customData: T;
469
519
  }
@@ -472,6 +522,7 @@ interface InterceptFeatureContext<T> {
472
522
  * @internal
473
523
  */
474
524
  type unwatch = () => void;
525
+ type Off = unwatch;
475
526
 
476
527
  type IIgnore = string | RegExp | ((value: string) => boolean);
477
528
  interface IPluginCustomBuildConfig {
@@ -545,6 +596,12 @@ declare abstract class Context extends BaseModel {
545
596
  * @param callback
546
597
  */
547
598
  abstract watch(callback: (nextValue: Context) => void): unwatch;
599
+ /**
600
+ * only web 2.0
601
+ * 用于获取插件内设置的上下文数据
602
+ * 例如:在 sdk.modal.open 时传入的 context,可以通过该方法来获取
603
+ */
604
+ abstract getCustomContext<Context>(): Promise<Context>;
548
605
  }
549
606
 
550
607
  /**
@@ -982,9 +1039,9 @@ declare abstract class ActionSheet extends BaseModel {
982
1039
  }
983
1040
 
984
1041
  /**
985
- * Modal 展示配置
1042
+ * Modal confirm 展示配置
986
1043
  */
987
- interface ModalOptions {
1044
+ interface ModalConfirmOptions {
988
1045
  /**
989
1046
  * 标题
990
1047
  * title 和 content 不可同时为空
@@ -1011,6 +1068,40 @@ interface ModalOptions {
1011
1068
  */
1012
1069
  cancelText?: string;
1013
1070
  }
1071
+ /**
1072
+ * Modal 展示配置
1073
+ */
1074
+ interface ModalOptions<Context> {
1075
+ /**
1076
+ * 宽度
1077
+ * 默认: 448
1078
+ */
1079
+ width?: number;
1080
+ /**
1081
+ * 高度
1082
+ */
1083
+ height?: number;
1084
+ /**
1085
+ * 是否全屏
1086
+ * 全屏时 width / height 无效
1087
+ */
1088
+ fullScreen?: boolean;
1089
+ /**
1090
+ * 是否允许通过点击遮罩来关闭对话框
1091
+ */
1092
+ maskClosable?: boolean;
1093
+ /**
1094
+ * 传入 Modal 内的上下文数据
1095
+ * 注:传入的数据在 Modal 内是通过 sdk.containerModal.getContext() 来获取的
1096
+ */
1097
+ context?: Context;
1098
+ /**
1099
+ * 响应弹窗内调用的 sdk.containerModal.submit 方法
1100
+ * @param params 弹窗内调用的 sdk.containerModal.submit 的方法时传入的自定义参数
1101
+ * @returns 调用 sdk.containerModal.submit 返回的自定义值
1102
+ */
1103
+ onSubmit?: (params: unknown) => Promise<unknown>;
1104
+ }
1014
1105
  /**
1015
1106
  * @public
1016
1107
  * Modal 用于等待用户响应、告知用户重要信息或在不丢失上下文的情况下展示更多信息
@@ -1025,16 +1116,25 @@ declare abstract class Modal extends BaseModel {
1025
1116
  */
1026
1117
  private static load;
1027
1118
  /**
1028
- * 打开模态框
1119
+ * 使用模态框 confirm
1029
1120
  * @param options
1030
1121
  * @param callback
1031
1122
  * confirmed 点击了确认
1032
1123
  * canceled 点击了取消
1033
1124
  */
1034
- abstract show(options: string | ModalOptions, callback: (result: {
1125
+ abstract confirm(options: string | ModalConfirmOptions, callback: (result: {
1035
1126
  confirmed: boolean;
1036
1127
  canceled: boolean;
1037
1128
  }) => void): Promise<void>;
1129
+ /**
1130
+ * only web 2.0
1131
+ * 打开自定义内容的模态框
1132
+ * @param options
1133
+ * @returns 当前打开 Modal 的关闭方法
1134
+ */
1135
+ abstract open<Context>(options: ModalOptions<Context>): Promise<{
1136
+ close: () => void;
1137
+ }>;
1038
1138
  }
1039
1139
 
1040
1140
  /**
@@ -1106,7 +1206,62 @@ declare abstract class RichTextEditor extends BaseModel {
1106
1206
  abstract show(options: RichTextEditorOptions, callback: (result: {
1107
1207
  confirmed: boolean;
1108
1208
  canceled: boolean;
1109
- content?: RichTextEditorContent;
1209
+ nextValue?: RichTextEditorContent;
1210
+ }) => void): Promise<void>;
1211
+ }
1212
+
1213
+ /**
1214
+ * WorkItemFinder 配置
1215
+ */
1216
+ interface WorkItemFinderOptions {
1217
+ /**
1218
+ * 空间标识
1219
+ */
1220
+ spaceId: string;
1221
+ /**
1222
+ * 工作项类型标识
1223
+ */
1224
+ workObjectId: string;
1225
+ /**
1226
+ * 筛选器标题,仅用于展示
1227
+ */
1228
+ title?: string;
1229
+ /**
1230
+ * 搜索条件标识
1231
+ * 如为空则生成新 key,不为空则会覆写
1232
+ * searchId 与 workObjectId | spaceId 不匹配则会异常
1233
+ */
1234
+ searchId?: string;
1235
+ /**
1236
+ * 默认 true,控制 searchId 的筛选条件是否回填到筛选器
1237
+ */
1238
+ backfill?: boolean;
1239
+ }
1240
+ /**
1241
+ * @public
1242
+ * WorkItemFinder 用于生成工作项实例筛选条件的面板
1243
+ */
1244
+ declare abstract class WorkItemFinder extends BaseModel {
1245
+ /**
1246
+ * @internal
1247
+ */
1248
+ protected static [IMPL_KEY]: string;
1249
+ /**
1250
+ * @internal
1251
+ */
1252
+ private static load;
1253
+ /**
1254
+ * 打开工作项实例筛选条件面板
1255
+ * @param options
1256
+ * @param callback
1257
+ * confirmed 点击了确认
1258
+ * canceled 点击了取消
1259
+ * searchId 当点击确认时,返回筛选条件标识 searchId
1260
+ */
1261
+ abstract open(options: WorkItemFinderOptions, callback: (result: {
1262
+ confirmed: boolean;
1263
+ canceled: boolean;
1264
+ searchId?: string;
1110
1265
  }) => void): Promise<void>;
1111
1266
  }
1112
1267
 
@@ -1143,6 +1298,33 @@ declare abstract class Utils extends BaseModel {
1143
1298
  }>;
1144
1299
  }
1145
1300
 
1301
+ interface IBroadcastDetailPageWorkItemValueChangedEvent {
1302
+ id: number;
1303
+ spaceId: string;
1304
+ workObjectId: string;
1305
+ changedKeys: Array<AttributeType | string>;
1306
+ }
1307
+ /**
1308
+ * @public
1309
+ * 事件中心
1310
+ */
1311
+ declare abstract class Broadcast extends BaseModel {
1312
+ /**
1313
+ * @internal
1314
+ */
1315
+ protected static [IMPL_KEY]: string;
1316
+ /**
1317
+ * @internal
1318
+ */
1319
+ private static load;
1320
+ /**
1321
+ * 监听详情页工作项值变化
1322
+ * @param watchKeys 监听的工作项属性 / 字段 ID 列表
1323
+ * @param callback 当监听值发生变化时触发
1324
+ */
1325
+ abstract onDetailPageWorkItemValueChanged(watchKeys: Array<string | AttributeType>, callback: (changed: IBroadcastDetailPageWorkItemValueChangedEvent) => void): Off;
1326
+ }
1327
+
1146
1328
  /**
1147
1329
  * @public
1148
1330
  * 插件容器模态框
@@ -1157,9 +1339,16 @@ declare abstract class ContainerModal extends BaseModel {
1157
1339
  */
1158
1340
  static load(): Promise<ContainerModal>;
1159
1341
  /**
1342
+ * only web 2.0
1343
+ * 只存在于 modal.open 打开的容器内
1344
+ * submit 调用的是 sdk.modal.open 传入的 onSubmit 方法
1345
+ */
1346
+ abstract submit?: <Params, Result>(params: Params) => Promise<Result>;
1347
+ /**
1348
+ * mobile version ≥ 7.22.0
1160
1349
  * 关闭插件当前激活的容器模态框
1161
1350
  */
1162
- abstract closeModal: Promise<void>;
1351
+ abstract close(): Promise<void>;
1163
1352
  }
1164
1353
 
1165
1354
  /**
@@ -1176,9 +1365,10 @@ declare abstract class Intercept extends BaseModel {
1176
1365
  */
1177
1366
  static load(): Promise<Intercept>;
1178
1367
  /**
1368
+ * mobile version ≥ 7.22.0
1179
1369
  * 获取当前触发的拦截事件上下文
1180
1370
  */
1181
- abstract getEventCtx<T = any>(): Promise<InterceptFeatureContext<T>>;
1371
+ abstract getContext<T = any>(): Promise<InterceptFeatureContext<T>>;
1182
1372
  }
1183
1373
 
1184
1374
  /**
@@ -1195,9 +1385,118 @@ declare abstract class Control extends BaseModel {
1195
1385
  */
1196
1386
  static load(): Promise<Control>;
1197
1387
  /**
1198
- * 获取当前控件的上下文
1388
+ * mobile version ≥ 7.25.0
1389
+ * 获取当前控件所在的上下文
1199
1390
  */
1200
1391
  abstract getContext(): Promise<ControlFeatureContext>;
1392
+ /**
1393
+ * 获取新建工作项表单项的值
1394
+ * @param keys 需要获取的工作项属性 / 字段 ID 列表,一次限制读取 10 个 keys
1395
+ */
1396
+ abstract getCreateWorkItemFormItemValues(keys: Array<string | AttributeType>): Promise<Record<string | AttributeType, any>>;
1397
+ /**
1398
+ * only web 2.0
1399
+ * 监听新建工作项表单项值变化
1400
+ * @param watchKeys 需要监听的工作项属性 / 字段 ID 列表,一次限制读取 10 个 keys
1401
+ * @param callback 当监听值发生变化时触发,changedKeys 为变化的 keys
1402
+ */
1403
+ abstract onCreateWorkItemFormValueChanged(watchKeys: Array<string | AttributeType>, callback: (changedKeys: Array<string | AttributeType>) => void): Off;
1404
+ }
1405
+
1406
+ /**
1407
+ * @public
1408
+ * 按钮
1409
+ */
1410
+ declare abstract class Button extends BaseModel {
1411
+ /**
1412
+ * @internal
1413
+ */
1414
+ protected static [IMPL_KEY]: string;
1415
+ /**
1416
+ * 加载数据
1417
+ */
1418
+ static load(): Promise<Button>;
1419
+ /**
1420
+ * mobile version ≥ 7.24.0
1421
+ * 获取当前按钮的上下文
1422
+ */
1423
+ abstract getContext(): Promise<ButtonFeatureContext>;
1424
+ }
1425
+
1426
+ /**
1427
+ * @public
1428
+ * 控件
1429
+ */
1430
+ declare abstract class Configuration extends BaseModel {
1431
+ /**
1432
+ * @internal
1433
+ */
1434
+ protected static [IMPL_KEY]: string;
1435
+ /**
1436
+ * 加载数据
1437
+ */
1438
+ static load(): Promise<Configuration>;
1439
+ /**
1440
+ * 获取当前配置点位的上下文
1441
+ */
1442
+ abstract getContext(): Promise<ConfigFeatureContext>;
1443
+ }
1444
+
1445
+ /**
1446
+ * @public
1447
+ * 控件
1448
+ */
1449
+ declare abstract class Page extends BaseModel {
1450
+ /**
1451
+ * @internal
1452
+ */
1453
+ protected static [IMPL_KEY]: string;
1454
+ /**
1455
+ * 加载数据
1456
+ */
1457
+ static load(): Promise<Page>;
1458
+ /**
1459
+ * 获取当前内嵌页面的上下文
1460
+ */
1461
+ abstract getContext(): Promise<PageFeatureContext>;
1462
+ }
1463
+
1464
+ /**
1465
+ * @public
1466
+ * 控件
1467
+ */
1468
+ declare abstract class Tab extends BaseModel {
1469
+ /**
1470
+ * @internal
1471
+ */
1472
+ protected static [IMPL_KEY]: string;
1473
+ /**
1474
+ * 加载数据
1475
+ */
1476
+ static load(): Promise<Tab>;
1477
+ /**
1478
+ * 获取当前详情页 Tab 的上下文
1479
+ */
1480
+ abstract getContext(): Promise<TabFeatureContext>;
1481
+ }
1482
+
1483
+ /**
1484
+ * @public
1485
+ * 控件
1486
+ */
1487
+ declare abstract class View extends BaseModel {
1488
+ /**
1489
+ * @internal
1490
+ */
1491
+ protected static [IMPL_KEY]: string;
1492
+ /**
1493
+ * 加载数据
1494
+ */
1495
+ static load(): Promise<View>;
1496
+ /**
1497
+ * 获取当前视图的上下文
1498
+ */
1499
+ abstract getContext(): Promise<ViewFeatureContext>;
1201
1500
  }
1202
1501
 
1203
1502
  /**
@@ -1232,6 +1531,31 @@ declare class SDKClient {
1232
1531
  * only 2.0
1233
1532
  */
1234
1533
  get control(): Control;
1534
+ /**
1535
+ * 按钮点位容器特有能力
1536
+ * only 2.0
1537
+ */
1538
+ get button(): Button;
1539
+ /**
1540
+ * 配置点位容器特有能力
1541
+ * only 2.0
1542
+ */
1543
+ get configuration(): Configuration;
1544
+ /**
1545
+ * 导航点位容器特有能力
1546
+ * only 2.0
1547
+ */
1548
+ get page(): Page;
1549
+ /**
1550
+ * tab 点位容器特有能力
1551
+ * only 2.0
1552
+ */
1553
+ get tab(): Tab;
1554
+ /**
1555
+ * 视图点位容器特有能力
1556
+ * only 2.0
1557
+ */
1558
+ get view(): View;
1235
1559
  /**
1236
1560
  * 应用导航
1237
1561
  */
@@ -1253,6 +1577,11 @@ declare class SDKClient {
1253
1577
  * only 2.0
1254
1578
  */
1255
1579
  get richTextEditor(): RichTextEditor;
1580
+ /**
1581
+ * 工作项实例筛选器
1582
+ * only web 2.0
1583
+ */
1584
+ get workItemFinder(): WorkItemFinder;
1256
1585
  /**
1257
1586
  * 模态框
1258
1587
  */
@@ -1359,6 +1688,16 @@ declare class InvalidParamsError extends CustomError {
1359
1688
  });
1360
1689
  }
1361
1690
 
1691
+ /**
1692
+ * @public
1693
+ * API 在当前环境不支持
1694
+ */
1695
+ declare class NotSupportedError extends CustomError {
1696
+ constructor(options: {
1697
+ originMessage: string;
1698
+ });
1699
+ }
1700
+
1362
1701
  /**
1363
1702
  * 用于飞书项目插件读取系统数据的 JSSDK
1364
1703
  *
@@ -1368,4 +1707,4 @@ declare class InvalidParamsError extends CustomError {
1368
1707
  * @packageDocumentation
1369
1708
  */
1370
1709
 
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 };
1710
+ export { ActionSheet, ActionSheetOptions, AttributeType, BizLine, BriefField, BriefNode, BriefSpace, BriefTemplate, BriefView, BriefWorkItem, BriefWorkObject, Broadcast, Button, ButtonFeatureContext, ButtonScene, Clipboard, ColorScheme, ConfigFeatureContext, Configuration, 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, Page, PageFeatureContext, RichTextEditor, RichTextEditorContent, RichTextEditorOptions, Role, RoleOwners, SDKClient, SDKClientOptions, Space, Storage, Tab, TabFeatureContext, Toast, ToastOptions, User, Utils, View, 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.1",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"