@lark-project/js-sdk 2.0.8-dev.3 → 2.0.8-dev.5
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 +2 -0
- package/dist/es/index.js +2 -34
- package/dist/lib/index.js +2 -36
- package/dist/types/index.d.ts +29 -130
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
## 2.0.8 (2025/03/20)
|
|
3
3
|
- 「Add」新增 Button 计划表单元按钮 Context
|
|
4
4
|
- 「Add」新增 Button 视图批量按钮 Context
|
|
5
|
+
- 「Add」新增 ContainerModal 关闭时配置二次确认弹窗
|
|
6
|
+
- 「Deprecated」弃用 Context activeWorkItem
|
|
5
7
|
## 2.0.7 (2025/01/23)
|
|
6
8
|
- 「Add」新增 Control onWorkItemFormValueChanged / getDisplayInfo / openFullScreenPlugin
|
|
7
9
|
- 「Add」新增 Button onWorkItemFormValueChanged
|
package/dist/es/index.js
CHANGED
|
@@ -440,16 +440,6 @@ _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
|
-
|
|
453
443
|
// src/client.ts
|
|
454
444
|
function getImplClass(decl, impls) {
|
|
455
445
|
return impls == null ? void 0 : impls[decl[IMPL_KEY]];
|
|
@@ -634,7 +624,7 @@ var SDKClient = _SDKClient;
|
|
|
634
624
|
/**
|
|
635
625
|
* SDK 版本号
|
|
636
626
|
*/
|
|
637
|
-
SDKClient.version = "2.0.8-dev.
|
|
627
|
+
SDKClient.version = "2.0.8-dev.5";
|
|
638
628
|
|
|
639
629
|
// src/types/biz.ts
|
|
640
630
|
var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
|
|
@@ -715,19 +705,11 @@ var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
|
|
|
715
705
|
CustomComponentType2["Schedule"] = "schedule";
|
|
716
706
|
return CustomComponentType2;
|
|
717
707
|
})(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 || {});
|
|
726
708
|
|
|
727
709
|
// src/errors/CustomError.ts
|
|
728
710
|
var CustomError = class extends Error {
|
|
729
711
|
constructor(options) {
|
|
730
|
-
super(options.message);
|
|
712
|
+
super(`${options.message}, ${options.originMessage}`);
|
|
731
713
|
this.originMessage = options.originMessage;
|
|
732
714
|
}
|
|
733
715
|
};
|
|
@@ -783,19 +765,7 @@ var InvalidParamsError = class extends CustomError {
|
|
|
783
765
|
message: "invalid params error",
|
|
784
766
|
originMessage: options.originMessage
|
|
785
767
|
});
|
|
786
|
-
this.errCode = -1;
|
|
787
|
-
this.errMsg = "unkown error";
|
|
788
768
|
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
|
-
}
|
|
799
769
|
}
|
|
800
770
|
};
|
|
801
771
|
|
|
@@ -825,7 +795,6 @@ export {
|
|
|
825
795
|
Control,
|
|
826
796
|
CustomComponent,
|
|
827
797
|
CustomComponentType,
|
|
828
|
-
ExField,
|
|
829
798
|
Field,
|
|
830
799
|
FieldType,
|
|
831
800
|
FlowMode,
|
|
@@ -848,7 +817,6 @@ export {
|
|
|
848
817
|
Shared,
|
|
849
818
|
Space,
|
|
850
819
|
Storage,
|
|
851
|
-
SubFieldType,
|
|
852
820
|
Tab,
|
|
853
821
|
Toast,
|
|
854
822
|
Utils,
|
package/dist/lib/index.js
CHANGED
|
@@ -60,7 +60,6 @@ __export(src_exports, {
|
|
|
60
60
|
Control: () => Control,
|
|
61
61
|
CustomComponent: () => CustomComponent,
|
|
62
62
|
CustomComponentType: () => CustomComponentType,
|
|
63
|
-
ExField: () => ExField,
|
|
64
63
|
Field: () => Field,
|
|
65
64
|
FieldType: () => FieldType,
|
|
66
65
|
FlowMode: () => FlowMode,
|
|
@@ -83,7 +82,6 @@ __export(src_exports, {
|
|
|
83
82
|
Shared: () => Shared,
|
|
84
83
|
Space: () => Space,
|
|
85
84
|
Storage: () => Storage,
|
|
86
|
-
SubFieldType: () => SubFieldType,
|
|
87
85
|
Tab: () => Tab,
|
|
88
86
|
Toast: () => Toast,
|
|
89
87
|
Utils: () => Utils,
|
|
@@ -507,16 +505,6 @@ _a24 = IMPL_KEY;
|
|
|
507
505
|
*/
|
|
508
506
|
CustomComponent[_a24] = "customComponent";
|
|
509
507
|
|
|
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
|
-
|
|
520
508
|
// src/client.ts
|
|
521
509
|
function getImplClass(decl, impls) {
|
|
522
510
|
return impls == null ? void 0 : impls[decl[IMPL_KEY]];
|
|
@@ -701,7 +689,7 @@ var SDKClient = _SDKClient;
|
|
|
701
689
|
/**
|
|
702
690
|
* SDK 版本号
|
|
703
691
|
*/
|
|
704
|
-
SDKClient.version = "2.0.8-dev.
|
|
692
|
+
SDKClient.version = "2.0.8-dev.5";
|
|
705
693
|
|
|
706
694
|
// src/types/biz.ts
|
|
707
695
|
var AttributeType = /* @__PURE__ */ ((AttributeType2) => {
|
|
@@ -782,19 +770,11 @@ var CustomComponentType = /* @__PURE__ */ ((CustomComponentType2) => {
|
|
|
782
770
|
CustomComponentType2["Schedule"] = "schedule";
|
|
783
771
|
return CustomComponentType2;
|
|
784
772
|
})(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 || {});
|
|
793
773
|
|
|
794
774
|
// src/errors/CustomError.ts
|
|
795
775
|
var CustomError = class extends Error {
|
|
796
776
|
constructor(options) {
|
|
797
|
-
super(options.message);
|
|
777
|
+
super(`${options.message}, ${options.originMessage}`);
|
|
798
778
|
this.originMessage = options.originMessage;
|
|
799
779
|
}
|
|
800
780
|
};
|
|
@@ -850,19 +830,7 @@ var InvalidParamsError = class extends CustomError {
|
|
|
850
830
|
message: "invalid params error",
|
|
851
831
|
originMessage: options.originMessage
|
|
852
832
|
});
|
|
853
|
-
this.errCode = -1;
|
|
854
|
-
this.errMsg = "unkown error";
|
|
855
833
|
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
|
-
}
|
|
866
834
|
}
|
|
867
835
|
};
|
|
868
836
|
|
|
@@ -893,7 +861,6 @@ var src_default = SDKClient;
|
|
|
893
861
|
Control,
|
|
894
862
|
CustomComponent,
|
|
895
863
|
CustomComponentType,
|
|
896
|
-
ExField,
|
|
897
864
|
Field,
|
|
898
865
|
FieldType,
|
|
899
866
|
FlowMode,
|
|
@@ -916,7 +883,6 @@ var src_default = SDKClient;
|
|
|
916
883
|
Shared,
|
|
917
884
|
Space,
|
|
918
885
|
Storage,
|
|
919
|
-
SubFieldType,
|
|
920
886
|
Tab,
|
|
921
887
|
Toast,
|
|
922
888
|
Utils,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -697,70 +697,23 @@ interface CustomComponentProps {
|
|
|
697
697
|
disabled?: boolean;
|
|
698
698
|
};
|
|
699
699
|
}
|
|
700
|
-
/**
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
*/
|
|
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",
|
|
700
|
+
/**
|
|
701
|
+
* 构成弹窗配置
|
|
702
|
+
*/
|
|
703
|
+
interface ContainerModalConfigureOptions {
|
|
757
704
|
/**
|
|
758
|
-
*
|
|
759
|
-
* 工作项后端会转为 date + format "YYYY-MM-DD HH:mm:ss"
|
|
760
|
-
* (普通为 YYYY-MM-DD)
|
|
705
|
+
* 关闭前确认
|
|
761
706
|
*/
|
|
762
|
-
|
|
763
|
-
|
|
707
|
+
confirmBeforeClose?: {
|
|
708
|
+
/**
|
|
709
|
+
* 弹窗标题,仅支持字符串
|
|
710
|
+
*/
|
|
711
|
+
title: string;
|
|
712
|
+
/**
|
|
713
|
+
* 弹窗内容,仅支持字符串
|
|
714
|
+
*/
|
|
715
|
+
content: string;
|
|
716
|
+
};
|
|
764
717
|
}
|
|
765
718
|
|
|
766
719
|
/**
|
|
@@ -823,6 +776,7 @@ declare abstract class Context extends BaseModel {
|
|
|
823
776
|
*/
|
|
824
777
|
abstract loginUser: User;
|
|
825
778
|
/**
|
|
779
|
+
* @deprecated 请使用各功能构成的上下文读取当前的工作项信息,如 JSSDK.Button.getContext()
|
|
826
780
|
* 当前打开的工作项(仅工作项详情页可用)
|
|
827
781
|
*/
|
|
828
782
|
abstract activeWorkItem?: BriefWorkItem;
|
|
@@ -1092,6 +1046,13 @@ declare abstract class Navigation extends BaseModel {
|
|
|
1092
1046
|
*/
|
|
1093
1047
|
private static load;
|
|
1094
1048
|
/**
|
|
1049
|
+
* @public
|
|
1050
|
+
* only web 2.0
|
|
1051
|
+
* 读取当前页面地址的 origin
|
|
1052
|
+
*/
|
|
1053
|
+
abstract getOrigin(): Promise<string>;
|
|
1054
|
+
/**
|
|
1055
|
+
*
|
|
1095
1056
|
* 读取当前完整的页面地址
|
|
1096
1057
|
*/
|
|
1097
1058
|
abstract getHref(): Promise<string>;
|
|
@@ -1633,6 +1594,11 @@ declare abstract class ContainerModal extends BaseModel {
|
|
|
1633
1594
|
* 关闭插件当前激活的容器模态框
|
|
1634
1595
|
*/
|
|
1635
1596
|
abstract close(): Promise<void>;
|
|
1597
|
+
/**
|
|
1598
|
+
* only web 2.0
|
|
1599
|
+
* 配置当前弹窗,如点击关闭时是否需要确认
|
|
1600
|
+
*/
|
|
1601
|
+
abstract configure(options: ContainerModalConfigureOptions): Promise<void>;
|
|
1636
1602
|
}
|
|
1637
1603
|
|
|
1638
1604
|
/**
|
|
@@ -1874,70 +1840,6 @@ declare abstract class CustomComponent extends BaseModel {
|
|
|
1874
1840
|
};
|
|
1875
1841
|
}
|
|
1876
1842
|
|
|
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
|
-
|
|
1941
1843
|
/**
|
|
1942
1844
|
* @public
|
|
1943
1845
|
* SDKClient 的配置项
|
|
@@ -2127,12 +2029,9 @@ declare class OutOfLimitError extends CustomError {
|
|
|
2127
2029
|
* 请求参数异常
|
|
2128
2030
|
*/
|
|
2129
2031
|
declare class InvalidParamsError extends CustomError {
|
|
2130
|
-
errCode: number;
|
|
2131
|
-
errMsg: string;
|
|
2132
2032
|
constructor(options: {
|
|
2133
2033
|
originMessage: string;
|
|
2134
2034
|
});
|
|
2135
|
-
_parseErrorCode(): void;
|
|
2136
2035
|
}
|
|
2137
2036
|
|
|
2138
2037
|
/**
|
|
@@ -2154,4 +2053,4 @@ declare class NotSupportedError extends CustomError {
|
|
|
2154
2053
|
* @packageDocumentation
|
|
2155
2054
|
*/
|
|
2156
2055
|
|
|
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,
|
|
2056
|
+
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 };
|