@lark-project/js-sdk 2.0.4-dev.1 → 2.0.4-dev.2

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
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  * MIT License
4
- * Copyright (c) 2024 Lark Technologies Pte. Ltd.
4
+ * Copyright (c) 2025 Lark Technologies Pte. Ltd.
5
5
  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
  * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
7
7
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -624,7 +624,7 @@ var SDKClient = _SDKClient;
624
624
  /**
625
625
  * SDK 版本号
626
626
  */
627
- SDKClient.version = "2.0.4-dev.1";
627
+ SDKClient.version = "2.0.4-dev.2";
628
628
 
629
629
  // src/types/biz.ts
630
630
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -695,16 +695,16 @@ var InterceptEvent = /* @__PURE__ */ ((InterceptEvent2) => {
695
695
  InterceptEvent2[InterceptEvent2["UpdateState"] = 3001] = "UpdateState";
696
696
  return InterceptEvent2;
697
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 || {});
698
704
  var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
699
705
  CustomComponentType2["Schedule"] = "schedule";
700
706
  return CustomComponentType2;
701
707
  })(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 || {});
708
708
 
709
709
  // src/errors/CustomError.ts
710
710
  var CustomError = class extends Error {
@@ -788,12 +788,12 @@ export {
788
788
  Button,
789
789
  ButtonScene,
790
790
  Clipboard,
791
+ ComponentScheduleScene,
791
792
  Configuration,
792
793
  ContainerModal,
793
794
  Context,
794
795
  Control,
795
796
  CustomComponent,
796
- CustomComponentScene,
797
797
  CustomComponentType,
798
798
  Field,
799
799
  FieldType,
package/dist/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  * MIT License
4
- * Copyright (c) 2024 Lark Technologies Pte. Ltd.
4
+ * Copyright (c) 2025 Lark Technologies Pte. Ltd.
5
5
  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
  * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
7
7
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -53,12 +53,12 @@ __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,
60
61
  CustomComponent: () => CustomComponent,
61
- CustomComponentScene: () => CustomComponentScene,
62
62
  CustomComponentType: () => CustomComponentType,
63
63
  Field: () => Field,
64
64
  FieldType: () => FieldType,
@@ -689,7 +689,7 @@ var SDKClient = _SDKClient;
689
689
  /**
690
690
  * SDK 版本号
691
691
  */
692
- SDKClient.version = "2.0.4-dev.1";
692
+ SDKClient.version = "2.0.4-dev.2";
693
693
 
694
694
  // src/types/biz.ts
695
695
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -760,16 +760,16 @@ var InterceptEvent = /* @__PURE__ */ ((InterceptEvent2) => {
760
760
  InterceptEvent2[InterceptEvent2["UpdateState"] = 3001] = "UpdateState";
761
761
  return InterceptEvent2;
762
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 || {});
763
769
  var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
764
770
  CustomComponentType2["Schedule"] = "schedule";
765
771
  return CustomComponentType2;
766
772
  })(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 || {});
773
773
 
774
774
  // src/errors/CustomError.ts
775
775
  var CustomError = class extends Error {
@@ -854,12 +854,12 @@ var src_default = SDKClient;
854
854
  Button,
855
855
  ButtonScene,
856
856
  Clipboard,
857
+ ComponentScheduleScene,
857
858
  Configuration,
858
859
  ContainerModal,
859
860
  Context,
860
861
  Control,
861
862
  CustomComponent,
862
- CustomComponentScene,
863
863
  CustomComponentType,
864
864
  Field,
865
865
  FieldType,
@@ -522,6 +522,57 @@ interface InterceptFeatureContext<T> {
522
522
  }>;
523
523
  customData: T;
524
524
  }
525
+ /** ----------------------- 拓展组件-排期组件特化属性 ----------------------- */
526
+ /**
527
+ * 排期组件位置
528
+ */
529
+ declare enum ComponentScheduleScene {
530
+ /**
531
+ * 全部
532
+ */
533
+ ALL = 0,
534
+ /**
535
+ * 工作项节点/子任务
536
+ */
537
+ workItemNode = 1,
538
+ /**
539
+ * 计划表
540
+ */
541
+ scheduleTable = 2
542
+ }
543
+ declare enum WorkItemNodeType {
544
+ Node = "node",
545
+ SubTask = "sub_task",
546
+ SubWorkItem = "sub_workitem",
547
+ SuInstance = "sub_instance"
548
+ }
549
+ interface WorkItemInfo {
550
+ spaceId: string;
551
+ workObjectId: string;
552
+ workItemId: string;
553
+ }
554
+ type ComponentScheduleIdentity = WorkItemInfo & {
555
+ type: WorkItemNodeType;
556
+ nodeId: string;
557
+ taskId: string;
558
+ };
559
+ interface WbsStatus {
560
+ wbsStatus: string;
561
+ }
562
+ interface UserInfo {
563
+ role: string;
564
+ userName: string;
565
+ id: string;
566
+ }
567
+ type ScheduleCompValueType = string[];
568
+ /**
569
+ * schedule 组件类型校验返回值
570
+ */
571
+ interface ScheduleCompValidateMsg {
572
+ code: 200 | number;
573
+ msg: string;
574
+ }
575
+ /** ----------------------- 拓展点位通用类型 ----------------------- */
525
576
  /**
526
577
  * 自定义组件构成
527
578
  * 支持的定义组件类型
@@ -533,7 +584,22 @@ declare enum CustomComponentType {
533
584
  * 自定义组件构成
534
585
  * 允许用户定制指定业务组件类型的UI
535
586
  */
536
- interface CustomComponentFeatureContext {
587
+ interface CustomComponentFeatureContext<I extends {
588
+ /**
589
+ * 组件节点标识
590
+ * 适用场景:详情页为节点流时,且当前控件位于节点表单/计划表内,该字段才有数据
591
+ */
592
+ nodeId?: string;
593
+ /**
594
+ * 组件子任务标识
595
+ * 适用场景:详情页为节点流时,且当前控件位于节点表单/计划表内,该字段才有数据
596
+ */
597
+ taskId?: string;
598
+ }, S extends ComponentScheduleScene> {
599
+ /**
600
+ * 组件所处场景
601
+ */
602
+ scene: S;
537
603
  /**
538
604
  * 组件当前所属空间标识
539
605
  */
@@ -549,45 +615,9 @@ interface CustomComponentFeatureContext {
549
615
  workItemId?: number;
550
616
  /**
551
617
  * 组件唯一标识
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
- * 工作项节点/子任务
618
+ * 组件所属节点的所属空间/工作项/工作项实例以及节点任务标识
577
619
  */
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;
620
+ identity?: I;
591
621
  }
592
622
  /**
593
623
  * 自定义组件构成
@@ -597,8 +627,6 @@ interface CustomComponentProps {
597
627
  [CustomComponentType.Schedule]: {
598
628
  value: ScheduleCompValueType;
599
629
  disabled?: boolean;
600
- getContext: () => Promise<CustomComponentFeatureContext>;
601
- handleSubmit: (value: ScheduleCompValueType) => ScheduleCompValidateMsg;
602
630
  };
603
631
  }
604
632
 
@@ -1628,15 +1656,17 @@ declare abstract class CustomComponent extends BaseModel {
1628
1656
  */
1629
1657
  protected static [IMPL_KEY]: string;
1630
1658
  abstract [CustomComponentType.Schedule]: {
1631
- load: () => Promise<CustomComponentProps[CustomComponentType.Schedule]>;
1659
+ getProps: () => Promise<CustomComponentProps[CustomComponentType.Schedule]>;
1632
1660
  /**
1633
1661
  * 用于监听 props 变更
1634
1662
  * @param callback 返回 schedule 组件新的 props
1635
1663
  * @param watchKeys 监听的 key,只能监听属性的 key(不能监听 api key),不传默认监听所有 key。监听的 key 对应的值变更会触发回调
1636
1664
  * @returns
1637
1665
  */
1638
- watch: (callback: (next: CustomComponentProps[CustomComponentType.Schedule]) => void, watchKeys?: keyof Omit<CustomComponentProps[CustomComponentType.Schedule], 'getContext' | 'handleSubmit'>[]) => Off;
1639
- getContext: () => Promise<CustomComponentFeatureContext>;
1666
+ watch: (callback: (next: CustomComponentProps[CustomComponentType.Schedule]) => void, watchKeys?: (keyof CustomComponentProps[CustomComponentType.Schedule])[]) => Off;
1667
+ getContext: () => Promise<CustomComponentFeatureContext<ComponentScheduleIdentity, ComponentScheduleScene>>;
1668
+ getWbsStatus?: () => Promise<WbsStatus>;
1669
+ getOwnersInfo?: () => Promise<UserInfo[]>;
1640
1670
  handleSubmit: (value: ScheduleCompValueType) => Promise<ScheduleCompValidateMsg>;
1641
1671
  };
1642
1672
  }
@@ -1854,4 +1884,4 @@ declare class NotSupportedError extends CustomError {
1854
1884
  * @packageDocumentation
1855
1885
  */
1856
1886
 
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 };
1887
+ 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, 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, 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.4-dev.1",
3
+ "version": "2.0.4-dev.2",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"