@lark-project/js-sdk 2.0.6 → 2.0.7

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,6 +1,13 @@
1
1
  # Change Log
2
+ ## 2.0.7 (2025/01/23)
3
+ - 「Add」新增 Control onWorkItemFormValueChanged / getDisplayInfo / openFullScreenPlugin
4
+ - 「Add」新增 Button onWorkItemFormValueChanged
5
+ - 「Add」新增 Tab onWorkItemFormValueChanged
6
+ - 「Add」新增 CustomComponent - schedule 点位
7
+
2
8
  ## 2.0.6 (2024/09/12)
3
9
  - 「Add」新增 Fullscreen Modal
10
+ - 「Add」新增 Context loginUser tenantId
4
11
 
5
12
  ## 2.0.5 (2024/08/13)
6
13
  - 「Add」新增 Button Context
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.6";
627
+ SDKClient.version = "2.0.7";
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 ComponentScheduleScene = /* @__PURE__ */ ((ComponentScheduleScene2) => {
699
+ ComponentScheduleScene2[ComponentScheduleScene2["ALL"] = 0] = "ALL";
700
+ ComponentScheduleScene2[ComponentScheduleScene2["workItemNode"] = 1] = "workItemNode";
701
+ ComponentScheduleScene2[ComponentScheduleScene2["scheduleTable"] = 2] = "scheduleTable";
702
+ return ComponentScheduleScene2;
703
+ })(ComponentScheduleScene || {});
704
+ var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
705
+ CustomComponentType2["Schedule"] = "schedule";
706
+ return CustomComponentType2;
707
+ })(CustomComponentType || {});
688
708
 
689
709
  // src/errors/CustomError.ts
