@lark-project/js-sdk 2.0.1-alpha.9 → 2.0.1-dev.22

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,26 @@ _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/features/ContainerModal.ts
296
+ var _a15;
281
297
  var ContainerModal = class extends BaseModel {
282
298
  /**
283
299
  * 加载数据
@@ -286,14 +302,14 @@ var ContainerModal = class extends BaseModel {
286
302
  throw new Error("not implemented");
287
303
  }
288
304
  };
289
- _a14 = IMPL_KEY;
305
+ _a15 = IMPL_KEY;
290
306
  /**
291
307
  * @internal
292
308
  */
293
- ContainerModal[_a14] = "ContainerModal";
309
+ ContainerModal[_a15] = "containerModal";
294
310
 
295
311
  // src/features/Intercept.ts
296
- var _a15;
312
+ var _a16;
297
313
  var Intercept = class extends BaseModel {
298
314
  /**
299
315
  * 加载数据
@@ -302,14 +318,14 @@ var Intercept = class extends BaseModel {
302
318
  throw new Error("not implemented");
303
319
  }
304
320
  };
305
- _a15 = IMPL_KEY;
321
+ _a16 = IMPL_KEY;
306
322
  /**
307
323
  * @internal
308
324
  */
309
- Intercept[_a15] = "Intercept";
325
+ Intercept[_a16] = "intercept";
310
326
 
311
327
  // src/features/Control.ts
312
- var _a16;
328
+ var _a17;
313
329
  var Control = class extends BaseModel {
314
330
  /**
315
331
  * 加载数据
@@ -318,11 +334,91 @@ var Control = class extends BaseModel {
318
334
  throw new Error("not implemented");
319
335
  }
320
336
  };
321
- _a16 = IMPL_KEY;
337
+ _a17 = IMPL_KEY;
338
+ /**
339
+ * @internal
340
+ */
341
+ Control[_a17] = "control";
342
+
343
+ // src/features/Button.ts
344
+ var _a18;
345
+ var Button = class extends BaseModel {
346
+ /**
347
+ * 加载数据
348
+ */
349
+ static load() {
350
+ throw new Error("not implemented");
351
+ }
352
+ };
353
+ _a18 = IMPL_KEY;
354
+ /**
355
+ * @internal
356
+ */
357
+ Button[_a18] = "button";
358
+
359
+ // src/features/Configuration.ts
360
+ var _a19;
361
+ var Configuration = 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
+ Configuration[_a19] = "configuration";
374
+
375
+ // src/features/Page.ts
376
+ var _a20;
377
+ var Page = 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
+ Page[_a20] = "page";
390
+
391
+ // src/features/Tab.ts
392
+ var _a21;
393
+ var Tab = 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
+ Tab[_a21] = "tab";
406
+
407
+ // src/features/View.ts
408
+ var _a22;
409
+ var View = class extends BaseModel {
410
+ /**
411
+ * 加载数据
412
+ */
413
+ static load() {
414
+ throw new Error("not implemented");
415
+ }
416
+ };
417
+ _a22 = IMPL_KEY;
322
418
  /**
323
419
  * @internal
324
420
  */
325
- Control[_a16] = "Control";
421
+ View[_a22] = "view";
326
422
 
327
423
  // src/client.ts
328
424
  function getImplClass(decl, impls) {
@@ -353,6 +449,41 @@ var _SDKClient = class {
353
449
  get control() {
354
450
  return getImplValue(Control, this._meegoBizHub);
355
451
  }
452
+ /**
453
+ * 按钮点位容器特有能力
454
+ * only 2.0
455
+ */
456
+ get button() {
457
+ return getImplValue(Button, this._meegoBizHub);
458
+ }
459
+ /**
460
+ * 配置点位容器特有能力
461
+ * only 2.0
462
+ */
463
+ get configuration() {
464
+ return getImplValue(Configuration, this._meegoBizHub);
465
+ }
466
+ /**
467
+ * 导航点位容器特有能力
468
+ * only 2.0
469
+ */
470
+ get page() {
471
+ return getImplValue(Page, this._meegoBizHub);
472
+ }
473
+ /**
474
+ * tab 点位容器特有能力
475
+ * only 2.0
476
+ */
477
+ get tab() {
478
+ return getImplValue(Tab, this._meegoBizHub);
479
+ }
480
+ /**
481
+ * 视图点位容器特有能力
482
+ * only 2.0
483
+ */
484
+ get view() {
485
+ return getImplValue(View, this._meegoBizHub);
486
+ }
356
487
  /**
357
488
  * 应用导航
358
489
  */
@@ -384,6 +515,13 @@ var _SDKClient = class {
384
515
  get richTextEditor() {
385
516
  return getImplValue(RichTextEditor, this._meegoBizHub);
386
517
  }
518
+ /**
519
+ * 工作项实例筛选器
520
+ * only web 2.0
521
+ */
522
+ get workItemFinder() {
523
+ return getImplValue(WorkItemFinder, this._meegoBizHub);
524
+ }
387
525
  /**
388
526
  * 模态框
389
527
  */
@@ -459,7 +597,7 @@ var SDKClient = _SDKClient;
459
597
  /**
460
598
  * SDK 版本号
461
599
  */
462
- SDKClient.version = "2.0.1-alpha.9";
600
+ SDKClient.version = "2.0.1-dev.22";
463
601
 
464
602
  // src/types/biz.ts
465
603
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -593,13 +731,26 @@ var InvalidParamsError = class extends CustomError {
593
731
  }
594
732
  };
595
733
 
734
+ // src/errors/NotSupportedError.ts
735
+ var NotSupportedError = class extends CustomError {
736
+ constructor(options) {
737
+ super({
738
+ message: "the api is not supported",
739
+ originMessage: options.originMessage
740
+ });
741
+ this.name = "NotSupportedError";
742
+ }
743
+ };
744
+
596
745
  // src/index.ts
597
746
  var src_default = SDKClient;
598
747
  export {
599
748
  ActionSheet,
600
749
  AttributeType,
750
+ Button,
601
751
  ButtonScene,
602
752
  Clipboard,
753
+ Configuration,
603
754
  ContainerModal,
604
755
  Context,
605
756
  Control,
@@ -617,14 +768,19 @@ export {
617
768
  NoAuthError,
618
769
  NodeStatus,
619
770
  NotFoundError,
771
+ NotSupportedError,
620
772
  OutOfLimitError,
773
+ Page,
621
774
  RichTextEditor,
622
775
  SDKClient,
623
776
  Space,
624
777
  Storage,
778
+ Tab,
625
779
  Toast,
626
780
  Utils,
781
+ View,
627
782
  WorkItem,
783
+ WorkItemFinder,
628
784
  WorkObject,
629
785
  src_default as default
630
786
  };
package/dist/lib/index.js CHANGED
@@ -50,8 +50,10 @@ var src_exports = {};
50
50
  __export(src_exports, {
51
51
  ActionSheet: () => ActionSheet,
52
52
  AttributeType: () => AttributeType,
53
+ Button: () => Button,
53
54
  ButtonScene: () => ButtonScene,
54
55
  Clipboard: () => Clipboard,
56
+ Configuration: () => Configuration,
55
57
  ContainerModal: () => ContainerModal,
56
58
  Context: () => Context,
57
59
  Control: () => Control,
@@ -69,14 +71,19 @@ __export(src_exports, {
69
71
  NoAuthError: () => NoAuthError,
70
72
  NodeStatus: () => NodeStatus,
71
73
  NotFoundError: () => NotFoundError,
74
+ NotSupportedError: () => NotSupportedError,
72
75
  OutOfLimitError: () => OutOfLimitError,
76
+ Page: () => Page,
73
77
  RichTextEditor: () => RichTextEditor,
74
78
  SDKClient: () => SDKClient,
75
79
  Space: () => Space,
76
80
  Storage: () => Storage,
81
+ Tab: () => Tab,
77
82
  Toast: () => Toast,
78
83
  Utils: () => Utils,
84
+ View: () => View,
79
85
  WorkItem: () => WorkItem,
86
+ WorkItemFinder: () => WorkItemFinder,
80
87
  WorkObject: () => WorkObject,
81
88
  default: () => src_default
82
89
  });
@@ -105,7 +112,7 @@ _a = IMPL_KEY;
105
112
  /**
106
113
  * @internal
107
114
  */
108
- Context[_a] = "Context";
115
+ Context[_a] = "context";
109
116
 
110
117
  // src/model/Space.ts
111
118
  var _a2;
@@ -314,9 +321,9 @@ _a12 = IMPL_KEY;
314
321
  */
315
322
  RichTextEditor[_a12] = "richTextEditor";
316
323
 
317
- // src/biz/Utils.ts
324
+ // src/biz/WorkItemFinder.ts
318
325
  var _a13;
319
- var Utils = class extends BaseModel {
326
+ var WorkItemFinder = class extends BaseModel {
320
327
  /**
321
328
  * @internal
322
329
  */
@@ -328,10 +335,26 @@ _a13 = IMPL_KEY;
328
335
  /**
329
336
  * @internal
330
337
  */
331
- Utils[_a13] = "utils";
338
+ WorkItemFinder[_a13] = "workItemFinder";
332
339
 
333
- // src/features/ContainerModal.ts
340
+ // src/biz/Utils.ts
334
341
  var _a14;
342
+ var Utils = class extends BaseModel {
343
+ /**
344
+ * @internal
345
+ */
346
+ static load() {
347
+ throw new Error("not implemented");
348
+ }
349
+ };
350
+ _a14 = IMPL_KEY;
351
+ /**
352
+ * @internal
353
+ */
354
+ Utils[_a14] = "utils";
355
+
356
+ // src/features/ContainerModal.ts
357
+ var _a15;
335
358
  var ContainerModal = class extends BaseModel {
336
359
  /**
337
360
  * 加载数据
@@ -340,14 +363,14 @@ var ContainerModal = class extends BaseModel {
340
363
  throw new Error("not implemented");
341
364
  }
342
365
  };
343
- _a14 = IMPL_KEY;
366
+ _a15 = IMPL_KEY;
344
367
  /**
345
368
  * @internal
346
369
  */
347
- ContainerModal[_a14] = "ContainerModal";
370
+ ContainerModal[_a15] = "containerModal";
348
371
 
349
372
  // src/features/Intercept.ts
350
- var _a15;
373
+ var _a16;
351
374
  var Intercept = class extends BaseModel {
352
375
  /**
353
376
  * 加载数据
@@ -356,14 +379,14 @@ var Intercept = class extends BaseModel {
356
379
  throw new Error("not implemented");
357
380
  }
358
381
  };
359
- _a15 = IMPL_KEY;
382
+ _a16 = IMPL_KEY;
360
383
  /**
361
384
  * @internal
362
385
  */
363
- Intercept[_a15] = "Intercept";
386
+ Intercept[_a16] = "intercept";
364
387
 
365
388
  // src/features/Control.ts
366
- var _a16;
389
+ var _a17;
367
390
  var Control = class extends BaseModel {
368
391
  /**
369
392
  * 加载数据
@@ -372,11 +395,91 @@ var Control = class extends BaseModel {
372
395
  throw new Error("not implemented");
373
396
  }
374
397
  };
375
- _a16 = IMPL_KEY;
398
+ _a17 = IMPL_KEY;
399
+ /**
400
+ * @internal
401
+ */
402
+ Control[_a17] = "control";
403
+
404
+ // src/features/Button.ts
405
+ var _a18;
406
+ var Button = class extends BaseModel {
407
+ /**
408
+ * 加载数据
409
+ */
410
+ static load() {
411
+ throw new Error("not implemented");
412
+ }
413
+ };
414
+ _a18 = IMPL_KEY;
415
+ /**
416
+ * @internal
417
+ */
418
+ Button[_a18] = "button";
419
+
420
+ // src/features/Configuration.ts
421
+ var _a19;
422
+ var Configuration = class extends BaseModel {
423
+ /**
424
+ * 加载数据
425
+ */
426
+ static load() {
427
+ throw new Error("not implemented");
428
+ }
429
+ };
430
+ _a19 = IMPL_KEY;
431
+ /**
432
+ * @internal
433
+ */
434
+ Configuration[_a19] = "configuration";
435
+
436
+ // src/features/Page.ts
437
+ var _a20;
438
+ var Page = class extends BaseModel {
439
+ /**
440
+ * 加载数据
441
+ */
442
+ static load() {
443
+ throw new Error("not implemented");
444
+ }
445
+ };
446
+ _a20 = IMPL_KEY;
447
+ /**
448
+ * @internal
449
+ */
450
+ Page[_a20] = "page";
451
+
452
+ // src/features/Tab.ts
453
+ var _a21;
454
+ var Tab = class extends BaseModel {
455
+ /**
456
+ * 加载数据
457
+ */
458
+ static load() {
459
+ throw new Error("not implemented");
460
+ }
461
+ };
462
+ _a21 = IMPL_KEY;
463
+ /**
464
+ * @internal
465
+ */
466
+ Tab[_a21] = "tab";
467
+
468
+ // src/features/View.ts
469
+ var _a22;
470
+ var View = class extends BaseModel {
471
+ /**
472
+ * 加载数据
473
+ */
474
+ static load() {
475
+ throw new Error("not implemented");
476
+ }
477
+ };
478
+ _a22 = IMPL_KEY;
376
479
  /**
377
480
  * @internal
378
481
  */
379
- Control[_a16] = "Control";
482
+ View[_a22] = "view";
380
483
 
381
484
  // src/client.ts
382
485
  function getImplClass(decl, impls) {
@@ -407,6 +510,41 @@ var _SDKClient = class {
407
510
  get control() {
408
511
  return getImplValue(Control, this._meegoBizHub);
409
512
  }
513
+ /**
514
+ * 按钮点位容器特有能力
515
+ * only 2.0
516
+ */
517
+ get button() {
518
+ return getImplValue(Button, this._meegoBizHub);
519
+ }
520
+ /**
521
+ * 配置点位容器特有能力
522
+ * only 2.0
523
+ */
524
+ get configuration() {
525
+ return getImplValue(Configuration, this._meegoBizHub);
526
+ }
527
+ /**
528
+ * 导航点位容器特有能力
529
+ * only 2.0
530
+ */
531
+ get page() {
532
+ return getImplValue(Page, this._meegoBizHub);
533
+ }
534
+ /**
535
+ * tab 点位容器特有能力
536
+ * only 2.0
537
+ */
538
+ get tab() {
539
+ return getImplValue(Tab, this._meegoBizHub);
540
+ }
541
+ /**
542
+ * 视图点位容器特有能力
543
+ * only 2.0
544
+ */
545
+ get view() {
546
+ return getImplValue(View, this._meegoBizHub);
547
+ }
410
548
  /**
411
549
  * 应用导航
412
550
  */
@@ -438,6 +576,13 @@ var _SDKClient = class {
438
576
  get richTextEditor() {
439
577
  return getImplValue(RichTextEditor, this._meegoBizHub);
440
578
  }
579
+ /**
580
+ * 工作项实例筛选器
581
+ * only web 2.0
582
+ */
583
+ get workItemFinder() {
584
+ return getImplValue(WorkItemFinder, this._meegoBizHub);
585
+ }
441
586
  /**
442
587
  * 模态框
443
588
  */
@@ -513,7 +658,7 @@ var SDKClient = _SDKClient;
513
658
  /**
514
659
  * SDK 版本号
515
660
  */
516
- SDKClient.version = "2.0.1-alpha.9";
661
+ SDKClient.version = "2.0.1-dev.22";
517
662
 
518
663
  // src/types/biz.ts
519
664
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -647,14 +792,27 @@ var InvalidParamsError = class extends CustomError {
647
792
  }
648
793
  };
649
794
 
795
+ // src/errors/NotSupportedError.ts
796
+ var NotSupportedError = class extends CustomError {
797
+ constructor(options) {
798
+ super({
799
+ message: "the api is not supported",
800
+ originMessage: options.originMessage
801
+ });
802
+ this.name = "NotSupportedError";
803
+ }
804
+ };
805
+
650
806
  // src/index.ts
651
807
  var src_default = SDKClient;
652
808
  // Annotate the CommonJS export names for ESM import in node:
653
809
  0 && (module.exports = {
654
810
  ActionSheet,
655
811
  AttributeType,
812
+ Button,
656
813
  ButtonScene,
657
814
  Clipboard,
815
+ Configuration,
658
816
  ContainerModal,
659
817
  Context,
660
818
  Control,
@@ -672,13 +830,18 @@ var src_default = SDKClient;
672
830
  NoAuthError,
673
831
  NodeStatus,
674
832
  NotFoundError,
833
+ NotSupportedError,
675
834
  OutOfLimitError,
835
+ Page,
676
836
  RichTextEditor,
677
837
  SDKClient,
678
838
  Space,
679
839
  Storage,
840
+ Tab,
680
841
  Toast,
681
842
  Utils,
843
+ View,
682
844
  WorkItem,
845
+ WorkItemFinder,
683
846
  WorkObject
684
847
  });
@@ -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 ConfigurationFeatureContext {
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
  }
@@ -545,6 +595,12 @@ declare abstract class Context extends BaseModel {
545
595
  * @param callback
546
596
  */
547
597
  abstract watch(callback: (nextValue: Context) => void): unwatch;
598
+ /**
599
+ * only web 2.0
600
+ * 用于获取插件内设置的上下文数据
601
+ * 例如:在 sdk.modal.open 时传入的 context,可以通过该方法来获取
602
+ */
603
+ abstract getCustomContext<Context>(): Promise<Context>;
548
604
  }
549
605
 
550
606
  /**
@@ -982,9 +1038,9 @@ declare abstract class ActionSheet extends BaseModel {
982
1038
  }
983
1039
 
984
1040
  /**
985
- * Modal 展示配置
1041
+ * Modal confirm 展示配置
986
1042
  */
987
- interface ModalOptions {
1043
+ interface ModalConfirmOptions {
988
1044
  /**
989
1045
  * 标题
990
1046
  * title 和 content 不可同时为空
@@ -1011,6 +1067,40 @@ interface ModalOptions {
1011
1067
  */
1012
1068
  cancelText?: string;
1013
1069
  }
1070
+ /**
1071
+ * Modal 展示配置
1072
+ */
1073
+ interface ModalOptions<Context> {
1074
+ /**
1075
+ * 宽度
1076
+ * 默认: 448
1077
+ */
1078
+ width?: number;
1079
+ /**
1080
+ * 高度
1081
+ */
1082
+ height?: number;
1083
+ /**
1084
+ * 是否全屏
1085
+ * 全屏时 width / height 无效
1086
+ */
1087
+ fullScreen?: boolean;
1088
+ /**
1089
+ * 是否允许通过点击遮罩来关闭对话框
1090
+ */
1091
+ maskClosable?: boolean;
1092
+ /**
1093
+ * 传入 Modal 内的上下文数据
1094
+ * 注:传入的数据在 Modal 内是通过 sdk.containerModal.getContext() 来获取的
1095
+ */
1096
+ context?: Context;
1097
+ /**
1098
+ * 响应弹窗内调用的 sdk.containerModal.submit 方法
1099
+ * @param params 弹窗内调用的 sdk.containerModal.submit 的方法时传入的自定义参数
1100
+ * @returns 调用 sdk.containerModal.submit 返回的自定义值
1101
+ */
1102
+ onSubmit?: (params: unknown) => Promise<unknown>;
1103
+ }
1014
1104
  /**
1015
1105
  * @public
1016
1106
  * Modal 用于等待用户响应、告知用户重要信息或在不丢失上下文的情况下展示更多信息
@@ -1025,16 +1115,25 @@ declare abstract class Modal extends BaseModel {
1025
1115
  */
1026
1116
  private static load;
1027
1117
  /**
1028
- * 打开模态框
1118
+ * 使用模态框 confirm
1029
1119
  * @param options
1030
1120
  * @param callback
1031
1121
  * confirmed 点击了确认
1032
1122
  * canceled 点击了取消
1033
1123
  */
1034
- abstract show(options: string | ModalOptions, callback: (result: {
1124
+ abstract confirm(options: string | ModalConfirmOptions, callback: (result: {
1035
1125
  confirmed: boolean;
1036
1126
  canceled: boolean;
1037
1127
  }) => void): Promise<void>;
1128
+ /**
1129
+ * only web 2.0
1130
+ * 打开自定义内容的模态框
1131
+ * @param options
1132
+ * @returns 当前打开 Modal 的关闭方法
1133
+ */
1134
+ abstract open<Context>(options: ModalOptions<Context>): Promise<{
1135
+ close: () => void;
1136
+ }>;
1038
1137
  }
1039
1138
 
1040
1139
  /**
@@ -1106,7 +1205,62 @@ declare abstract class RichTextEditor extends BaseModel {
1106
1205
  abstract show(options: RichTextEditorOptions, callback: (result: {
1107
1206
  confirmed: boolean;
1108
1207
  canceled: boolean;
1109
- content?: RichTextEditorContent;
1208
+ nextValue?: RichTextEditorContent;
1209
+ }) => void): Promise<void>;
1210
+ }
1211
+
1212
+ /**
1213
+ * WorkItemFinder 配置
1214
+ */
1215
+ interface WorkItemFinderOptions {
1216
+ /**
1217
+ * 空间标识
1218
+ */
1219
+ spaceId: string;
1220
+ /**
1221
+ * 工作项类型标识
1222
+ */
1223
+ workObjectId: string;
1224
+ /**
1225
+ * 筛选器标题,仅用于展示
1226
+ */
1227
+ title?: string;
1228
+ /**
1229
+ * 搜索条件标识
1230
+ * 如为空则生成新 key,不为空则会覆写
1231
+ * searchId 与 workObjectId | spaceId 不匹配则会异常
1232
+ */
1233
+ searchId?: string;
1234
+ /**
1235
+ * 默认 true,控制 searchId 的筛选条件是否回填到筛选器
1236
+ */
1237
+ backfill?: boolean;
1238
+ }
1239
+ /**
1240
+ * @public
1241
+ * WorkItemFinder 用于生成工作项实例筛选条件的面板
1242
+ */
1243
+ declare abstract class WorkItemFinder extends BaseModel {
1244
+ /**
1245
+ * @internal
1246
+ */
1247
+ protected static [IMPL_KEY]: string;
1248
+ /**
1249
+ * @internal
1250
+ */
1251
+ private static load;
1252
+ /**
1253
+ * 打开工作项实例筛选条件面板
1254
+ * @param options
1255
+ * @param callback
1256
+ * confirmed 点击了确认
1257
+ * canceled 点击了取消
1258
+ * searchId 当点击确认时,返回筛选条件标识 searchId
1259
+ */
1260
+ abstract open(options: WorkItemFinderOptions, callback: (result: {
1261
+ confirmed: boolean;
1262
+ canceled: boolean;
1263
+ searchId?: string;
1110
1264
  }) => void): Promise<void>;
1111
1265
  }
1112
1266
 
@@ -1156,10 +1310,16 @@ declare abstract class ContainerModal extends BaseModel {
1156
1310
  * 加载数据
1157
1311
  */
1158
1312
  static load(): Promise<ContainerModal>;
1313
+ /**
1314
+ * only web 2.0
1315
+ * 只存在于 modal.open 打开的容器内
1316
+ * submit 调用的是 sdk.modal.open 传入的 onSubmit 方法
1317
+ */
1318
+ abstract submit?: <Params, Result>(params: Params) => Promise<Result>;
1159
1319
  /**
1160
1320
  * 关闭插件当前激活的容器模态框
1161
1321
  */
1162
- abstract closeModal: Promise<void>;
1322
+ abstract close(): Promise<void>;
1163
1323
  }
1164
1324
 
1165
1325
  /**
@@ -1178,7 +1338,7 @@ declare abstract class Intercept extends BaseModel {
1178
1338
  /**
1179
1339
  * 获取当前触发的拦截事件上下文
1180
1340
  */
1181
- abstract getEventCtx<T = any>(): Promise<InterceptFeatureContext<T>>;
1341
+ abstract getContext<T = any>(): Promise<InterceptFeatureContext<T>>;
1182
1342
  }
1183
1343
 
1184
1344
  /**
@@ -1200,6 +1360,101 @@ declare abstract class Control extends BaseModel {
1200
1360
  abstract getContext(): Promise<ControlFeatureContext>;
1201
1361
  }
1202
1362
 
1363
+ /**
1364
+ * @public
1365
+ * 按钮
1366
+ */
1367
+ declare abstract class Button extends BaseModel {
1368
+ /**
1369
+ * @internal
1370
+ */
1371
+ protected static [IMPL_KEY]: string;
1372
+ /**
1373
+ * 加载数据
1374
+ */
1375
+ static load(): Promise<Button>;
1376
+ /**
1377
+ * 获取当前按钮的上下文
1378
+ */
1379
+ abstract getContext(): Promise<ButtonFeatureContext>;
1380
+ }
1381
+
1382
+ /**
1383
+ * @public
1384
+ * 控件
1385
+ */
1386
+ declare abstract class Configuration extends BaseModel {
1387
+ /**
1388
+ * @internal
1389
+ */
1390
+ protected static [IMPL_KEY]: string;
1391
+ /**
1392
+ * 加载数据
1393
+ */
1394
+ static load(): Promise<Configuration>;
1395
+ /**
1396
+ * 获取当前配置点位的上下文
1397
+ */
1398
+ abstract getContext(): Promise<ConfigurationFeatureContext>;
1399
+ }
1400
+
1401
+ /**
1402
+ * @public
1403
+ * 控件
1404
+ */
1405
+ declare abstract class Page extends BaseModel {
1406
+ /**
1407
+ * @internal
1408
+ */
1409
+ protected static [IMPL_KEY]: string;
1410
+ /**
1411
+ * 加载数据
1412
+ */
1413
+ static load(): Promise<Page>;
1414
+ /**
1415
+ * 获取当前内嵌页面的上下文
1416
+ */
1417
+ abstract getContext(): Promise<PageFeatureContext>;
1418
+ }
1419
+
1420
+ /**
1421
+ * @public
1422
+ * 控件
1423
+ */
1424
+ declare abstract class Tab extends BaseModel {
1425
+ /**
1426
+ * @internal
1427
+ */
1428
+ protected static [IMPL_KEY]: string;
1429
+ /**
1430
+ * 加载数据
1431
+ */
1432
+ static load(): Promise<Tab>;
1433
+ /**
1434
+ * 获取当前详情页 Tab 的上下文
1435
+ */
1436
+ abstract getContext(): Promise<TabFeatureContext>;
1437
+ }
1438
+
1439
+ /**
1440
+ * @public
1441
+ * 控件
1442
+ */
1443
+ declare abstract class View extends BaseModel {
1444
+ /**
1445
+ * @internal
1446
+ */
1447
+ protected static [IMPL_KEY]: string;
1448
+ /**
1449
+ * 加载数据
1450
+ */
1451
+ static load(): Promise<View>;
1452
+ /**
1453
+ * 获取当前视图的上下文
1454
+ */
1455
+ abstract getContext(): Promise<ViewFeatureContext>;
1456
+ }
1457
+
1203
1458
  /**
1204
1459
  * @public
1205
1460
  * SDKClient 的配置项
@@ -1232,6 +1487,31 @@ declare class SDKClient {
1232
1487
  * only 2.0
1233
1488
  */
1234
1489
  get control(): Control;
1490
+ /**
1491
+ * 按钮点位容器特有能力
1492
+ * only 2.0
1493
+ */
1494
+ get button(): Button;
1495
+ /**
1496
+ * 配置点位容器特有能力
1497
+ * only 2.0
1498
+ */
1499
+ get configuration(): Configuration;
1500
+ /**
1501
+ * 导航点位容器特有能力
1502
+ * only 2.0
1503
+ */
1504
+ get page(): Page;
1505
+ /**
1506
+ * tab 点位容器特有能力
1507
+ * only 2.0
1508
+ */
1509
+ get tab(): Tab;
1510
+ /**
1511
+ * 视图点位容器特有能力
1512
+ * only 2.0
1513
+ */
1514
+ get view(): View;
1235
1515
  /**
1236
1516
  * 应用导航
1237
1517
  */
@@ -1253,6 +1533,11 @@ declare class SDKClient {
1253
1533
  * only 2.0
1254
1534
  */
1255
1535
  get richTextEditor(): RichTextEditor;
1536
+ /**
1537
+ * 工作项实例筛选器
1538
+ * only web 2.0
1539
+ */
1540
+ get workItemFinder(): WorkItemFinder;
1256
1541
  /**
1257
1542
  * 模态框
1258
1543
  */
@@ -1359,6 +1644,16 @@ declare class InvalidParamsError extends CustomError {
1359
1644
  });
1360
1645
  }
1361
1646
 
1647
+ /**
1648
+ * @public
1649
+ * API 在当前环境不支持
1650
+ */
1651
+ declare class NotSupportedError extends CustomError {
1652
+ constructor(options: {
1653
+ originMessage: string;
1654
+ });
1655
+ }
1656
+
1362
1657
  /**
1363
1658
  * 用于飞书项目插件读取系统数据的 JSSDK
1364
1659
  *
@@ -1368,4 +1663,4 @@ declare class InvalidParamsError extends CustomError {
1368
1663
  * @packageDocumentation
1369
1664
  */
1370
1665
 
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 };
1666
+ export { ActionSheet, ActionSheetOptions, AttributeType, BizLine, BriefField, BriefNode, BriefSpace, BriefTemplate, BriefView, BriefWorkItem, BriefWorkObject, Button, ButtonFeatureContext, ButtonScene, Clipboard, ColorScheme, Configuration, ConfigurationFeatureContext, ContainerModal, Context, Control, ControlFeatureContext, CreateButtonFeatureContext, Field, FieldType, FlowMode, IMPL_KEY, IPluginCustomBuildConfig, IntegrationFeatureContext, Intercept, InterceptEvent, InterceptFeatureContext, InternalError, InvalidParamsError, Language, MEEGO_BIZ_HUB, Modal, ModalConfirmOptions, Navigation, NoAuthError, NodeStatus, NotFoundError, NotSupportedError, 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.1-dev.22",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"