@lark-project/js-sdk 2.0.4-dev.0 → 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.
@@ -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.2";
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
@@ -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,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.4-dev.0";
692
+ SDKClient.version = "2.0.4-dev.2";
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,
@@ -522,6 +522,113 @@ 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
+ /** ----------------------- 拓展点位通用类型 ----------------------- */
576
+ /**
577
+ * 自定义组件构成
578
+ * 支持的定义组件类型
579
+ */
580
+ declare enum CustomComponentType {
581
+ Schedule = "schedule"
582
+ }
583
+ /**
584
+ * 自定义组件构成
585
+ * 允许用户定制指定业务组件类型的UI
586
+ */
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;
603
+ /**
604
+ * 组件当前所属空间标识
605
+ */
606
+ spaceId: string;
607
+ /**
608
+ * 组件当前所属工作项类型标识
609
+ */
610
+ workObjectId: string;
611
+ /**
612
+ * 组件当前所属工作项实例标识
613
+ * 新建页表单内该值为空
614
+ */
615
+ workItemId?: number;
616
+ /**
617
+ * 组件唯一标识
618
+ * 组件所属节点的所属空间/工作项/工作项实例以及节点任务标识
619
+ */
620
+ identity?: I;
621
+ }
622
+ /**
623
+ * 自定义组件构成
624
+ * 各业务组件类型拥有的 props
625
+ */
626
+ interface CustomComponentProps {
627
+ [CustomComponentType.Schedule]: {
628
+ value: ScheduleCompValueType;
629
+ disabled?: boolean;
630
+ };
631
+ }
525
632
 
526
633
  /**
527
634
  * @internal
@@ -1133,9 +1240,8 @@ interface ModalOptions<Context> {
1133
1240
  /**
1134
1241
  * 响应弹窗内调用的 sdk.containerModal.submit 方法
1135
1242
  * @param params 弹窗内调用的 sdk.containerModal.submit 的方法时传入的自定义参数
1136
- * @returns 调用 sdk.containerModal.submit 返回的自定义值
1137
1243
  */
1138
- onSubmit?: (params: unknown) => Promise<unknown>;
1244
+ onSubmit?: (params: unknown) => void;
1139
1245
  }
1140
1246
  /**
1141
1247
  * @public
@@ -1367,7 +1473,7 @@ declare abstract class ContainerModal extends BaseModel {
1367
1473
  * 只存在于 modal.open 打开的容器内
1368
1474
  * submit 调用的是 sdk.modal.open 传入的 onSubmit 方法
1369
1475
  */
1370
- abstract submit?: <Params, Result>(params: Params) => Promise<Result>;
1476
+ abstract submit?: <Params>(params: Params) => Promise<void>;
1371
1477
  /**
1372
1478
  * mobile version ≥ 7.22.0
1373
1479
  * 关闭插件当前激活的容器模态框
@@ -1540,6 +1646,31 @@ declare abstract class View extends BaseModel {
1540
1646
  abstract getContext(): Promise<ViewFeatureContext>;
1541
1647
  }
1542
1648
 
1649
+ /**
1650
+ * @public
1651
+ * 自定义组件构成
1652
+ */
1653
+ declare abstract class CustomComponent extends BaseModel {
1654
+ /**
1655
+ * @internal
1656
+ */
1657
+ protected static [IMPL_KEY]: string;
1658
+ abstract [CustomComponentType.Schedule]: {
1659
+ getProps: () => Promise<CustomComponentProps[CustomComponentType.Schedule]>;
1660
+ /**
1661
+ * 用于监听 props 变更
1662
+ * @param callback 返回 schedule 组件新的 props
1663
+ * @param watchKeys 监听的 key,只能监听属性的 key(不能监听 api key),不传默认监听所有 key。监听的 key 对应的值变更会触发回调
1664
+ * @returns
1665
+ */
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[]>;
1670
+ handleSubmit: (value: ScheduleCompValueType) => Promise<ScheduleCompValidateMsg>;
1671
+ };
1672
+ }
1673
+
1543
1674
  /**
1544
1675
  * @public
1545
1676
  * SDKClient 的配置项
@@ -1753,4 +1884,4 @@ declare class NotSupportedError extends CustomError {
1753
1884
  * @packageDocumentation
1754
1885
  */
1755
1886
 
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 };
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.0",
3
+ "version": "2.0.4-dev.2",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"