@lark-project/js-sdk 2.0.8-dev.1 → 2.0.8-dev.3

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
@@ -440,6 +440,16 @@ _a24 = IMPL_KEY;
440
440
  */
441
441
  CustomComponent[_a24] = "customComponent";
442
442
 
443
+ // src/features/ExField.ts
444
+ var _a25;
445
+ var ExField = class extends BaseModel {
446
+ };
447
+ _a25 = IMPL_KEY;
448
+ /**
449
+ * @internal
450
+ */
451
+ ExField[_a25] = "exField";
452
+
443
453
  // src/client.ts
444
454
  function getImplClass(decl, impls) {
445
455
  return impls == null ? void 0 : impls[decl[IMPL_KEY]];
@@ -624,7 +634,7 @@ var SDKClient = _SDKClient;
624
634
  /**
625
635
  * SDK 版本号
626
636
  */
627
- SDKClient.version = "2.0.8-dev.1";
637
+ SDKClient.version = "2.0.8-dev.3";
628
638
 
629
639
  // src/types/biz.ts
630
640
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -705,6 +715,14 @@ var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
705
715
  CustomComponentType2["Schedule"] = "schedule";
706
716
  return CustomComponentType2;
707
717
  })(CustomComponentType || {});
718
+ var SubFieldType = /* @__PURE__ */ ((SubFieldType2) => {
719
+ SubFieldType2["FieldNumber"] = "number";
720
+ SubFieldType2["FieldMultiText"] = "text";
721
+ SubFieldType2["FieldTreeSelect"] = "tree-multi-select";
722
+ SubFieldType2["FieldDatePrecise"] = "date";
723
+ SubFieldType2["FieldMultiUser"] = "multi-user";
724
+ return SubFieldType2;
725
+ })(SubFieldType || {});
708
726
 
709
727
  // src/errors/CustomError.ts
710
728
  var CustomError = class extends Error {
@@ -765,7 +783,19 @@ var InvalidParamsError = class extends CustomError {
765
783
  message: "invalid params error",
766
784
  originMessage: options.originMessage
767
785
  });
786
+ this.errCode = -1;
787
+ this.errMsg = "unkown error";
768
788
  this.name = "InvalidParamsError";
789
+ this._parseErrorCode();
790
+ }
791
+ _parseErrorCode() {
792
+ try {
793
+ const { errCode, errMsg } = JSON.parse(this.originMessage);
794
+ this.errCode = errCode;
795
+ this.errMsg = errMsg;
796
+ } catch (e) {
797
+ this.errMsg = this.originMessage;
798
+ }
769
799
  }
770
800
  };
771
801
 
