@lark-project/js-sdk 2.0.4-dev.0 → 2.0.4-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/dist/es/index.js CHANGED
@@ -430,6 +430,16 @@ _a23 = IMPL_KEY;
430
430
  */
431
431
  View[_a23] = "view";
432
432
 
433
+ // src/features/CustomComponent.ts
434
+ var _a24;
435
+ var CustomComponent = class extends BaseModel {
436
+ };
437
+ _a24 = IMPL_KEY;
438
+ /**
439
+ * @internal
440
+ */
441
+ CustomComponent[_a24] = "customComponent";
442
+
433
443
  // src/client.ts
434
444
  function getImplClass(decl, impls) {
435
445
  return impls == null ? void 0 : impls[decl[IMPL_KEY]];
@@ -614,7 +624,7 @@ var SDKClient = _SDKClient;
614
624
  /**
615
625
  * SDK 版本号
616
626
  */
617
- SDKClient.version = "2.0.4-dev.0";
627
+ SDKClient.version = "2.0.4-dev.1";
618
628
 
619
629
  // src/types/biz.ts
620
630
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -685,6 +695,16 @@ var InterceptEvent = /* @__PURE__ */ ((InterceptEvent2) => {
685
695
  InterceptEvent2[InterceptEvent2["UpdateState"] = 3001] = "UpdateState";
686
696
  return InterceptEvent2;
687
697
  })(InterceptEvent || {});
698
+ var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
699
+ CustomComponentType2["Schedule"] = "schedule";
700
+ return CustomComponentType2;
701
+ })(CustomComponentType || {});
702
+ var CustomComponentScene = /* @__PURE__ */ ((CustomComponentScene2) => {
703
+ CustomComponentScene2[CustomComponentScene2["ALL"] = 0] = "ALL";
704
+ CustomComponentScene2[CustomComponentScene2["workItemNode"] = 1] = "workItemNode";
705
+ CustomComponentScene2[CustomComponentScene2["scheduleTable"] = 2] = "scheduleTable";
706
+ return CustomComponentScene2;
707
+ })(CustomComponentScene || {});
688
708
 
689
709
  // src/errors/CustomError.ts
