@lark-project/js-sdk 2.0.8-dev.2 → 2.0.8-dev.4

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,9 @@
1
1
  # Change Log
2
+ ## 2.0.8 (2025/03/20)
3
+ - 「Add」新增 Button 计划表单元按钮 Context
4
+ - 「Add」新增 Button 视图批量按钮 Context
5
+ - 「Add」新增 ContainerModal 关闭时配置二次确认弹窗
6
+ - 「Deprecated」弃用 Context activeWorkItem
2
7
  ## 2.0.7 (2025/01/23)
3
8
  - 「Add」新增 Control onWorkItemFormValueChanged / getDisplayInfo / openFullScreenPlugin
4
9
  - 「Add」新增 Button onWorkItemFormValueChanged
package/dist/es/index.js CHANGED
@@ -634,7 +634,7 @@ var SDKClient = _SDKClient;
634
634
  /**
635
635
  * SDK 版本号
636
636
  */
637
- SDKClient.version = "2.0.8-dev.2";
637
+ SDKClient.version = "2.0.8-dev.4";
638
638
 
639
639
  // src/types/biz.ts
640
640
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -727,7 +727,7 @@ var SubFieldType = /* @__PURE__ */ ((SubFieldType2) => {
727
727
  // src/errors/CustomError.ts
728
728
  var CustomError = class extends Error {
729
729
  constructor(options) {
730
- super(options.message);
730
+ super(`${options.message}, ${options.originMessage}`);
731
731
  this.originMessage = options.originMessage;
732
732
  }
733
733
  };
@@ -786,15 +786,15 @@ var InvalidParamsError = class extends CustomError {
786
786
  this.errCode = -1;
787
787
  this.errMsg = "unkown error";
788
788
  this.name = "InvalidParamsError";
789
+ this.errMsg = this.originMessage;
789
790
  this._parseErrorCode();
790
791
  }
791
792
  _parseErrorCode() {
792
793
  try {
793
794
  const { errCode, errMsg } = JSON.parse(this.originMessage);
794
- this.errCode = errCode;
795
- this.errMsg = errMsg;
795
+ errCode !== void 0 && (this.errCode = errCode);
796
+ errMsg !== void 0 && (this.errMsg = errMsg);
796
797
  } catch (e) {
797
- this.errMsg = this.originMessage;
798
798
  }
799
799
  }
800
800
  };
package/dist/lib/index.js CHANGED
@@ -701,7 +701,7 @@ var SDKClient = _SDKClient;
701
701
  /**
702
702
  * SDK 版本号
703
703
  */
704
- SDKClient.version = "2.0.8-dev.2";
704
+ SDKClient.version = "2.0.8-dev.4";
705
705
 
706
706
  // src/types/biz.ts
707
707
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -794,7 +794,7 @@ var SubFieldType = /* @__PURE__ */ ((SubFieldType2) => {
794
794
  // src/errors/CustomError.ts
795
795
  var CustomError = class extends Error {
796
796
  constructor(options) {
797
- super(options.message);
797
+ super(`${options.message}, ${options.originMessage}`);
798
798
  this.originMessage = options.originMessage;
799
799
  }
800
800
  };
@@ -853,15 +853,15 @@ var InvalidParamsError = class extends CustomError {
853
853
  this.errCode = -1;
854
854
  this.errMsg = "unkown error";
855
855
  this.name = "InvalidParamsError";
856
+ this.errMsg = this.originMessage;
856
857
  this._parseErrorCode();
857
858
  }
858
859
  _parseErrorCode() {
859
860
  try {
860
861
  const { errCode, errMsg } = JSON.parse(this.originMessage);
861
- this.errCode = errCode;
862
- this.errMsg = errMsg;
862
+ errCode !== void 0 && (this.errCode = errCode);
863
+ errMsg !== void 0 && (this.errMsg = errMsg);
863
864
  } catch (e) {
864
- this.errMsg = this.originMessage;
865
865
  }
866
866
  }
867
867
  };
@@ -379,10 +379,75 @@ interface CreateButtonFeatureContext {
379
379
  */
380
380
  viewId?: string;
381
381
  }
382
+ interface ScheduleUnitButtonFeatureContext {
383
+ /**
384
+ * 空间标识
385
+ */
386
+ spaceId: string;
387
+ /**
388
+ * 工作项类型标识
389
+ */
390
+ workObjectId: string;
391
+ /**
392
+ * 工作项实例唯一标识
393
+ */
394
+ workItemId: number;
395
+ /**
396
+ * 计划表单元上下文信息
397
+ */
398
+ scheduleUnitCtx: {
399
+ /**
400
+ * 计划表编辑草稿标识
401
+ */
402
+ draftId: string;
403
+ /**
404
+ * 计划表单元父节点标识
405
+ */
406
+ parentUUID: string;
407
+ /**
408
+ * 计划表单元标识
409
+ */
410
+ uuid: string;
411
+ /**
412
+ * 计划表单元类型
413
+ */
414
+ type: string;
415
+ /**
416
+ * 计划表单元值
417
+ */
418
+ value: Record<string, any>;
419
+ };
420
+ }
421
+ /**
422
+ * 视图批量按钮上下文
423
+ * 适用场景:普通视图、工作项主页视图、工作台视图组件
424
+ */
425
+ interface BatchButtonFeatureContext {
426
+ /**
427
+ * 视图所属空间标识
428
+ */
429
+ spaceId: string;
430
+ /**
431
+ * 视图所属工作项类型标识
432
+ */
433
+ workObjectId: string;
434
+ /**
435
+ * 视图标识
436
+ */
437
+ viewId?: string;
438
+ /**
439
+ * 勾选的工作项实例
440
+ */
441
+ selectedWorkItems: Array<{
442
+ spaceId: string;
443
+ workObjectId: string;
444
+ workItemIds: number[];
445
+ }>;
446
+ }
382
447
  /**
383
448
  * 按钮构成
384
449
  */
385
- type ButtonFeatureContext = WorkItemButtonFeatureContext | CreateButtonFeatureContext;
450
+ type ButtonFeatureContext = WorkItemButtonFeatureContext | CreateButtonFeatureContext | BatchButtonFeatureContext | ScheduleUnitButtonFeatureContext;
386
451
  /**
387
452
  * 内嵌页面构成
388
453
  * 一个单独的导航入口+内嵌页面
@@ -697,6 +762,24 @@ declare enum SubFieldType {
697
762
  FieldDatePrecise = "date",
698
763
  FieldMultiUser = "multi-user"
699
764
  }
765
+ /**
766
+ * 构成弹窗配置
767
+ */
768
+ interface ContainerModalConfigureOptions {
769
+ /**
770
+ * 关闭前确认
771
+ */
772
+ confirmBeforeClose?: {
773
+ /**
774
+ * 弹窗标题,仅支持字符串
775
+ */
776
+ title: string;
777
+ /**
778
+ * 弹窗内容,仅支持字符串
779
+ */
780
+ content: string;
781
+ };
782
+ }
700
783
 
701
784
  /**
702
785
  * @internal
@@ -758,6 +841,7 @@ declare abstract class Context extends BaseModel {
758
841
  */
759
842
  abstract loginUser: User;
760
843
  /**
844
+ * @deprecated 请使用各功能构成的上下文读取当前的工作项信息,如 JSSDK.Button.getContext()
761
845
  * 当前打开的工作项(仅工作项详情页可用)
762
846
  */
763
847
  abstract activeWorkItem?: BriefWorkItem;
@@ -1568,6 +1652,11 @@ declare abstract class ContainerModal extends BaseModel {
1568
1652
  * 关闭插件当前激活的容器模态框
1569
1653
  */
1570
1654
  abstract close(): Promise<void>;
1655
+ /**
1656
+ * only web 2.0
1657
+ * 配置当前弹窗,如点击关闭时是否需要确认
1658
+ */
1659
+ abstract configure(options: ContainerModalConfigureOptions): Promise<void>;
1571
1660
  }
1572
1661
 
1573
1662
  /**
@@ -2089,4 +2178,4 @@ declare class NotSupportedError extends CustomError {
2089
2178
  * @packageDocumentation
2090
2179
  */
2091
2180
 
2092
- 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, ExCompoundFieldValueType, ExField, ExFieldConfig, ExFieldFeatureContext, ExFieldProps, ExFieldValidateMsg, ExFieldValueType, Field, FieldType, FieldValue, 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, SubFieldType, Tab, TabFeatureContext, Toast, ToastOptions, User, UserInfo, Utils, View, ViewFeatureContext, WbsStatus, WorkItem, WorkItemButtonFeatureContext, WorkItemCreateFormPreset, WorkItemFinder, WorkItemFinderOptions, WorkObject, SDKClient as default, unwatch };
2181
+ export { ActionSheet, ActionSheetOptions, AttributeType, BatchButtonFeatureContext, BizLine, BriefField, BriefNode, BriefSpace, BriefTemplate, BriefView, BriefWorkItem, BriefWorkObject, Button, ButtonFeatureContext, ButtonScene, Clipboard, ColorScheme, ComponentScheduleIdentity, ComponentScheduleScene, Configuration, ConfigurationFeatureContext, ContainerModal, ContainerModalConfigureOptions, Context, Control, ControlFeatureContext, CreateButtonFeatureContext, CustomComponent, CustomComponentFeatureContext, CustomComponentProps, CustomComponentType, ExCompoundFieldValueType, ExField, ExFieldConfig, ExFieldFeatureContext, ExFieldProps, ExFieldValidateMsg, ExFieldValueType, Field, FieldType, FieldValue, 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, ScheduleUnitButtonFeatureContext, Shared, Space, Storage, SubFieldType, 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.8-dev.2",
3
+ "version": "2.0.8-dev.4",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"