@@ -795,6 +825,7 @@ export {
795
825
  Control,
796
826
  CustomComponent,
797
827
  CustomComponentType,
828
+ ExField,
798
829
  Field,
799
830
  FieldType,
800
831
  FlowMode,
@@ -817,6 +848,7 @@ export {
817
848
  Shared,
818
849
  Space,
819
850
  Storage,
851
+ SubFieldType,
820
852
  Tab,
821
853
  Toast,
822
854
  Utils,
package/dist/lib/index.js CHANGED
@@ -60,6 +60,7 @@ __export(src_exports, {
60
60
  Control: () => Control,
61
61
  CustomComponent: () => CustomComponent,
62
62
  CustomComponentType: () => CustomComponentType,
63
+ ExField: () => ExField,
63
64
  Field: () => Field,
64
65
  FieldType: () => FieldType,
65
66
  FlowMode: () => FlowMode,
@@ -82,6 +83,7 @@ __export(src_exports, {
82
83
  Shared: () => Shared,
83
84
  Space: () => Space,
84
85
  Storage: () => Storage,
86
+ SubFieldType: () => SubFieldType,
85
87
  Tab: () => Tab,
86
88
  Toast: () => Toast,
87
89
  Utils: () => Utils,
@@ -505,6 +507,16 @@ _a24 = IMPL_KEY;
505
507
  */
506
508
  CustomComponent[_a24] = "customComponent";
507
509
 
510
+ // src/features/ExField.ts
511
+ var _a25;
512
+ var ExField = class extends BaseModel {
513
+ };
514
+ _a25 = IMPL_KEY;
515
+ /**
516
+ * @internal
517
+ */
518
+ ExField[_a25] = "exField";
519
+
508
520
  // src/client.ts
509
521
  function getImplClass(decl, impls) {
510
522
  return impls == null ? void 0 : impls[decl[IMPL_KEY]];
@@ -689,7 +701,7 @@ var SDKClient = _SDKClient;
689
701
  /**
690
702
  * SDK 版本号
691
703
  */
692
- SDKClient.version = "2.0.8-dev.1";
704
+ SDKClient.version = "2.0.8-dev.3";
693
705
 
694
706
  // src/types/biz.ts
695
707
  var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
@@ -770,6 +782,14 @@ var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
770
782
  CustomComponentType2["Schedule"] = "schedule";
771
783
  return CustomComponentType2;
772
784
  })(CustomComponentType || {});
785
+ var SubFieldType = /* @__PURE__ */ ((SubFieldType2) => {
786
+ SubFieldType2["FieldNumber"] = "number";
787
+ SubFieldType2["FieldMultiText"] = "text";
788
+ SubFieldType2["FieldTreeSelect"] = "tree-multi-select";
789
+ SubFieldType2["FieldDatePrecise"] = "date";
790
+ SubFieldType2["FieldMultiUser"] = "multi-user";
791
+ return SubFieldType2;
792
+ })(SubFieldType || {});
773
793
 
774
794
  // src/errors/CustomError.ts
775
795
  var CustomError = class extends Error {
@@ -830,7 +850,19 @@ var InvalidParamsError = class extends CustomError {
830
850
  message: "invalid params error",
831
851
  originMessage: options.originMessage
832
852
  });
853
+ this.errCode = -1;
854
+ this.errMsg = "unkown error";
833
855
  this.name = "InvalidParamsError";
856
+ this._parseErrorCode();
857
+ }
858
+ _parseErrorCode() {
859
+ try {
860
+ const { errCode, errMsg } = JSON.parse(this.originMessage);
861
+ this.errCode = errCode;
862
+ this.errMsg = errMsg;
863
+ } catch (e) {
864
+ this.errMsg = this.originMessage;
865
+ }
834
866
  }
835
867
  };
836
868
 
@@ -861,6 +893,7 @@ var src_default = SDKClient;
861
893
  Control,
862
894
  CustomComponent,
863
895
  CustomComponentType,
896
+ ExField,
864
897
  Field,
865
898
  FieldType,
866
899
  FlowMode,
@@ -883,6 +916,7 @@ var src_default = SDKClient;
883
916
  Shared,
884
917
  Space,
885
918
  Storage,
919
+ SubFieldType,
886
920
  Tab,
887
921
  Toast,
888
922
  Utils,
@@ -697,23 +697,70 @@ interface CustomComponentProps {
697
697
  disabled?: boolean;
698
698
  };
699
699
  }
700
- /**
701
- * 构成弹窗配置
702
- */
703
- interface ContainerModalConfigureOptions {
700
+ /** ----------------------- 拓展字段构成类型 ----------------------- */
701
+ interface ExFieldFeatureContext {
704
702
  /**
705
- * 关闭前确认
703
+ * 控件当前所属空间标识
706
704
  */
707
- confirmBeforeClose?: {
708
- /**
709
- * 弹窗标题,仅支持字符串
710
- */
711
- title: string;
712
- /**
713
- * 弹窗内容,仅支持字符串
714
- */
715
- content: string;
716
- };
705
+ spaceId: string;
706
+ /**
707
+ * 控件当前所属工作项类型标识
708
+ */
709
+ workObjectId: string;
710
+ /**
711
+ * 控件当前所属工作项实例标识
712
+ * 新建页表单内该值为空
713
+ */
714
+ workItemId?: number;
715
+ /**
716
+ * 当前节点标识
717
+ * 适用场景:详情页为节点流时,且当前控件位于节点表单内,该字段才有数据
718
+ */
719
+ nodeId?: string;
720
+ }
721
+ type FieldNumberValue = number;
722
+ type FieldMultiTextValue = string;
723
+ type FieldTreeSelectOptionValue = string[];
724
+ type FieldDatePreciseValue = string | number;
725
+ type FieldMultiUserValue = string[];
726
+ type FieldValue = FieldNumberValue | FieldMultiTextValue | FieldTreeSelectOptionValue | FieldDatePreciseValue | FieldMultiUserValue;
727
+ interface ExCompoundFieldValueType {
728
+ field_key: string;
729
+ field_value: {
730
+ field_key: string;
731
+ value?: FieldValue;
732
+ }[][];
733
+ }
734
+ type ExFieldValueType = ExCompoundFieldValueType;
735
+ interface ExFieldProps {
736
+ value: ExFieldValueType;
737
+ disabled?: boolean;
738
+ }
739
+ interface ExFieldConfig {
740
+ key: string;
741
+ type: string;
742
+ name: string;
743
+ children?: ExFieldConfig[];
744
+ }
745
+ interface ExFieldValidateMsg {
746
+ code: 200 | number;
747
+ msg: string;
748
+ }
749
+ declare enum SubFieldType {
750
+ FieldNumber = "number",
751
+ /**
752
+ * 开发者后台使用 multi-pure-text 作为 type,
753
+ * 工作项后端会转为 text + { multi: true }
754
+ */
755
+ FieldMultiText = "text",
756
+ FieldTreeSelect = "tree-multi-select",
757
+ /**
758
+ * 开发者后台使用 precise_date 作为 type,
759
+ * 工作项后端会转为 date + format "YYYY-MM-DD HH:mm:ss"
760
+ * (普通为 YYYY-MM-DD)
761
+ */
762
+ FieldDatePrecise = "date",
763
+ FieldMultiUser = "multi-user"
717
764
  }
718
765
 
719
766
  /**
@@ -1586,11 +1633,6 @@ declare abstract class ContainerModal extends BaseModel {
1586
1633
  * 关闭插件当前激活的容器模态框
1587
1634
  */
1588
1635
  abstract close(): Promise<void>;
1589
- /**
1590
- * only web 2.0
1591
- * 配置当前弹窗,如点击关闭时是否需要确认
1592
- */
1593
- abstract configure(options: ContainerModalConfigureOptions): Promise<void>;
1594
1636
  }
1595
1637
 
1596
1638
  /**
@@ -1832,6 +1874,70 @@ declare abstract class CustomComponent extends BaseModel {
1832
1874
  };
1833
1875
  }
1834
1876
 
1877
+ /**
1878
+ * @public
1879
+ * 自定义组件构成
1880
+ */
1881
+ declare abstract class ExField extends BaseModel {
1882
+ /**
1883
+ * @internal
1884
+ */
1885
+ protected static [IMPL_KEY]: string;
1886
+ abstract getContext: () => Promise<ExFieldFeatureContext>;
1887
+ abstract getProps: () => Promise<ExFieldProps>;
1888
+ /**
1889
+ * only for form
1890
+ * 用于监听 props 变更
1891
+ * @param callback 返回插件字段新的 props
1892
+ * @param watchKeys 监听的 key,只能监听属性的 key(不能监听 api key),不传默认监听所有 key。监听的 key 对应的值变更会触发回调
1893
+ * @returns
1894
+ */
1895
+ abstract watch: (callback: (next: ExFieldProps | Record<string, never>) => void, watchKeys?: (keyof ExFieldProps)[]) => Off;
1896
+ abstract saveFieldValue: (value: ExFieldValueType) => Promise<ExFieldValidateMsg>;
1897
+ abstract getFieldConfig: () => Promise<ExFieldConfig>;
1898
+ /**
1899
+ * 获取新建工作项表单项的值
1900
+ * mobile version ≥ 7.29.0
1901
+ * @param keys 需要获取的工作项属性 / 字段 ID 列表,一次限制读取 10 个 keys
1902
+ * @param keys.key 工作项属性 / 字段 ID
1903
+ * @param keys.type 类型
1904
+ * 工作项属性 name 为 FieldType.text,工作项属性 template 为 FieldType.number
1905
+ * 控件 role_owners 为 FieldType.control
1906
+ */
1907
+ abstract getCreateWorkItemFormItemValues(keys: Array<{
1908
+ key: string | AttributeType;
1909
+ type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting | FieldType.simpleVoting>;
1910
+ }>): Promise<Record<string | AttributeType, any>>;
1911
+ /**
1912
+ * 监听工作项表单项值变化
1913
+ * @param options.watchKeys 需要监听的工作项 字段 ID 列表
1914
+ * @param callback 当监听值发生变化时触发,changedValue 为变化的 kv
1915
+ */
1916
+ abstract onWorkItemFormValueChanged(options: {
1917
+ watchKeys: Array<{
1918
+ key: string | AttributeType;
1919
+ type: Exclude<FieldType, FieldType.richText | FieldType.singleSignal | FieldType.multiSignal | FieldType.singleVoting | FieldType.multiVoting | FieldType.simpleVoting>;
1920
+ }>;
1921
+ }, callback: (changedValue: Record<string, unknown>) => void): Promise<Off>;
1922
+ /**
1923
+ * only web for table
1924
+ * 打开全屏插件
1925
+ */
1926
+ abstract getTableCellInitProps(): Promise<ExFieldProps>;
1927
+ /**
1928
+ * only mobile 7.35.0+
1929
+ * 获取插件的展示态信息
1930
+ */
1931
+ abstract getDisplayInfo(): Promise<{
1932
+ display_height: number;
1933
+ }>;
1934
+ /**
1935
+ * only mobile 7.35.0+
1936
+ * 打开全屏插件
1937
+ */
1938
+ abstract openFullScreenPlugin(): void;
1939
+ }
1940
+
1835
1941
  /**
1836
1942
  * @public
1837
1943
  * SDKClient 的配置项
@@ -2021,9 +2127,12 @@ declare class OutOfLimitError extends CustomError {
2021
2127
  * 请求参数异常
2022
2128
  */
2023
2129
  declare class InvalidParamsError extends CustomError {
2130
+ errCode: number;
2131
+ errMsg: string;
2024
2132
  constructor(options: {
2025
2133
  originMessage: string;
2026
2134
  });
2135
+ _parseErrorCode(): void;
2027
2136
  }
2028
2137
 
2029
2138
  /**
@@ -2045,4 +2154,4 @@ declare class NotSupportedError extends CustomError {
2045
2154
  * @packageDocumentation
2046
2155
  */
2047
2156
 
2048
- 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, 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, ScheduleUnitButtonFeatureContext, Shared, Space, Storage, Tab, TabFeatureContext, Toast, ToastOptions, User, UserInfo, Utils, View, ViewFeatureContext, WbsStatus, WorkItem, WorkItemButtonFeatureContext, WorkItemCreateFormPreset, WorkItemFinder, WorkItemFinderOptions, WorkObject, SDKClient as default, unwatch };
2157
+ export { ActionSheet, ActionSheetOptions, AttributeType, BatchButtonFeatureContext, 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, 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.1",
3
+ "version": "2.0.8-dev.3",
4
4
  "runtimeMinVersions": {
5
5
  "web": "2.1.0",
6
6
  "mobile": "1.1.0"