690
710
  var CustomError = class extends Error {
@@ -772,6 +792,9 @@ export {
772
792
  ContainerModal,
773
793
  Context,
774
794
  Control,
795
+ CustomComponent,
796
+ CustomComponentScene,
797
+ CustomComponentType,
775
798
  Field,
776
799
  FieldType,
777
800
  FlowMode,
package/dist/lib/index.js CHANGED
@@ -57,6 +57,9 @@ __export(src_exports, {
57
57
  ContainerModal: () => ContainerModal,
58
58
  Context: () => Context,
59
59
  Control: () => Control,
60
+ CustomComponent: () => CustomComponent,
61
+ CustomComponentScene: () => CustomComponentScene,
62
+ CustomComponentType: () => CustomComponentType,
60
63
  Field: () => Field,
61
64
  FieldType: () => FieldType,
62
65
  FlowMode: () => FlowMode,
@@ -492,6 +495,16 @@ _a23 = IMPL_KEY;
492
495
  */
493
496
  View[_a23] = "view";
494
497
 
498
+ // src/features/CustomComponent.ts
499
+ var _a24;
500
+ var CustomComponent = class extends BaseModel {
501
+ };
502
+ _a24 = IMPL_KEY;
503
+ /**
504
+ * @internal
505
+ */
506
+ CustomComponent[_a24] = "customComponent";
507
+
495
508
  // src/client.ts
496
509
  function getImplClass(decl, impls) {
497
510
  return impls == null ? void 0 : impls[decl[IMPL_KEY]];
@@ -676,7 +689,7 @@ var SDKClient = _SDKClient;
676
689
  /**
677
690
  * SDK 版本号
678
691
  */
679
- SDKClient.version = "2.0.4-dev.0";
692
+ SDKClient.version = "2.0.4-dev.1";
680
693
 
681
694
  // src/types/biz.ts
682
695
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -747,6 +760,16 @@ var InterceptEvent = /* @__PURE__ */ ((InterceptEvent2) => {
747
760
  InterceptEvent2[InterceptEvent2["UpdateState"] = 3001] = "UpdateState";
748
761
  return InterceptEvent2;
749
762
  })(InterceptEvent || {});
763
+ var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
764
+ CustomComponentType2["Schedule"] = "schedule";
765
+ return CustomComponentType2;
766
+ })(CustomComponentType || {});
767
+ var CustomComponentScene = /* @__PURE__ */ ((CustomComponentScene2) => {
768
+ CustomComponentScene2[CustomComponentScene2["ALL"] = 0] = "ALL";
769
+ CustomComponentScene2[CustomComponentScene2["workItemNode"] = 1] = "workItemNode";
770
+ CustomComponentScene2[CustomComponentScene2["scheduleTable"] = 2] = "scheduleTable";
771
+ return CustomComponentScene2;
772
+ })(CustomComponentScene || {});
750
773
 
751
774
  // src/errors/CustomError.ts
752
775
  var CustomError = class extends Error {
@@ -835,6 +858,9 @@ var src_default = SDKClient;
835
858
  ContainerModal,
836
859
  Context,
837
860
  Control,
861
+ CustomComponent,
862
+ CustomComponentScene,
863
+ CustomComponentType,
838
864
  Field,
839
865
  FieldType,
840
866
  FlowMode,
@@ -522,6 +522,85 @@ interface InterceptFeatureContext<T> {
522
522
  }>;
523
523
  customData: T;
524
524
  }
525
+ /**
526
+ * 自定义组件构成
527
+ * 支持的定义组件类型
528
+ */
529
+ declare enum CustomComponentType {
530
+ Schedule = "schedule"
531
+ }
532
+ /**
533
+ * 自定义组件构成
534
+ * 允许用户定制指定业务组件类型的UI
535
+ */
536
+ interface CustomComponentFeatureContext {
537
+ /**
538
+ * 组件当前所属空间标识
539
+ */
540
+ spaceId: string;
541
+ /**
542
+ * 组件当前所属工作项类型标识
543
+ */
544
+ workObjectId: string;
545
+ /**
546
+ * 组件当前所属工作项实例标识
547
+ * 新建页表单内该值为空
548
+ */
549
+ workItemId?: number;
550
+ /**
551
+ * 组件唯一标识
552
+ * 新建场景结合 webhook 用于关联自有数据
553
+ * 详情页可能为空,不推荐强依赖 UUID 读取自有数据
554
+ */
555
+ UUID?: string;
556
+ /**
557
+ * 组件节点标识
558
+ * 适用场景:详情页为节点流时,且当前控件位于节点表单内,该字段才有数据
559
+ */
560
+ nodeId?: string;
561
+ /**
562
+ * 组件子任务标识
563
+ * 适用场景:详情页为节点流时,且当前控件位于节点表单内,该字段才有数据
564
+ */
565
+ taskId?: string;
566
+ }
567
+ /**
568
+ * 排期组件位置
569
+ */
570
+ declare enum CustomComponentScene {
571
+ /**
572
+ * 全部
573
+ */
574
+ ALL = 0,
575
+ /**
576
+ * 工作项节点/子任务
577
+ */
578
+ workItemNode = 1,
579
+ /**
580
+ * 计划表
581
+ */
582
+ scheduleTable = 2
583
+ }
584
+ /**
585
+ * schedule 组件类型校验返回值
586
+ */
587
+ type ScheduleCompValueType = string[];
588
+ interface ScheduleCompValidateMsg {
589
+ code: 200 | 403;
590
+ msg: string;
591
+ }
592
+ /**
593
+ * 自定义组件构成
594
+ * 各业务组件类型拥有的 props
595
+ */
596
+ interface CustomComponentProps {
597
+ [CustomComponentType.Schedule]: {
598
+ value: ScheduleCompValueType;
599
+ disabled?: boolean;
600
+ getContext: () => Promise<CustomComponentFeatureContext>;
601
+ handleSubmit: (value: ScheduleCompValueType) => ScheduleCompValidateMsg;
602
+ };
603
+ }
525
604
 
526
605
  /**
527
606
  * @internal
@@ -1133,9 +1212,8 @@ interface ModalOptions<Context> {
1133
1212
  /**
1134
1213
  * 响应弹窗内调用的 sdk.containerModal.submit 方法
1135
1214
  * @param params 弹窗内调用的 sdk.containerModal.submit 的方法时传入的自定义参数
1136
- * @returns 调用 sdk.containerModal.submit 返回的自定义值
1137
1215
  */
1138
- onSubmit?: (params: unknown) => Promise<unknown>;
1216
+ onSubmit?: (params: unknown) => void;
1139
1217
  }
1140
1218
  /**
1141
1219
  * @public
@@ -1367,7 +1445,7 @@ declare abstract class ContainerModal extends BaseModel {
1367
1445
  * 只存在于 modal.open 打开的容器内
1368
1446
  * submit 调用的是 sdk.modal.open 传入的 onSubmit 方法
1369
1447
  */
1370
- abstract submit?: <Params, Result>(params: Params) => Promise<Result>;
1448
+ abstract submit?: <Params>(params: Params) => Promise<void>;
1371
1449
  /**
1372
1450
  * mobile version ≥ 7.22.0
1373
1451
  * 关闭插件当前激活的容器模态框
@@ -1540,6 +1618,29 @@ declare abstract class View extends BaseModel {
1540
1618
  abstract getContext(): Promise<ViewFeatureContext>;
1541
1619
  }
1542
1620
 
1621
+ /**
1622
+ * @public
1623
+ * 自定义组件构成
1624
+ */
1625
+ declare abstract class CustomComponent extends BaseModel {
1626
+ /**
1627
+ * @internal
1628
+ */
1629
+ protected static [IMPL_KEY]: string;
1630
+ abstract [CustomComponentType.Schedule]: {
1631
+ load: () => Promise<CustomComponentProps[CustomComponentType.Schedule]>;
1632
+ /**
1633
+ * 用于监听 props 变更
1634
+ * @param callback 返回 schedule 组件新的 props
1635
+ * @param watchKeys 监听的 key,只能监听属性的 key(不能监听 api key),不传默认监听所有 key。监听的 key 对应的值变更会触发回调
1636
+ * @returns
1637
+ */
1638
+ watch: (callback: (next: CustomComponentProps[CustomComponentType.Schedule]) => void, watchKeys?: keyof Omit<CustomComponentProps[CustomComponentType.Schedule], 'getContext' | 'handleSubmit'>[]) => Off;
1639
+ getContext: () => Promise<CustomComponentFeatureContext>;
1640
+ handleSubmit: (value: ScheduleCompValueType) => Promise<ScheduleCompValidateMsg>;
1641
+ };
1642
+ }
1643
+
1543
1644
  /**
1544
1645
  * @public
1545
1646
  * SDKClient 的配置项
@@ -1753,4 +1854,4 @@ declare class NotSupportedError extends CustomError {
1753
1854
  * @packageDocumentation
1754
1855
  */
1755
1856
 
1756
- 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, Off, OutOfLimitError, Page, PageFeatureContext, RichTextEditor, RichTextEditorContent, RichTextEditorOptions, Role, RoleOwners, SDKClient, SDKClientOptions, Shared, Space, Storage, Tab, TabFeatureContext, Toast, ToastOptions, User, Utils, View, ViewFeatureContext, WorkItem, WorkItemButtonFeatureContext, WorkItemCreateFormPreset, WorkItemFinder, WorkItemFinderOptions, WorkObject, SDKClient as default, unwatch };
1857
+ export { ActionSheet, ActionSheetOptions, AttributeType, BizLine, BriefField, BriefNode, BriefSpace, BriefTemplate, BriefView, BriefWorkItem, BriefWorkObject, Button, ButtonFeatureContext, ButtonScene, Clipboard, ColorScheme, Configuration, ConfigurationFeatureContext, ContainerModal, Context, Control, ControlFeatureContext, CreateButtonFeatureContext, CustomComponent, CustomComponentFeatureContext, CustomComponentProps, CustomComponentScene, CustomComponentType, Field, FieldType, FlowMode, 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, ScheduleCompValidateMsg, ScheduleCompValueType, Shared, 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.4-dev.0",
3
+ "version": "2.0.4-dev.1",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"