690
710
  var CustomError = class extends Error {
@@ -768,10 +788,13 @@ export {
768
788
  Button,
769
789
  ButtonScene,
770
790
  Clipboard,
791
+ ComponentScheduleScene,
771
792
  Configuration,
772
793
  ContainerModal,
773
794
  Context,
774
795
  Control,
796
+ CustomComponent,
797
+ CustomComponentType,
775
798
  Field,
776
799
  FieldType,
777
800
  FlowMode,
package/dist/lib/index.js CHANGED
@@ -53,10 +53,13 @@ __export(src_exports, {
53
53
  Button: () => Button,
54
54
  ButtonScene: () => ButtonScene,
55
55
  Clipboard: () => Clipboard,
56
+ ComponentScheduleScene: () => ComponentScheduleScene,
56
57
  Configuration: () => Configuration,
57
58
  ContainerModal: () => ContainerModal,
58
59
  Context: () => Context,
59
60
  Control: () => Control,
61
+ CustomComponent: () => CustomComponent,
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.6";
692
+ SDKClient.version = "2.0.7";
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 ComponentScheduleScene = /* @__PURE__ */ ((ComponentScheduleScene2) => {
764
+ ComponentScheduleScene2[ComponentScheduleScene2["ALL"] = 0] = "ALL";
765
+ ComponentScheduleScene2[ComponentScheduleScene2["workItemNode"] = 1] = "workItemNode";
766
+ ComponentScheduleScene2[ComponentScheduleScene2["scheduleTable"] = 2] = "scheduleTable";
767
+ return ComponentScheduleScene2;
768
+ })(ComponentScheduleScene || {});
769
+ var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
770
+ CustomComponentType2["Schedule"] = "schedule";
771
+ return CustomComponentType2;
772
+ })(CustomComponentType || {});
750
773
 
751
774
  // src/errors/CustomError.ts
752
775
  var CustomError = class extends Error {
@@ -831,10 +854,13 @@ var src_default = SDKClient;
831
854
  Button,
832
855
  ButtonScene,
833
856
  Clipboard,
857
+ ComponentScheduleScene,
834
858
  Configuration,
835
859
  ContainerModal,
836
860
  Context,
837
861
  Control,
862
+ CustomComponent,
863
+ CustomComponentType,
838
864
  Field,
839
865
  FieldType,
840
866
  FlowMode,
@@ -15,6 +15,11 @@ interface User {
15
15
  * 用户头像
16
16
  */
17
17
  avatar: string;
18
+ /**
19
+ * 所属租户
20
+ * @mobile_version >= 7.37
21
+ */
22
+ tenantId?: string;
18
23
  }
19
24
  /**
20
25
  * @public
@@ -522,6 +527,111 @@ interface InterceptFeatureContext<T> {
522
527
  }>;
523
528
  customData: T;
524
529
  }
530
+ /** ----------------------- 拓展组件-排期组件特化属性 ----------------------- */
531
+ /**
532
+ * 排期组件位置
533
+ */
534
+ declare enum ComponentScheduleScene {
535
+ /**
536
+ * 全部
537
+ */
538
+ ALL = 0,
539
+ /**
540
+ * 工作项节点/子任务
541
+ */
542
+ workItemNode = 1,
543
+ /**
544
+ * 计划表
545
+ */
546
+ scheduleTable = 2
547
+ }
548
+ declare enum WorkItemNodeType {
549
+ Node = "node",
550
+ SubTask = "sub_task",
551
+ SubWorkItem = "sub_workitem",
552
+ SubInstance = "sub_instance"
553
+ }
554
+ interface WorkItemInfo {
555
+ spaceId: string;
556
+ workObjectId: string;
557
+ workItemId: number;
558
+ }
559
+ type ComponentScheduleIdentity = WorkItemInfo & {
560
+ type: WorkItemNodeType;
561
+ nodeId: string;
562
+ taskId: string;
563
+ };
564
+ interface WbsStatus {
565
+ wbsStatus: string;
566
+ }
567
+ interface UserInfo {
568
+ userKey: string;
569
+ }
570
+ type ScheduleCompValueType = string[];
571
+ /**
572
+ * schedule 组件类型校验返回值
573
+ */
574
+ interface ScheduleCompValidateMsg {
575
+ code: 200 | number;
576
+ msg: string;
577
+ }
578
+ /** ----------------------- 拓展点位通用类型 ----------------------- */
579
+ /**
580
+ * 自定义组件构成
581
+ * 支持的定义组件类型
582
+ */
583
+ declare enum CustomComponentType {
584
+ Schedule = "schedule"
585
+ }
586
+ /**
587
+ * 自定义组件构成
588
+ * 允许用户定制指定业务组件类型的UI
589
+ */
590
+ interface CustomComponentFeatureContext<I extends {
591
+ /**
592
+ * 组件节点标识
593
+ * 适用场景:详情页为节点流时,且当前控件位于节点表单/计划表内,该字段才有数据
594
+ */
595
+ nodeId?: string;
596
+ /**
597
+ * 组件子任务标识
598
+ * 适用场景:详情页为节点流时,且当前控件位于节点表单/计划表内,该字段才有数据
599
+ */
600
+ taskId?: string;
601
+ }, S extends ComponentScheduleScene> {
602
+ /**
603
+ * 组件所处场景
604
+ */
605
+ scene: S;
606
+ /**
607
+ * 组件当前所属空间标识
608
+ */
609
+ spaceId: string;
610
+ /**
611
+ * 组件当前所属工作项类型标识
612
+ */
613
+ workObjectId: string;
614
+ /**
615
+ * 组件当前所属工作项实例标识
616
+ * 新建页表单内该值为空
617
+ */
618
+ workItemId?: number;
619
+ /**
620
+ * 组件唯一标识
621
+ * 组件所属节点的所属空间/工作项/工作项实例以及节点任务标识
622
+ */
623
+ identity?: I;
624
+ }
625
+ /**
626
+ * 自定义组件构成
627
+ * 各业务组件类型拥有的 props
628
+ */
629
+ interface CustomComponentProps {
630
+ [CustomComponentType.Schedule]: {
631
+ value: ScheduleCompValueType;
632
+ disabled?: boolean;
633
+ };
634
+ }
525
635
 
526
636
  /**
527
637
  * @internal
@@ -1444,7 +1554,7 @@ declare abstract class Control extends BaseModel {
1444
1554
  */
1445
1555
  abstract getCreateWorkItemFormItemValues(keys: Array<{
1446
1556
  key: string | AttributeType;
1447
- type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting>;
1557
+ type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting | FieldType.simpleVoting>;
1448
1558
  }>): Promise<Record<string | AttributeType, any>>;
1449
1559
  /**
1450
1560
  * only web 2.0
@@ -1459,9 +1569,32 @@ declare abstract class Control extends BaseModel {
1459
1569
  abstract onCreateWorkItemFormValueChanged(options: {
1460
1570
  watchKeys: Array<{
1461
1571
  key: string | AttributeType;
1462
- type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting>;
1572
+ type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting | FieldType.simpleVoting>;
1463
1573
  }>;
1464
1574
  }, callback: (changedKeys: Array<string | AttributeType>) => void): Off;
1575
+ /**
1576
+ * 监听工作项表单项值变化
1577
+ * @param options.watchKeys 需要监听的工作项 字段 ID 列表
1578
+ * @param callback 当监听值发生变化时触发,changedValue 为变化的 kv
1579
+ */
1580
+ abstract onWorkItemFormValueChanged(options: {
1581
+ watchKeys: Array<{
1582
+ key: string | AttributeType;
1583
+ type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting | FieldType.simpleVoting>;
1584
+ }>;
1585
+ }, callback: (changedValue: Record<string, unknown>) => void): Promise<Off>;
1586
+ /**
1587
+ * only mobile 7.35.0+
1588
+ * 获取插件的展示态信息
1589
+ */
1590
+ abstract getDisplayInfo(): Promise<{
1591
+ display_height: number;
1592
+ }>;
1593
+ /**
1594
+ * only mobile 7.35.0+
1595
+ * 打开全屏插件
1596
+ */
1597
+ abstract openFullScreenPlugin(): void;
1465
1598
  }
1466
1599
 
1467
1600
  /**
@@ -1482,11 +1615,23 @@ declare abstract class Button extends BaseModel {
1482
1615
  * 获取当前按钮的上下文
1483
1616
  */
1484
1617
  abstract getContext(): Promise<ButtonFeatureContext>;
1618
+ /**
1619
+ * only web 2.0
1620
+ * 监听工作项表单项值变化
1621
+ * @param options.watchKeys 需要监听的工作项 字段 ID 列表
1622
+ * @param callback 当监听值发生变化时触发,changedValue 为变化的 kv
1623
+ */
1624
+ abstract onWorkItemFormValueChanged(options: {
1625
+ watchKeys: Array<{
1626
+ key: string | AttributeType;
1627
+ type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting | FieldType.simpleVoting>;
1628
+ }>;
1629
+ }, callback: (changedValue: Record<string, unknown>) => void): Promise<Off>;
1485
1630
  }
1486
1631
 
1487
1632
  /**
1488
1633
  * @public
1489
- * 控件
1634
+ * 插件配置
1490
1635
  */
1491
1636
  declare abstract class Configuration extends BaseModel {
1492
1637
  /**
@@ -1505,7 +1650,7 @@ declare abstract class Configuration extends BaseModel {
1505
1650
 
1506
1651
  /**
1507
1652
  * @public
1508
- * 控件
1653
+ * 内嵌页面
1509
1654
  */
1510
1655
  declare abstract class Page extends BaseModel {
1511
1656
  /**
@@ -1524,7 +1669,7 @@ declare abstract class Page extends BaseModel {
1524
1669
 
1525
1670
  /**
1526
1671
  * @public
1527
- * 控件
1672
+ * 详情页
1528
1673
  */
1529
1674
  declare abstract class Tab extends BaseModel {
1530
1675
  /**
@@ -1539,11 +1684,23 @@ declare abstract class Tab extends BaseModel {
1539
1684
  * 获取当前详情页 Tab 的上下文
1540
1685
  */
1541
1686
  abstract getContext(): Promise<TabFeatureContext>;
1687
+ /**
1688
+ * only web 2.0
1689
+ * 监听工作项表单项值变化
1690
+ * @param options.watchKeys 需要监听的工作项 字段 ID 列表
1691
+ * @param callback 当监听值发生变化时触发,changedValue 为变化的 kv
1692
+ */
1693
+ abstract onWorkItemFormValueChanged(options: {
1694
+ watchKeys: Array<{
1695
+ key: string | AttributeType;
1696
+ type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting | FieldType.simpleVoting>;
1697
+ }>;
1698
+ }, callback: (changedValue: Record<string, unknown>) => void): Promise<Off>;
1542
1699
  }
1543
1700
 
1544
1701
  /**
1545
1702
  * @public
1546
- * 控件
1703
+ * 视图
1547
1704
  */
1548
1705
  declare abstract class View extends BaseModel {
1549
1706
  /**
@@ -1560,6 +1717,33 @@ declare abstract class View extends BaseModel {
1560
1717
  abstract getContext(): Promise<ViewFeatureContext>;
1561
1718
  }
1562
1719
 
1720
+ /**
1721
+ * @public
1722
+ * 自定义组件构成
1723
+ */
1724
+ declare abstract class CustomComponent extends BaseModel {
1725
+ /**
1726
+ * @internal
1727
+ */
1728
+ protected static [IMPL_KEY]: string;
1729
+ abstract [CustomComponentType.Schedule]: {
1730
+ getProps: () => Promise<CustomComponentProps[CustomComponentType.Schedule]>;
1731
+ /**
1732
+ * 用于监听 props 变更
1733
+ * @param callback 返回 schedule 组件新的 props
1734
+ * @param watchKeys 监听的 key,只能监听属性的 key(不能监听 api key),不传默认监听所有 key。监听的 key 对应的值变更会触发回调
1735
+ * @returns
1736
+ */
1737
+ watch: (callback: (next: CustomComponentProps[CustomComponentType.Schedule]) => void, watchKeys?: (keyof CustomComponentProps[CustomComponentType.Schedule])[]) => Off;
1738
+ getContext: () => Promise<CustomComponentFeatureContext<ComponentScheduleIdentity, ComponentScheduleScene>>;
1739
+ resizeContainer: (width?: number, height?: number) => Promise<undefined>;
1740
+ getWbsStatus?: () => Promise<WbsStatus>;
1741
+ getOwnersInfo?: () => Promise<UserInfo[]>;
1742
+ handleSubmit: (value: ScheduleCompValueType) => Promise<ScheduleCompValidateMsg>;
1743
+ handleCancel: () => Promise<void>;
1744
+ };
1745
+ }
1746
+
1563
1747
  /**
1564
1748
  * @public
1565
1749
  * SDKClient 的配置项
@@ -1773,4 +1957,4 @@ declare class NotSupportedError extends CustomError {
1773
1957
  * @packageDocumentation
1774
1958
  */
1775
1959
 
1776
- 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, IRichTextEditorImageUploadComplete, IntegrationFeatureContext, Intercept, InterceptEvent, InterceptFeatureContext, InternalError, InvalidParamsError, Language, MEEGO_BIZ_HUB, Modal, ModalConfirmOptions, ModalOpenOptions, 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 };
1960
+ export { ActionSheet, ActionSheetOptions, AttributeType, BizLine, BriefField, BriefNode, BriefSpace, BriefTemplate, BriefView, BriefWorkItem, BriefWorkObject, Button, ButtonFeatureContext, ButtonScene, Clipboard, ColorScheme, ComponentScheduleIdentity, ComponentScheduleScene, Configuration, ConfigurationFeatureContext, ContainerModal, Context, Control, ControlFeatureContext, CreateButtonFeatureContext, CustomComponent, CustomComponentFeatureContext, CustomComponentProps, CustomComponentType, Field, FieldType, FlowMode, IMPL_KEY, IPluginCustomBuildConfig, IRichTextEditorImageUploadComplete, IntegrationFeatureContext, Intercept, InterceptEvent, InterceptFeatureContext, InternalError, InvalidParamsError, Language, MEEGO_BIZ_HUB, Modal, ModalConfirmOptions, ModalOpenOptions, 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, UserInfo, Utils, View, ViewFeatureContext, WbsStatus, 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.6",
3
+ "version": "2.0.7",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"